# Finding the Moment Generating Function of chi-squared distribution

I'm tasked with deriving the MGF of a $$\chi^2$$ random variable.

I think the way to do is is by using the fact that $$\Sigma_{j=1}^{m} Z^2_j$$ is a $$\chi^2$$ R.V. and that MGF of a sum is the product of the MGFs of the individual terms. Although that may not be right and it may be $$E(e^{tX})$$ way.

I don't need it solved really just need to get down the track a little further.

Yes, since $\chi^2$ is a sum of $Z_i^2$ the MGF is a product of individual summands. But then you need the MGF of $Z_i^2$ which is $\chi^2$ with 1 degree of freedom. The obvious way of calculating the MGF of $\chi^2$ is by integrating. It is not that hard:

$$Ee^{tX}=\frac{1}{2^{k/2}\Gamma(k/2)}\int_0^\infty x^{k/2-1}e^{-x(1/2-t)}dx$$

Now do the change of variables $y=x(1/2-t)$, then note that you get Gamma function and the result is yours. If you want deeper insights (if there are any) try asking at http://math.stackexchange.com.

I think the easiest way is to simply start with a single squared gaussian: $$E[e^{tX^2}] = \int_{-\infty}^\infty e^{tx^2}\tfrac1{\sqrt{2\pi}}e^{-x^2/2}dx = \tfrac1{\sqrt{2\pi}}\int_{-\infty}^\infty e^{-(1-2t)x^2/2}dx = \tfrac1{\sqrt{1-2t}},$$ for $$t<1/2$$. Since the Chi-squared is just a sum of independent squared gaussians, you get the factor $$k$$ in the exponent.

• +1 It's nice to see a clever approach that might even generalize to other situations. Of course this answer is limited to integral degrees of freedom.
– whuber
Jul 13, 2017 at 14:30
• I've never even thought about non-integral degrees of freedom. To me "the sum of $k$ squared gaussians" has basically been the definition of Chi-Squared. It's nice to see there is more to it than that :-) May 25 at 18:18
• Arbitrary df show up in various contexts, such as the Satterthwaite and CABF t-tests.
– whuber
May 25 at 19:51

You can also do this calculation by brute-force straight from the general chi-squared distribution, without appeal to any intermediate appeal to sums of random variables. For $X \sim \chi_n^2$ we have moment generating function:

\begin{aligned} M_X(t) \equiv \mathbb{E}(\exp (tX)) &= \int \limits_0^\infty \exp(tx) \cdot \text{Chi-Sq}(x | n) dx \\[8pt] &= \frac{1}{2^{n/2} \Gamma(n/2)} \int \limits_0^\infty \exp(tx) \cdot x^{n/2-1} \exp(-x/2) dx \\[8pt] &= \frac{1}{2^{n/2} \Gamma(n/2)} \int \limits_0^\infty x^{n/2-1} \exp((t -\tfrac{1}{2})x) dx. \\[8pt] \end{aligned}

For the case where $t < \tfrac{1}{2}$, using the change-of-variable $r = (\tfrac{1}{2} - t)x$ we have:

\begin{aligned} M_X(t) &= \frac{1}{2^{n/2} \Gamma(n/2)} \int \limits_0^\infty x^{n/2-1} \exp((t -\tfrac{1}{2})x) dx. \\[8pt] &= (\tfrac{1}{2} - t)^{-n/2} \cdot \frac{1}{2^{n/2} \Gamma(n/2)} \int \limits_0^\infty r^{n/2-1} \exp(-r) dr. \\[8pt] &= (1 - 2t)^{-n/2} \cdot \frac{1}{\Gamma(n/2)} \int \limits_0^\infty r^{n/2-1} \exp(-r) dr. \\[8pt] &= (1 - 2t)^{-n/2}. \\[8pt] \end{aligned}

• The details are nicely laid out, but the approach appears identical to that of the accepted answer.
– whuber
Oct 30, 2018 at 13:34