moment-generating function of the chi-square distribution How do we find the moment-generating function of the chi-square distribution?  I really couldn't figure it out.  The integral is 
$$E[e^{tX}]=\frac{1}{2^{r/2}\Gamma(r/2)}\int_0^\infty x^{(r-2)/2}e^{-x/2}e^{tx}dx.$$
I'm going over it for a while but can't seem to find the solution.
By the way, the answer should be $$(1-2t)^{(-r/2)}.$$
 A: In case you have not yet figure it out, the value of the integral follows by simple scaling of the integrand. First, assume $t < \frac{1}{2}$, then change variables $x = (1-2 t) y$:
$$
\int_0^\infty x^{(r-2)/2} \mathrm{e}^{-x/2}\mathrm{e}^{t x}\mathrm{d}x =
 \int_0^\infty x^{r/2} \mathrm{e}^{-\frac{(1-2 t) x}{2}} \, \frac{\mathrm{d}x}{x} =
 \left(1-2 t\right)^{-r/2} \int_0^\infty y^{r/2} \mathrm{e}^{-\frac{t}{2}}  \, \frac{\mathrm{d}y}{y}
$$
The integral in $y$ gives the normalization constant, and value of m.g.f. follows.
A: $$
\begin{align}
& {}\qquad E[e^{tX}]=\frac{1}{2^{r/2}\Gamma(r/2)}\int_0^\infty x^{(r-2)/2}e^{-x/2}e^{tx}\;dx  \\  \\  \\
& = \frac{1}{2^{r/2}\Gamma(r/2)}\int_0^\infty x^{(r-2)/2}e^{x(t-(1/2))}\;dx \\  \\  \\
& = \frac{1}{2^{r/2}\Gamma(r/2)}\int_0^{-\infty} \left(\frac{u}{t-\frac12}\right)^{(r-2)/2}(e^u)\left(\frac{du}{t-\frac12}\right) \\  \\  \\
& = \frac{1}{2^{r/2}\Gamma(r/2)} \frac{1}{(t-\frac12)^{r/2}} \int_0^{-\infty} u^{(r-2)/2} e^u \; du.
\end{align}
$$
This last integral is a value of the Gamma function.
And notice that
$$
2^{r/2} \left(t-\frac12\right)^{r/2} = (2t-1)^{r/2}.
$$
Later edit: Someone questioned the correctness of what is written above; hence these comments.
Notice that as $x$ goes from $0$ to $+\infty$, $u$ will go from $0$ to $-\infty$, since the factor $t-\frac12$ is negative.
Now let $w=-u$, so $u=-w$ and $du=-dw$ and as $u$ goes from $0$ to $-\infty$, then $w$ goes from $0$ to $+\infty$, and we get something that looks like the standard form of the integral that defines the Gamma function.
This still leaves us with the question of raising a negative number to a power.
The fraction $\dfrac{u}{t-\frac12}$ is positive since $u$ and $t-\frac12$ are both negative.  So instead of what was done above, let us substitute $\dfrac{u}{\frac12-t}$ for $x$.  Then $u$ goes from $0$ to $+\infty$ and $e^{x(t-\frac12)}$ will become $e^{-u}$.  Then this should work out without the additional substitution, and we won't have the problem of raising a negative number to a power.
The integral is then $\Gamma(r/2)$, so it cancels that factor in the denominator.
