myLearning

Topic 5 of 7

Step 22: Probability theory

Moment generating functions

Step 22 · Probability theory topics

Pack a distribution into its moment generating function, read off the mean and variance by differentiating, and use these functions to find distributions of sums.

Defining the moment generating function

The moment generating function, or MGF, of X is M(t)=E(etX)M(t) = E(e^{tX}). It packs every moment E(Xⁿ) into one function, and two distributions with the same MGF are the same distribution.

Example: A coin

X is 1 with probability p and 0 otherwise. Find its MGF.

  1. E(etX)=(1−p)e0+petE(e^{tX}) = (1 - p)e^{0} + pe^{t}.

AnswerM(t)=1−p+petM(t) = 1 - p + pe^{t}

Example: An exponential

X has density λe−λx\lambda e^{-\lambda x} for x ≥ 0. Find its MGF.

  1. ∫0∞etxλe−λx dx=λλ−t\int_{0}^{\infty} e^{tx}\lambda e^{-\lambda x}\,dx = \frac{\lambda}{\lambda - t}, for t < λ.

AnswerM(t)=λλ−tM(t) = \frac{\lambda}{\lambda - t}

DistributionMGF
Binomial(n, p)(1−p+pet)n(1 - p + pe^{t})^{n}
Poisson(λ)eλ(et−1)e^{\lambda(e^{t} - 1)}
Exponential(λ)λλ−t\frac{\lambda}{\lambda - t}
Normal(μ, σ²)eμt+σ2t2/2e^{\mu t + \sigma^{2}t^{2}/2}

Moments from the MGF

The nth derivative of M at t = 0 is the nth moment, E(Xⁿ). So the mean is M′(0), and the variance is M″(0) − M′(0)².

E(Xn)=M(n)(0)E(X^{n}) = M^{(n)}(0)

Example: Exponential moments

Use M(t)=λλ−tM(t) = \frac{\lambda}{\lambda - t} to find E(X) and Var(X).

  1. M′(t)=λ(λ−t)2M'(t) = \frac{\lambda}{(\lambda - t)^{2}}, so E(X) = 1/λ.
  2. M′′(t)=2λ(λ−t)3M''(t) = \frac{2\lambda}{(\lambda - t)^{3}}, so E(X²) = 2/λ².
  3. Var(X) = 2/λ² − 1/λ².

AnswerMean 1λ\frac{1}{\lambda}, variance 1λ2\frac{1}{\lambda^{2}}

Example: A Poisson mean

Use M(t)=eλ(et−1)M(t) = e^{\lambda(e^{t} - 1)} to find the mean.

  1. M′(t)=λetM(t)M'(t) = \lambda e^{t}M(t), and M(0) = 1.

Answerλ

Sums of independent variables

If X and Y are independent, the MGF of X + Y is the product of their MGFs. Multiplying MGFs is far easier than working out the distribution of a sum directly.

MX+Y(t)=MX(t) MY(t)M_{X+Y}(t) = M_X(t)\,M_Y(t)

Example: Binomial from coins

Add n independent coin flips, each 1 with probability p.

  1. Each has MGF 1−p+pet1 - p + pe^{t}.
  2. The sum has MGF (1−p+pet)n(1 - p + pe^{t})^{n}: binomial(n, p).

AnswerA binomial(n, p) count

Example: Poisson sums

X is Poisson(2) and Y is Poisson(3), and they are independent. What is the distribution of X + Y?

  1. e2(et−1)⋅e3(et−1)=e5(et−1)e^{2(e^{t} - 1)} \cdot e^{3(e^{t} - 1)} = e^{5(e^{t} - 1)}.

AnswerPoisson(5)

Try it yourself

Work each one on paper first, then open the answer to check.

  1. What is M(0) for any random variable?

    Show answer

    1

  2. What distribution has MGF (0.5+0.5et)10(0.5 + 0.5e^{t})^{10}?

    Show answer

    Binomial with n = 10 and p = 0.5

  3. What are the mean and variance of a variable with MGF e2t+8t2e^{2t + 8t^{2}}?

    Show answer

    Mean 2, variance 16

  4. M′(0) = 3 and M″(0) = 13. What is Var(X)?

    Show answer

    4

  5. X and Y are independent with MGFs M₁ and M₂. What is the MGF of X + Y?

    Show answer

    M₁(t) M₂(t)

  6. X is Poisson(1) and Y is Poisson(4), and they are independent. What is X + Y?

    Show answer

    Poisson(5)

What next?