Statistics & Probability · Undergraduate

Moment Generating Functions

Quick answer

The moment generating function of X is M(t) = E[e^(tX)]. Its derivatives at t = 0 give the moments: M′(0) = E[X], M″(0) = E[X²], and so on, so the variance is M″(0) − M′(0)². Each common distribution has a recognizable MGF, such as e^(μt + σ²t²/2) for the normal. For independent X and Y, the MGF of X + Y is the product M_X(t)M_Y(t), which shows at once that sums of independent normals are normal.

What you'll learn

  • Define the moment generating function
  • Find the mean and variance from M′(0) and M″(0)
  • Recognize the MGFs of common distributions
  • Use products of MGFs for sums of independent variables

Expected value of an exponential

The moment generating function of a random variable XX is

M(t)=E ⁣[etX]M(t) = E\!\left[e^{tX}\right]

Its derivatives at 00 are the moments: M′(0)=E[X]M'(0) = E[X], M′′(0)=E[X2]M''(0) = E[X^2], and so on. So Var⁡(X)=M′′(0)−M′(0)2\operatorname{Var}(X) = M''(0) - M'(0)^2.

DistributionM(t)M(t)
Bernoulli(pp)1−p+pet1 - p + pe^t
binomial(nn, pp)(1−p+pet)n(1 - p + pe^t)^n
Poisson(λ\lambda)eλ(et−1)e^{\lambda(e^t - 1)}
exponential, rate λ\lambdaλλ−t\tfrac{\lambda}{\lambda - t} for t<λt < \lambda
normal(μ\mu, σ2\sigma^2)eμt+σ2t2/2e^{\mu t + \sigma^2t^2/2}

Why the derivatives give moments

Expand etXe^{tX} as a Maclaurin series: 1+tX+t2X22!+⋯1 + tX + \tfrac{t^2X^2}{2!} + \cdots. Taking expected values term by term, M(t)=1+tE[X]+t22!E[X2]+⋯M(t) = 1 + tE[X] + \tfrac{t^2}{2!}E[X^2] + \cdots. The coefficient of tnn!\tfrac{t^n}{n!} is E[Xn]E[X^n], and that coefficient is what the nnth derivative at 00 picks out. For sums, independence gives E[et(X+Y)]=E[etX]E[etY]E[e^{t(X+Y)}] = E[e^{tX}]E[e^{tY}], so MGFs multiply.

Worked examples

Common mistakes

Practice problems

  1. XX has MGF (0.7+0.3et)10(0.7 + 0.3e^t)^{10}. Find E[X]E[X].

    Answer

    33

    Full solution

    M′(0)=10⋅0.3M'(0) = 10 \cdot 0.3.

  2. For the same XX, find Var⁡(X)\operatorname{Var}(X).

    Answer

    2.12.1

    Full solution

    M′′(0)−M′(0)2=11.1−9M''(0) - M'(0)^2 = 11.1 - 9.

  3. XX has MGF 11−2t\tfrac{1}{1 - 2t}. Find E[X2]E[X^2].

    Answer

    88

    Full solution

    M′′(0)=813M''(0) = \tfrac{8}{1^3}.

  4. XX has MGF e5t+2t2e^{5t + 2t^2}. Find Var⁡(X)\operatorname{Var}(X).

    Answer

    44

    Full solution

    σ22=2\tfrac{\sigma^2}{2} = 2, so σ2=4\sigma^2 = 4.

  5. XX has MGF e6(et−1)e^{6(e^t - 1)}. Find E[X]E[X].

    Answer

    66

    Full solution

    It is Poisson with λ=6\lambda = 6; M′(0)=6e0⋅e0M'(0) = 6e^0 \cdot e^0.

  6. Find M(0)M(0) for any random variable XX.

    Answer

    11

    Full solution

    M(0)=E[e0]=E[1]M(0) = E[e^0] = E[1].

  7. XX and YY are independent with MGFs et+t2e^{t + t^2} and e6t+t2e^{6t + t^2}. Find E[X+Y]E[X + Y].

    Answer

    77

    Full solution

    The product is e7t+2t2e^{7t + 2t^2}, a normal MGF with mean 77.

  8. A student takes E[X]=M(1)E[X] = M(1) for M(t)=11−2tM(t) = \tfrac{1}{1 - 2t}. Find E[X]E[X].

    Answer

    22

    Full solution

    E[X]=M′(0)=2(1−0)2E[X] = M'(0) = \tfrac{2}{(1 - 0)^2}.

Frequently asked questions

What is a moment generating function?

M(t) = E[e^(tX)], the expected value of e^(tX) as a function of t.

How do I get the mean from the MGF?

Differentiate and set t = 0: E[X] = M′(0). In general E[Xⁿ] = M⁽ⁿ⁾(0).

What is the MGF of a normal variable?

e^(μt + σ²t²/2) for mean μ and variance σ².

What is the MGF of a sum?

If X and Y are independent, M_(X+Y)(t) = M_X(t) · M_Y(t).