Tutorials › VEE Mathematical Statistics › The MGF of a Normal Variable

VEE Mathematical Statistics · Moment Generating Functions · Tutorial 233 of 880

The MGF of a Normal Variable

Learn how the normal density leads to its MGF, how to extract its first two moments, and how the standard normal case fits the general formula.

Intermediate 10 min read

What You'll Learn

  • Derive the normal MGF directly from its density by completing the square.
  • State the MGF for a normal variable and its domain.
  • Differentiate the MGF to obtain the mean, second raw moment, and variance.
  • Recognize the standard normal MGF as a special case.
  • Catch the error of using the standard deviation where the variance belongs.

Why the Normal MGF Has a Simple Form

For a normal random variable, the density contains a squared term in the exponent. In the MGF integral, multiplying that density by \(e^{tX}\) adds a linear term in \(X\). Completing the square combines those terms into a shifted normal density and a factor that depends only on \(t\). That calculation gives a compact formula for the MGF, from which the mean and variance can be checked by differentiation.

The parameter convention matters: throughout, \(X\sim N(\mu,\sigma^2)\) means that \(\mu\) is the mean and \(\sigma^2\) is the variance. In particular, \(\sigma>0\) is the standard deviation. Keeping these roles distinct prevents a frequent error in the exponent of the MGF.

Definition: If \(X\) has a moment generating function in an interval containing zero, its MGF is \(M_X(t)=E[e^{tX}]\) for values of \(t\) where this expectation is finite. For \(X\sim N(\mu,\sigma^2)\), the density is \(f_X(x)=\frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)\), for \(-\infty<x<\infty\), with \(\sigma>0\).

Deriving the MGF by Completing the Square

Begin with the density definition of the MGF. The calculation requires no restriction on the real number \(t\), because the completed-square integral remains a normal density integral for every real \(t\).

1
Write the expectation as an integral.
Multiply \(e^{tx}\) by the normal density and integrate over the full real line.
2
Collect the exponent terms.
Combine \(tx\) with the quadratic exponent from the density.
3
Complete the square and integrate.
The remaining integral is the total probability under a normal density, so it equals one.
$$ \begin{aligned} M_X(t) &= \int_{-\infty}^{\infty} e^{tx} \frac{1}{\sigma\sqrt{2\pi}} \exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)\,dx\\ &= \int_{-\infty}^{\infty} \frac{1}{\sigma\sqrt{2\pi}} \exp\left(tx-\frac{(x-\mu)^2}{2\sigma^2}\right)\,dx. \end{aligned} $$

To complete the square, first combine the terms in the exponent:

$$ \begin{aligned} tx-\frac{(x-\mu)^2}{2\sigma^2} &=-\frac{(x-\mu)^2-2\sigma^2tx}{2\sigma^2}\\ &=-\frac{(x-(\mu+\sigma^2t))^2}{2\sigma^2} +\mu t+\frac{\sigma^2t^2}{2}. \end{aligned} $$

Substituting this expression into the integral separates a factor independent of \(x\). The integral that remains is the density integral of a normal distribution with mean \(\mu+\sigma^2t\) and standard deviation \(\sigma\). A normal density integrates to one, so the factor is the entire MGF.

$$ \begin{aligned} M_X(t) &=\exp\left(\mu t+\frac{\sigma^2t^2}{2}\right) \int_{-\infty}^{\infty} \frac{1}{\sigma\sqrt{2\pi}} \exp\left(-\frac{(x-(\mu+\sigma^2t))^2}{2\sigma^2}\right)\,dx\\ &=\exp\left(\mu t+\frac{\sigma^2t^2}{2}\right). \end{aligned} $$
Theorem: If \(X\sim N(\mu,\sigma^2)\), where \(\sigma>0\), then \(M_X(t)=\exp\left(\mu t+\frac{\sigma^2t^2}{2}\right)\) for every real \(t\). Thus the MGF exists on the entire real line.

The domain statement follows from the calculation itself: after completing the square, the integral is finite and equals one for any real \(t\). This is stronger than merely having an MGF near zero. The formula also satisfies \(M_X(0)=1\), as every MGF must.

Recovering the Mean and Variance

