# 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)}.$$

-
You have $E[e^{tX}]$ on the left side of "$=$", and on the right side the letter $t$ is missing! That should tell you something's wrong. – Michael Hardy Oct 10 '11 at 19:09
silly mistake, i've added e^tx to the end of the integral now. thanks. – monte13 Oct 10 '11 at 19:15

\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.

-
much thanks, appreciate it! – monte13 Oct 10 '11 at 19:58
btw i think there is a typo after the third line. the integral seems to be in the interval 0 to the plus infinity. and also doesn't the gamma integral has the term $$e^{-u}$$ and not $$e^u$$? – monte13 Oct 10 '11 at 20:03
Since $t-(1/2)$ would be negative, $u$ would go from $0$ to $-\infty$ as $x$ goes from $0$ to $+\infty$. And you have to do another (trivial) substitution to give it exactly the form in which the definition of the Gamma function is usually written. – Michael Hardy Oct 11 '11 at 0:40
Now I've further edited the answer. There was an error, but it wasn't where you located it. It was the problem of raising a negative number to a power. – Michael Hardy Oct 11 '11 at 0:58

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.

-