How to Find a Moment-Generating Function from a PMF
At a glance
- 1. List the support
Write down every value the random variable can take and its probability from the PMF.
- 2. Multiply by the exponential
For each support value x, multiply its probability by e raised to tx.
- 3. Sum the terms
Add the products; for infinite support, check that the resulting series converges.
- 4. Check near zero
An MGF is useful when the sum is finite for t in an open interval containing zero.
- 5. Differentiate if needed
The first and second derivatives at zero give the mean and second moment.
A probability mass function gives the probabilities of the possible values of a discrete random variable. To find its moment-generating function (MGF), weight each probability by an exponential term and add the results. This works directly for both finite and countably infinite support, although an infinite sum requires a convergence check.
The formula for a discrete random variable
If X takes values in a set S and has PMF p(x) = P(X = x), then
Here t is a real number for which the expectation exists. For finite support, the formula is a finite sum and is defined for every real t. For infinite support, the series may converge only for some t. The standard MGF is considered to exist when it is finite on an open interval containing t = 0.
The key point is that you do not multiply the probability by x^t. The quantity inside the expectation is e^(tX), so a possible value x contributes p(x)e^(tx).
A step-by-step method
- List the possible values x of X and their probabilities p(x).
- Write one term p(x)e^(tx) for each value.
- Add the terms, using a series if there are infinitely many possible values.
- For an infinite series, determine the t values for which it converges. Check that its domain includes an open interval around zero before treating it as an MGF in the usual sense.
A quick check is to set t = 0. If the PMF is valid, then M_X(0) = ∑ₓ p(x) = 1.
Worked example: a three-value random variable
Suppose X has this distribution:
| x | 0 | 1 | 2 |
|---|---|---|---|
| P(X = x) | 1/4 | 1/2 | 1/4 |
Apply the formula to each possible value:
Because X has finite support, this expression is defined for every real t. At t = 0, it gives M_X(0) = 1, as expected.
The derivatives also recover moments. Differentiating gives M′_X(0) = E[X] = 1 and M″_X(0) = E[X²] = 3/2. Therefore,
This is a useful check: the PMF gives E[X] = 0(1/4) + 1(1/2) + 2(1/4) = 1, in agreement with the derivative.
Worked example: geometric PMF and convergence
Let X count the number of independent trials up to and including the first success, where each trial succeeds with probability p, with 0 < p ≤ 1. Its PMF is P(X = k) = p(1 − p)^(k−1) for k = 1, 2, 3, …. Then
provided the geometric series converges. Its ratio is (1 − p)e^t, so convergence requires (1 − p)e^t < 1. When 0 < p < 1, this is equivalent to t < −ln(1 − p), an interval that contains zero. When p = 1, X is always 1 and M_X(t) = e^t for every real t.
The convergence condition is part of the answer: the displayed fraction is not the MGF at t values where the defining expectation diverges.
Using the MGF to find moments
When the MGF exists on an open interval around zero, its derivatives at zero give the raw moments:
More generally, M_X^(n)(0) = E[X^n], when the relevant derivative exists. The variance follows from Var(X) = E[X²] − (E[X])². These rules are convenient after you have formed the MGF; they do not replace checking that the defining expectation exists.
Common mistakes
- Using the wrong exponential: Each PMF term is multiplied by e^(tx), not by e^t alone or x^t.
- Leaving out support values: Include every value with positive probability. A missing term changes the function and often makes M_X(0) different from 1.
- Forgetting probabilities: The sum is weighted by p(x); it is not just a sum of exponentials.
- Ignoring convergence: For infinite support, simplify the series only where it converges. A formal expression outside that domain does not make the expectation finite.
- Confusing moments and cumulants: Derivatives of the MGF at zero give raw moments. For example, the second derivative gives E[X²], not the variance directly.
If the MGF exists near zero, it also determines the distribution uniquely. When an MGF does not exist, expectations or other transforms may still be useful, but the usual MGF derivative method may not be available.
References
- A First Course in Probability, Sheldon Ross
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.