CS1 · explained

Moment generating functions, and how to get moments out of them

A moment generating function packs every moment of a distribution into one function, so you can differentiate instead of integrating. This page explains what it is, why differentiating works, and the two properties that make it the workhorse of the first half of CS1.

CS1 · Actuarial Statistics · 10 min read

After this page you can

Write down a moment generating function, differentiate it to get the first three moments, and check them against the cumulant route

The problem it solves

Suppose you want the mean of a distribution. That is one integral. Now you want the variance: another integral. The skewness: a third. Each is a separate piece of work, and each is a separate chance to make a mistake.

A moment generating function removes the repetition. It is a single function, built once from the distribution, that contains every moment at the same time. Once you have it, getting the mean, the variance and the skewness is differentiation rather than integration — and differentiation is the easier of the two to do under exam conditions.

That is the first reason it is in the course. The second is larger, and it is the reason the function survives past the moment-finding stage: it turns adding independent random variables into multiplying functions. Almost everything an actuary models is a sum, so a tool that makes sums easy earns its place.

The definition

For a random variable X, the moment generating function is

MX(t) = E[etX]

In words: take the random variable, put it in an exponential with a dummy variable t attached, and average over the distribution. The result is a function of t, not of X. X has gone; what is left describes it.

The variable t has no meaning of its own. It is bookkeeping — a place to hang the moments so they can be pulled off one at a time. Note immediately that MX(0) = E[e0] = 1 for every distribution. That is the cheapest check there is: an MGF you have derived which does not equal 1 at t = 0 is wrong.

A warm-up with round numbers

Let X be 1 if a policy makes a claim and 0 if it does not, with probability one half each way. Then the average of etX is just the two values weighted equally:

M(t) = ½ e0 + ½ et = ½ (1 + et)

Check t = 0: ½(1 + 1) = 1. Good. Now differentiate: M′(t) = ½ et, so M′(0) = ½, which is the mean. Differentiate again: M″(t) = ½ et, so M″(0) = ½, which is E[X²]. The variance is then ½ − (½)² = ¼, which is p(1 − p) at p = ½, as it must be. Three facts about the distribution out of one function, by differentiating.

Why differentiating gives you the moments

This is worth seeing once, because afterwards the rule stops being arbitrary. Expand the exponential as its power series and take the expectation term by term:

M(t) = E[1 + tX + t²X²/2! + t³X³/3! + …]
= 1 + t E[X] + t² E[X²]/2! + t³ E[X³]/3! + …

So the moments are sitting in the series as coefficients. The k-th moment is the coefficient of tk multiplied by k!, and the way to extract the coefficient of tk from a power series is to differentiate k times and set t = 0:

E[Xk] = M(k)(0)

Nothing is being asserted. The MGF is the moments, written as a series; the differentiation is only unpacking.

The cumulant generating function, which is usually better

Take the natural logarithm of the MGF:

KX(t) = ln MX(t)

Differentiate this one instead and you get cumulants rather than moments, and the first three cumulants are exactly the three quantities you actually want:

K′(0) = E[X]
K″(0) = Var(X)
K′″(0) = E[(X − μ)³]

In words: the second derivative of the log gives you the variance directly, with no E[X²] − μ² subtraction to get wrong, and the third gives the third central moment, which is the numerator of the skewness.

That is not a coincidence and it is not a trick. Differentiating a logarithm introduces a division by M(t), and at t = 0 that division by 1 leaves behind precisely the correction terms that turn a raw moment into a central one. The subtraction still happens; the logarithm just does it for you.

The practical consequence: when a question asks for a variance or a skewness, go to K(t). When it asks for E[X²] itself, go to M(t). Doing a variance through M(t) is not wrong, but it is two more lines and one more place to drop a term.

The two properties that do the real work

Sums of independent variables

If X and Y are independent, then E[et(X+Y)] = E[etX] E[etY], because the expectation of a product of independent quantities is the product of the expectations. So

MX+Y(t) = MX(t) × MY(t)    and    KX+Y(t) = KX(t) + KY(t)

Cumulants simply add. That one line is why the cumulant form is the actuary's version: for a sum of n independent identical risks, every cumulant is n times the single-risk cumulant, so the mean, the variance and the third central moment of the total are all immediately available.

Uniqueness

Two distributions with the same moment generating function, on an interval of t around zero, are the same distribution. This turns the function into a tool for identifying things, and that is how most of the distributional results in the syllabus are actually proved. Multiply the MGFs of two independent Poisson variables with means 3 and 5 and the product is the MGF of a Poisson with mean 8, so the sum is Poisson with mean 8 — no convolution integral, no summation over partitions. The same argument shows that a sum of independent normals is normal and a sum of independent gammas with a common rate is gamma.

It is also, in outline, how the central limit theorem is proved: the cumulant generating function of a standardised sample mean is expanded, every term beyond the second is shown to vanish as n grows, and what is left is the cumulant generating function of the standard normal. Uniqueness then finishes the argument.

Where it is used after this topic

Aggregate claims. Total claims on a portfolio is a sum of a random number of random amounts, and the generating function handles the two layers of randomness in one step.

