I came across a piecewise function which seems pretty basic, but I don't know how to find the moment-generating function. If $X$ has the pdf $f_X(x)=x$ for $0\leq x\leq 1$, $2-x$ for $1\leq x \leq 2$ and $0$ elsewhere, how do we find $M_X(t)$?
basic moment generating function
2
$\begingroup$
probability-distributions
1 Answers
2
$f_X$ is defined piecewise, so you'll need to split the integral defining $M(t)$ up as follows $\eqalign{M_X(t)&= \int_{-\infty}^\infty e^{tx} f_X(x)\,dx\cr &= \int_{-\infty}^0e^{tx} f_X(x)\,dx+\int_{0}^1 e^{tx} f_X(x)\,dx +\int_{1}^2 e^{tx} f_X(x)\,dx +\int_{2}^\infty e^{tx} f_X(x)\,dx\cr \cr &= 0+ \int_0^1 e^{tx} \cdot x\,dx+\int_1^2 e^{tx}\cdot(2-x) \,dx+0\cr &= \int_0^1x e^{tx} \,dx+\int_1^2 (2-x)e^{tx} \,dx. } $
To evaluate the remaining intergrals, you may use integration by parts.