# Moment-generating function (MGF) of non-central chi-squared distribution

I need to compute the moment-generating function of the non-central chi-squared distribution, but I have no idea where to begin.

Let $Z$ have a standard normal distribution, with mean $0$ and variance $1$, then $(Z+\mu)^2$ has a noncentral chi-squared distribution with one degree of freedom. The moment-generating function of $(Z+\mu)^2$ then is \begin{equation} E[e^{t(Z+\mu)^2}] = \int_{-\infty}^{+\infty} e^{t(z+\mu)^2} f_Z(z) \text{d}z \end{equation} with $f_Z(z) = \frac{1}{\sqrt{2\pi}}e^{-z^2/2}$ the density of $Z$. Then, \begin{align*} E[e^{t(Z+\mu)^2}] & = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{+\infty} e^{t(z+\mu)^2} e^{-z^2/2}\text{d}z\\ & = \frac{1}{\sqrt{2\pi}} \int \exp[-(\frac{1}{2}-t)z^2+2\mu t z +\mu^2 t] \text{d} z\\ & = \frac{1}{\sqrt{2\pi}} \int \exp[-(\frac{1}{2}-t) (z-Q)^2+\mu^2 t + \frac{2\mu^2 t^2}{1-2t}] \text{d} z \qquad\text{with } Q=\frac{2\mu t}{1-2t}\\ & = \exp[\mu^2 t + \frac{2\mu^2t^2}{1-2t}] \frac{1}{\sqrt{2\pi}} \int \exp[-\frac{(z-Q)^2}{2(1-2t)^{-1}}] \text{d}z\\ & = \exp[\mu^2 t + \frac{2\mu^2t^2}{1-2t}] (1-2t)^{-1/2} \times \frac{1}{\sqrt{2\pi}(1-2t)^{-1/2}} \int \exp[-\frac{(z-Q)^2}{2(1-2t)^{-1}}] \text{d}z\\ & = \exp[\mu^2 t + \frac{2\mu^2t^2}{1-2t}] (1-2t)^{-1/2} \times 1\\ & = \exp[\frac{\mu^2 t}{1-2t} ] (1-2t)^{-1/2} \end{align*} By definition, a noncentral chi-squared distributed random variable $\chi^2_{n,\lambda}$ with $n$ df and parameter $\lambda=\sum_{i=1}^n \mu_i^2$ is the sum of the squares of $n$ independent normal variables $X_i=Z_i+\mu_i$, $i=1,\ldots,n$. That is, \begin{equation*} \chi^2_{n,\lambda} = \sum_{i=1}^n X_i^2 = \sum_{i=1}^n (Z_i+\mu_i)^2 \end{equation*} Because all terms are jointly independent and using the above result, we have \begin{align*} E[e^{t\chi^2_{n,\lambda}}] & = E[\prod_i \exp[t(Z_i+\mu_i)^2]]\\ & = \prod_i E[\exp[t(Z_i+\mu_i)^2]]\\ & = \prod_i (1-2t)^{-1/2} \exp[\frac{\mu_i^2t}{1-2t}]\\ & = (1-2t)^{-n/2} \exp[\frac{t}{1-2t}\sum_i \mu_i^2]\\ & = (1-2t)^{-n/2} \exp[\frac{\lambda t}{1-2t}]\\ \end{align*}
• Hi Stijn, I don't understand how you have $E[e^{t(Z+\mu)^2}] = \int_{-\infty}^{+\infty} e^{t(z+\mu)^2} f_Z(z)$, with $f_Z(z) = \dfrac{1}{\sqrt{2\pi}}e^-{z^2/2}.$ $X = (Z+\mu)^2$ has a noncentral $\chi^2$ distribution, so shouldn't we have a moment generating function of the form $E[e^{t(Z + \mu)^2}] = \int e^{t(Z + \mu)^2} f_X(x)dx$, where $f_X(x)$ is the probability density function of the noncentral $\chi^2$ distribution? Mar 6 '18 at 17:21
• @titusAdam: No. The correct formula for the expectation of a function $g(Z)$ of a (continuous) random variable $Z$ with density function $f_Z(z)$ is $\text{E}[g(Z)]=\int g(z) f_Z(z)\text{d}z$. In our case here we have $\text{E}[e^{tX}]=\int e^{tx}f_X(x)\text{d}x=\text{E}[e^{t(Z+\mu)^2}]=\int e^{t(z+\mu)^2}f_Z(z)\text{d}z$. So either you integrate over $x$ or over $z$, but not something in between. Mar 8 '18 at 19:12