The exponential family. Writing a density in exponential-family form puts its cumulant generating function on display, which is exactly what the variance function of a generalised linear model is built from.

Approximations. Cumulants beyond the second measure how far a distribution is from normal, which is what tells you whether a normal approximation is safe.

Questions students ask

Why not just integrate for each moment?

For one moment of one distribution, integrating is fine. The case for the generating function is everything after that: a third moment by direct integration is genuinely unpleasant, sums of independent variables become products instead of convolutions, and the uniqueness property has no counterpart in the integrate-each-time approach. The function is not a shortcut for one calculation, it is the right structure for a dozen.

What is the difference between this and a probability generating function?

A probability generating function is E[sX] and is for counting variables that take values 0, 1, 2 and so on. Its derivatives at s = 0 recover the probabilities — the k-th one is k! pk, so divide by k! — and its derivatives at s = 1 give factorial moments. Set s = et and you have the moment generating function. They are the same object in different coordinates, and the choice is about which values you want to fall out cleanly: probabilities, or moments.

Does every distribution have one?

No, and the exceptions matter in insurance. Any distribution with a tail heavier than exponential — lognormal, Pareto — has E[etX] = ∞ for every t > 0. These are precisely the distributions used for large claims, which is why the characteristic function, E[eitX], exists in the theory: the complex exponential has modulus one, so that integral always converges.

A worked example

A claim amount, in lakhs of rupees, is modelled as a gamma distribution with shape α = 3 and rate λ = 0.5. Both parameters were invented for this example; they are not taken from any portfolio. Find the mean, the variance and the skewness two independent ways, then do the same for the total of four independent claims.

  1. The moment generating function

    The gamma density is proportional to xα−1 e−λx. Multiplying by etx changes the exponent to −(λ − t)x, which is another gamma shape — the same integral with λ replaced by (λ − t). Matching the normalising constants gives

    M(t) = (λ / (λ − t))α = (0.5 / (0.5 − t))3,   valid for t < 0.5

    At t = 0 this is (0.5/0.5)3 = 1. The check passes, so the function is at least the right shape.

  2. Route one: differentiate M(t)

    Write it as M(t) = 0.125 (0.5 − t)−3, since 0.5³ = 0.125. Each differentiation raises the power and multiplies by it:

    M′(t) = 0.375 (0.5 − t)−4 → M′(0) = 0.375 × 16 = 6
    M″(t) = 1.5 (0.5 − t)−5 → M″(0) = 1.5 × 32 = 48
    M′″(t) = 7.5 (0.5 − t)−6 → M′″(0) = 7.5 × 64 = 480

    So E[X] = 6, E[X²] = 48 and E[X³] = 480. Converting to the quantities actually wanted:

    Var(X) = 48 − 6² = 12
    E[(X − μ)³] = 480 − 3(6)(48) + 2(6)³ = 480 − 864 + 432 = 48
  3. Route two: differentiate the cumulant generating function

    K(t) = ln M(t) = 3[ln 0.5 − ln(0.5 − t)]

    which differentiates far more pleasantly, because the logarithm has flattened the power:

    K′(t) = 3/(0.5 − t) → K′(0) = 3/0.5 = 6
    K″(t) = 3/(0.5 − t)² → K″(0) = 3/0.25 = 12
    K′″(t) = 6/(0.5 − t)³ → K′″(0) = 6/0.125 = 48

    Mean 6, variance 12, third central moment 48 — the same three numbers, reached without a single subtraction. Note also that these are the standard gamma results α/λ, α/λ² and 2α/λ³, which is a third confirmation.

  4. The skewness, also two ways

    Skewness is the third central moment divided by the cube of the standard deviation. The standard deviation is √12 = 3.4641016, so

    121.5 = 41.5692194
    skewness = 48 / 41.5692194 = 1.1547005

    For a gamma the skewness is known to be 2/√α, and 2/√3 = 1.1547005. The two agree to seven decimal places. The distribution is clearly right-skewed, which is what a claim amount should be.

  5. The total of four independent claims

    Cumulants add, so every cumulant of the total is four times the single-claim cumulant:

    QuantityOne claimTotal of four
    Mean624
    Variance1248
    Standard deviation3.46410166.9282032
    Third central moment48192
    Skewness1.15470050.5773503

    Check the total a second way, through uniqueness. The MGF of the total is [(0.5/(0.5−t))3]4 = (0.5/(0.5−t))12, which is the MGF of a gamma with α = 12 and the same λ = 0.5. Its mean is 12/0.5 = 24, its variance 12/0.25 = 48, and its skewness 2/√12 = 0.5773503. Every entry in the right-hand column is confirmed.

    Notice the last row. Adding four claims has divided the skewness by two, not by four — it falls as 1/√n. That is the central limit theorem appearing in the arithmetic, before anyone has mentioned it.

Where this fits in CS1

This page explains one idea from CS1 Actuarial Statistics. The full CS1 syllabus, with what each part is examined on, sits on the course page, and past-paper style mock exams with full solutions are where you find out whether the idea has stuck under time pressure.

Other CS1 topics explained

Stuck on a term rather than the idea? The actuarial glossary defines the notation used above. If something here is wrong or unclear, tell us — these pages get corrected.