Moment-Generating Functions

The moment-generating function (MGF) of a random variable X is the expectation

M_X(t) = \mathbb{E}\!\left[e^{tX}\right],

defined for those t where this expectation is finite (we only ever need it in an interval around t = 0). Building on expectation, it packages the entire distribution into a single function of a dummy variable t — and, as the name promises, it generates the moments.

How it generates moments

Expand e^{tX} = 1 + tX + \tfrac{t^2}{2!}X^2 + \cdots and take expectations term by term. Differentiating M_X(t) with respect to t and then setting t = 0 peels off one moment at a time:

M_X(0) = 1, \qquad M_X'(0) = \mathbb{E}[X], \qquad M_X''(0) = \mathbb{E}[X^2], \text{and in general}\qquad M_X^{(n)}(0) = \mathbb{E}[X^n].

So every moment is the value of a derivative at the origin. Two more properties make the MGF indispensable:

The normal MGF

For X \sim N(\mu, \sigma^2) the integral works out to a clean exponential of a quadratic in t:

M_X(t) = \exp\!\left(\mu t + \tfrac12\sigma^2 t^2\right).

Differentiate and set t = 0 to check: M'(0) = \mu and M''(0) = \mu^2 + \sigma^2 = \mathbb{E}[X^2], so the variance \mathbb{E}[X^2] - \mu^2 = \sigma^2 drops out as it should. Slide \mu and \sigma and watch the curve climb: the larger they are, the faster M(t) blows up away from t = 0 — yet it always passes through M(0) = 1.