For this question, I'm stuck on finding $M(t)$, the mean, and variance, and I was wondering if anyone can help me out? Here's what I have so far
Suppose $X$ is a continuous random variable with the following probability density function: $$f(x) = 0.5x^2 e^{-x}$$ Use the moment generating function $M(t)$ to find the mean and variance of $X$
$M(t) = \int_0^\infty e^{tx} f(x)dx$
$ = \int_0^\infty e^{tx}0.5x^2e^{-x}dx$
$ = 0.5 \int_0^\infty e^{-x(1-t)}x^2dx$
Let $u = x^2 \Rightarrow du = 2xdx$
Let $v = \int_0^\infty e^{-x(1-t)}dx \Rightarrow dv = e^{-(1-t)x}$
I think you just misunderstood the integration by parts (please check the formula again in here)
Follow that, you should let $dv=e^{-(1-t)x}\Leftrightarrow v = \frac{e^{-(1-t)x}}{-(1-t)}$
Your equation $= uv|^\infty_0 - \displaystyle\int^\infty_0 vdu$
$=0.5(x^2\frac{e^{-(1-t)x}}{-(1-t)}\vert^\infty_0 - \displaystyle\int^\infty_0 \frac{e^{-(1-t)x}}{-(1-t)}2xdx)$
$=0 + \frac{1}{1-t} \displaystyle\int^\infty_0 e^{-x(1-t)}xdx$
Then we do the integration by parts again, finally, we have:
$M(t)= \frac{1}{1-t} (x\frac{e^{-(1-t)x}}{-(1-t)}\vert^\infty_0 - \displaystyle\int^\infty_0 \frac{e^{-(1-t)x}}{-(1-t)}dx)$
$=0+\frac{1}{(1-t)^2} \times \frac{1}{1-t}=\frac{1}{(1-t)^3}$
Please calculate again to verify the result.