I'm working on a few moment generating function problems and I came across:
$f(x)=(x^2e^{-x})/2$ for $x>0$, and zero otherwise.
Find the mean. The mean is the same as the expected value. If we find the moment generating function, $M_x(t)$, of $f(x)$ then we can take the first derivative of $M_x(t)$ at $t=0$. This will give us the mean.
To find the $M_x(t)$ we take $$\int_{-\infty}^{\infty}e^{tx}f(x)dx$$
$$\int_{0}^{\infty}e^{tx}(x^2e^{-x})/2dx$$
I wrote this as:
$$\frac12\int_{0}^{\infty}x^{2}e^{x(t-1)}dx$$
I'm a bit rusty on integration and if someone could help point me in the right direction as to how to tackle this guy I would greatly appreciate it!
Integrate by parts two times: \begin{aligned} I & = \frac{1}{2}\int_0^\infty x^2e^{x(t-1)}dx = \\ & = \frac{1}{2}\left[x^2\frac{e^{x(t-1)}}{t-1}\right]^{x=\infty}_{x=0} - \frac{1}{2}\int_0^\infty 2x\frac{e^{x(t-1)}}{t-1}dx = \\ & = -\frac{1}{2}\left[2x\frac{e^{x(t-1)}}{(t-1)^2}\right]^{x=\infty}_{x=0} + \frac{1}{2}\int_0^\infty 2\frac{e^{x(t-1)}}{(t-1)^2}dx = \\ & = \frac{1}{2}\left[2\frac{e^{x(t-1)}}{(t-1)^3}\right]^{x=\infty}_{x=0} = \\ & = -\frac{1}{(t-1)^3} \end{aligned} Note that $t<1$ is required for convergence.