Mathwords logoMathwords

Moment Generating Function — Definition, Formula & Examples

A moment generating function (MGF) is a function that encodes all the moments (mean, variance, and higher) of a random variable into a single expression. You obtain the nnth moment by taking the nnth derivative of the MGF and evaluating it at zero.

For a random variable XX, the moment generating function is defined as MX(t)=E[etX]M_X(t) = E[e^{tX}], provided this expectation exists for tt in some open interval containing zero. When it exists, MX(t)M_X(t) uniquely determines the probability distribution of XX, and the nnth moment is given by E[Xn]=MX(n)(0)E[X^n] = M_X^{(n)}(0).

Key Formula

MX(t)=E[etX]M_X(t) = E[e^{tX}]
Where:
  • MX(t)M_X(t) = Moment generating function of random variable X, as a function of t
  • EE = Expected value operator
  • tt = Real-valued parameter near zero
  • XX = Random variable

How It Works

To use an MGF, first compute E[etX]E[e^{tX}] using the distribution's PMF or PDF. Once you have a closed-form expression for MX(t)M_X(t), differentiate it nn times with respect to tt and set t=0t = 0 to extract the nnth moment. The first derivative at zero gives the mean E[X]E[X], and combining the first two derivatives gives the variance via Var(X)=MX(0)[MX(0)]2\text{Var}(X) = M_X''(0) - [M_X'(0)]^2. MGFs are also powerful for proving that sums of independent random variables follow known distributions, since MX+Y(t)=MX(t)MY(t)M_{X+Y}(t) = M_X(t) \cdot M_Y(t) when XX and YY are independent.

Worked Example

Problem: Find the MGF of an exponential random variable with rate λ = 3, then use it to find the mean.
Step 1: Write the MGF using the PDF f(x)=3e3xf(x) = 3e^{-3x} for x0x \geq 0.
MX(t)=0etx3e3xdx=30e(3t)xdxM_X(t) = \int_0^\infty e^{tx} \cdot 3e^{-3x}\,dx = 3\int_0^\infty e^{-(3-t)x}\,dx
Step 2: Evaluate the integral (valid for t<3t < 3).
MX(t)=33tM_X(t) = \frac{3}{3 - t}
Step 3: Differentiate and evaluate at t=0t = 0 to find the mean.
MX(t)=3(3t)2    MX(0)=39=13M_X'(t) = \frac{3}{(3-t)^2} \implies M_X'(0) = \frac{3}{9} = \frac{1}{3}
Answer: The MGF is MX(t)=33tM_X(t) = \frac{3}{3 - t} for t<3t < 3, and the mean is E[X]=13E[X] = \frac{1}{3}.

Why It Matters

MGFs appear throughout mathematical statistics whenever you need to derive the distribution of a sum of independent random variables or prove convergence results like the Central Limit Theorem. In actuarial science and reliability engineering, MGFs provide a compact way to characterize risk distributions and compute tail probabilities.

Common Mistakes

Mistake: Forgetting that the MGF does not exist for all distributions (e.g., the Cauchy distribution has no MGF).
Correction: Always verify that E[etX]E[e^{tX}] is finite in an open interval around t=0t = 0 before using the MGF. If it does not exist, use the characteristic function instead.