For an MGF that exists near zero and has the required derivatives, \(M_X'(0)=E[X]\) and \(M_X''(0)=E[X^2]\). The variance is the second raw moment minus the square of the mean. Apply these facts to the normal MGF:

$$ \begin{aligned} M_X(t)&=\exp\left(\mu t+\frac{\sigma^2t^2}{2}\right),\\ M_X'(t)&=(\mu+\sigma^2t)\exp\left(\mu t+\frac{\sigma^2t^2}{2}\right),\\ M_X''(t)&=\left[\sigma^2+(\mu+\sigma^2t)^2\right] \exp\left(\mu t+\frac{\sigma^2t^2}{2}\right). \end{aligned} $$

Evaluating at zero gives \(M_X'(0)=\mu\) and \(M_X''(0)=\sigma^2+\mu^2\). Therefore,

$$ E[X]=\mu,\qquad E[X^2]=\mu^2+\sigma^2,\qquad \operatorname{Var}(X)=E[X^2]-(E[X])^2=\sigma^2. $$

This derivation also explains why the second derivative does not, in general, equal the variance. It gives the second raw moment. To obtain the variance, subtract the square of the first derivative at zero.

Worked Example: Moments of a Normal Measurement

A hypothetical laboratory records a measurement \(X\) in units with model \(X\sim N(8,4)\). Find the MGF, evaluate it at \(t=0.25\), and recover the mean, second raw moment, and variance from its derivatives.

Method. Substitute \(\mu=8\) and \(\sigma^2=4\) into the normal MGF. The second parameter is the variance, so the quadratic coefficient is \(4/2=2\).

$$ M_X(t)=\exp(8t+2t^2). $$

At \(t=0.25\), the exponent is \(8(0.25)+2(0.25)^2=2+0.125=2.125\). Hence \(M_X(0.25)=e^{2.125}\), approximately \(8.373\) to three decimal places.

Differentiate once: \(M_X'(t)=(8+4t)e^{8t+2t^2}\), so \(M_X'(0)=8\). Differentiate again: \(M_X''(t)=[4+(8+4t)^2]e^{8t+2t^2}\), so \(M_X''(0)=4+64=68\).

Thus \(E[X]=8\), \(E[X^2]=68\), and \(\operatorname{Var}(X)=68-8^2=68-64=4\). Check: these agree with the stated parameters \(N(8,4)\).

The Standard Normal Case

The standard normal variable has mean zero and variance one. Substituting \(\mu=0\) and \(\sigma^2=1\) into the general result gives its MGF directly. This is the standard normal case, not a separate formula requiring a new integration.

$$ Z\sim N(0,1) \quad\Longrightarrow\quad M_Z(t)=e^{t^2/2}. $$

For example, the MGF at \(t=2\) is \(M_Z(2)=e^{2}\). Differentiating gives \(M_Z'(t)=t e^{t^2/2}\) and \(M_Z''(t)=(1+t^2)e^{t^2/2}\). At zero, these derivatives give \(E[Z]=0\) and \(E[Z^2]=1\), so \(\operatorname{Var}(Z)=1-0^2=1\).

Worked Example: Checking a Standard Normal MGF

A hypothetical quality-control calculation models a standardized measurement \(Z\) as \(N(0,1)\). A proposed MGF is \(e^{t^2/2}\). Verify the formula, calculate \(M_Z(-1)\), and obtain the first two moments.

Method. Use the normal MGF with the stated parameters \(\mu=0\) and \(\sigma^2=1\). It gives \(M_Z(t)=\exp(0t+1t^2/2)=e^{t^2/2}\), so the proposed expression is correct.

At \(t=-1\), \(M_Z(-1)=e^{(-1)^2/2}=e^{1/2}\), approximately \(1.649\) to three decimal places. The sign of \(t\) disappears here because it is squared.

The derivatives are \(M_Z'(t)=t e^{t^2/2}\) and \(M_Z''(t)=(1+t^2)e^{t^2/2}\). Therefore \(M_Z'(0)=0\) and \(M_Z''(0)=1\). Hence \(E[Z]=0\), \(E[Z^2]=1\), and \(\operatorname{Var}(Z)=1-0^2=1\). Check: the moments match the specified standard normal parameters.

A Common Parameterization Trap

The notation \(N(\mu,\sigma^2)\) places the variance—not the standard deviation—in the second position. If the standard deviation is \(3\), then the variance is \(9\), and the coefficient of \(t^2\) in the exponent is \(9/2\), not \(3/2\). Confusing these quantities produces the wrong MGF and therefore the wrong moments.

Worked Example: Correcting a Variance-versus-Standard-Deviation Error

A hypothetical instrument has calibration offset \(X\sim N(-2,4)\), so its mean is \(-2\), its variance is \(4\), and its standard deviation is \(2\). An analyst proposes \(M_X(t)=e^{-2t+4t^2}\). Determine whether this is correct; give the correct MGF, evaluate it at \(t=1\), and recover the mean and variance.

Method. Compare the proposed exponent with \(\mu t+\sigma^2t^2/2\). Since \(\sigma^2=4\), the quadratic coefficient must be \(4/2=2\), not \(4\). The proposed MGF is incorrect.

$$ M_X(t)=e^{-2t+2t^2}. $$

At \(t=1\), the exponent is \(-2+2=0\), so \(M_X(1)=e^0=1\). The derivatives are \(M_X'(t)=(-2+4t)M_X(t)\) and \(M_X''(t)=[4+(-2+4t)^2]M_X(t)\). At zero, \(M_X'(0)=-2\) and \(M_X''(0)=4+4=8\).

It follows that \(E[X]=-2\) and \(E[X^2]=8\). Thus \(\operatorname{Var}(X)=8-(-2)^2=8-4=4\). Check: the recovered mean and variance equal the parameters in \(N(-2,4)\). The incorrect proposed MGF would instead give an incorrect variance.

How to Use the Formula Reliably

When a problem gives a normal model and asks about its MGF or moments, keep the parameter substitution explicit. A short sequence of checks is often enough to catch a sign or scale error before it affects later calculations.

  • Write \(X\sim N(\mu,\sigma^2)\) and identify the variance \(\sigma^2\), not just the standard deviation.
  • Substitute into \(M_X(t)=\exp(\mu t+\sigma^2t^2/2)\).
  • Check \(M_X(0)=1\), then differentiate if moments are required.
  • Use \(M_X''(0)=E[X^2]\), and subtract \((M_X'(0))^2\) to obtain the variance.

The normal MGF is especially useful because its exponent records the two parameters in a simple way: the term linear in \(t\) contains the mean, and the quadratic term contains half the variance. This makes the formula easy to apply, but it does not change the rule for interpreting the second derivative. The distinction between a raw moment and a central moment remains essential.

The result here is aligned with the SOA VEE Mathematical Statistics syllabus. Its central calculation is the completed square: it converts the MGF integral into a normal density integral and leaves exactly the factor needed to derive the formula.

Check Your Understanding

For each problem, state the normal parameters before using the MGF. Answers are provided for checking.

  1. A hypothetical device produces \(X\sim N(5,9)\). Write its MGF and find \(M_X(1/3)\). (Answer: \(M_X(t)=e^{5t+4.5t^2}\); \(M_X(1/3)=e^{2}\).)
  2. For \(Y\sim N(-1,1)\), find \(E[Y]\), \(E[Y^2]\), and \(\operatorname{Var}(Y)\) using the derivatives of the MGF. (Answer: \(-1,\ 2,\ 1\).)
  3. A standardized variable \(Z\sim N(0,1)\) has MGF \(e^{t^2/2}\). Find \(M_Z(-2)\), \(M_Z'(0)\), and \(M_Z''(0)\). (Answer: \(e^2,\ 0,\ 1\).)
  4. A model is \(W\sim N(3,16)\), and a proposed MGF is \(e^{3t+16t^2}\). Correct the formula and use its derivatives to find the mean and variance. (Answer: \(M_W(t)=e^{3t+8t^2}\); mean \(3\), variance \(16\).)
  5. For \(V\sim N(2,4)\), calculate \(M_V(-1/2)\), then use derivatives to find \(E[V^2]\) and verify the variance. (Answer: \(M_V(-1/2)=e^0=1\); \(E[V^2]=8\); \(\operatorname{Var}(V)=8-2^2=4\).)
Clinical Biostats