Moment Generating Functions
Suppose two random variables share every moment: identical mean, identical variance, identical third moment, and so on forever. Must they have the same distribution? This innocent question sits at the heart of why moment generating functions matter. The answer is subtler than it looks. Moments alone do not always pin down a distribution. But a single well-behaved function built from all the moments at once — the moment generating function, or MGF — often does. The idea is simple to state. Package the sequence of moments into one analytic function . Extract moments back out by differentiating at . What makes this more than bookkeeping is one key fact. When the MGF exists on an open interval around zero, it uniquely determines the distribution. This turns certain hard questions into algebra. "Does this messy random variable have a normal distribution?" becomes an algebra problem. So does "what is the distribution of a sum of independent random variables?" Just match generating functions, done. The big picture is that MGFs are a bridge. They connect the probabilistic world of distributions to the analytic world of power series and Laplace transforms. Sums of independent random variables are famously hard to handle via convolution of densities. Using MGFs, they become simple products instead. Limits of distributions, as in the Central Limit Theorem, become limits of these transforms. Lévy formalized this idea into continuity theorems. These theorems were used throughout the following century. This article gives the precise definition of the MGF. It proves the moment-extraction formula and the uniqueness theorem. It also works through the MGFs of the Poisson and normal families in full rigor. It shows, with a genuine counterexample, why one condition matters. The phrase "MGF exists near 0" cannot be dropped from the uniqueness theorem. This is a warning that matters enormously in practice.
- The MGF of is , defined for in some interval containing .
- If is finite on an open interval around , its derivatives at recover the moments: .
- MGFs turn sums of independent random variables into products: .
- Uniqueness theorem: if two MGFs agree on an open interval around , the distributions are identical.
- Existence is not automatic — heavy-tailed distributions (e.g. Cauchy, lognormal) can have infinite MGF for every .
- Key idea: the MGF packages an infinite sequence of moments into one function, and that function's local behavior at determines the whole distribution.
Where this lives today
MGFs (and their cousin, the characteristic function, which always exists) underlie the classical proofs of the Central Limit Theorem, where one shows the MGF (or characteristic function) of a standardized sum converges to that of a standard normal, then invokes a continuity theorem to conclude convergence in distribution. In statistics, MGFs identify the distributions of test statistics: the sum of squared independent normals is shown to be -distributed by multiplying MGFs, underlying the derivation of the and distributions used in hypothesis testing. In actuarial science and queueing theory, MGFs of claim sizes or interarrival times combine via products to analyze aggregate loss distributions and busy-period lengths. In large-deviations theory and information theory, the log-MGF (the cumulant generating function) controls exponential tail bounds through the Chernoff bound, a technique central to concentration inequalities used throughout modern statistics and computer science, particularly in analyzing randomized algorithms. In physics, the MGF is essentially the partition function of statistical mechanics evaluated along an imaginary or real "inverse temperature" axis, linking probability theory directly to thermodynamics. Cryptographic and coding-theoretic analyses of random constructions frequently invoke MGF-based tail bounds (Chernoff–Hoeffding style) to guarantee that randomized protocols succeed with overwhelming probability.
:::quiz[If for all real , what is ?]
- 4
- 6 ✓
- 10
- 0.6
:::quiz[For , differentiating twice and evaluating at gives equal to]
- ✓
:::faq[Does the moment-extraction formula require the MGF to exist on the whole real line?] No — only on some open interval around , however small is. The proof of the moments theorem only uses local behavior near : the dominated convergence argument for differentiating under the expectation only needs finite in a small neighborhood of the point at which we differentiate. This is a genuinely local statement, which is part of why it is a strictly weaker requirement than the global existence enjoyed by the Poisson and normal MGFs in the worked examples.
Ask the tutor: How does the MGF-based proof of the Central Limit Theorem actually use the uniqueness and continuity of moment generating (or characteristic) functions?
Let be a random variable on a probability space . The moment generating function of is the function
wherever this expectation is finite. We say the MGF exists if there is some such that for all . Concretely:
- If is discrete with probability mass function , then .
- If is continuous with density , then .
Note always, regardless of the distribution; the substantive content is the behavior of for .
Intuition
Think of as a "loaded" version of 's distribution: multiplying the density or mass function by and summing/integrating exponentially tilts the distribution toward large values (for ) or small values (for ). Because can be expanded as a power series, automatically bundles together all the moments of simultaneously — the coefficient of in the Taylor expansion of is exactly . This is why differentiating at is such a clean way to generate moments: the exponential does the work of tracking every power of at once. The second key intuition is algebraic: expectation of a product of independent exponentials factors, because independence means expectations factor. This single fact — for independent — converts the analytically painful operation of convolution (adding independent random variables) into simple multiplication of two functions. This is the same trick that Laplace transforms perform for differential equations, and indeed the MGF is a two-sided Laplace transform of the distribution, evaluated at .
The central theorem
Let be a random variable whose MGF is finite for all in some open interval with . Then: 1. has finite moments of every order: for all . 2. is infinitely differentiable on , differentiation may be passed inside the expectation, and
3. On , has the convergent power series expansion
Technique: dominated convergence to justify differentiating under the expectation, plus a comparison bound to get finite moments. Step 1: finite moments of all orders. Fix . Since and , we have
For any , elementary calculus gives, for all real ,
(This holds because when , using the fact that all terms of the exponential series are nonnegative there, giving when ; the symmetric argument with handles ; adding the two bounds covers both cases with one inequality valid for all .) Taking expectations,
So every moment of is finite. Step 2: differentiating under the expectation sign. We show for in a slightly smaller interval with . Fix such and let so that . For with , consider the difference quotient
By the mean value theorem applied to the exponential function, for each fixed there is between and with
Since , we bound crudely (as regardless of sign of and ). Hence the difference quotient is dominated in absolute value by
uniformly in with . Since , Step 1's argument (applied with exponent combined with playing the role of the tilting factor) shows : indeed (bounded constant), and more directly, follows because has finite exponential moments whenever does, by the same Step-1-type inequality applied to the shifted variable. Since is an integrable dominating function not depending on , dominated convergence gives
using that pointwise as (definition of the derivative of at ). This proves for ; since was arbitrary, this holds on all of . By induction, the same dominated-convergence argument (using in place of , which has finite exponential moments by Step 1) gives
Setting and using :
Step 3: the power series. Since is infinitely differentiable at with all derivatives given by moments, Taylor's theorem with remainder gives, for in a neighborhood of ,
To show (so the series converges to , not just formally matches derivatives), fix and with . Using the integral (or Lagrange) form of the Taylor remainder together with the bound , one shows, exactly as in Step 1's inequality (applied with exponent strictly between and ), that
for a constant depending only on , because . Hence the Taylor series converges to on ; as was arbitrary, it converges on all of .
∎If and are independent random variables whose MGFs both exist on a common interval , then has an MGF on given by
More generally, if are independent with MGFs existing on a common interval, then
Technique: independence turns expectation of a product into a product of expectations. For ,
Because and are independent, so are the transformed random variables and (a measurable function of is independent of a measurable function of whenever ). For independent random variables with or, more generally, whenever and is integrable, independence gives ; here are both integrable by hypothesis ( lies in the domain of both MGFs), and follows from Hölder's inequality since for in a slightly smaller subinterval — or directly from the standard factorization property of expectation under independence for nonnegative random variables (both here, so Tonelli's theorem applies without integrability worries). Hence
The -variable case follows by induction on , applying the two-variable result to (independent of ) and .
∎Let and be random variables such that and are both finite and equal for all in some open interval , . Then and have the same cumulative distribution function:
Technique: this is a genuinely deep analytic fact — we outline the standard proof via analytic continuation of the two-sided Laplace transform into the complex plane, reducing to injectivity of the Fourier transform (characteristic function), which is proved by Fourier inversion. Full measure-theoretic Fourier inversion is beyond this article's scope; we prove the reduction rigorously and cite Fourier inversion as the terminating step. Step 1: extend to a complex strip. Because for , the same Step-1 bound from the Moments Theorem shows for all , and in fact the bound is uniform enough that for complex with , the series
converges absolutely (since for , using the real MGF's finiteness and the triangle inequality ). This defines an analytic function on the strip (justification: a power series is analytic on its disk of convergence, and here the relevant variable is itself since , viewed as a function of complex , has a power series representation valid on by the dominated convergence argument extending Step 2 of the Moments Theorem to complex increments). In particular, restricting to the imaginary axis gives
the characteristic function of , for all real (the series for converges for every purely imaginary since was shown analytic on the whole strip , which includes the imaginary axis where ). Step 2: equality of MGFs on forces equality of the analytic extensions on the whole strip. and are both analytic on the strip , and they agree on the real segment (since there by hypothesis). Two analytic functions on a connected open set that agree on a set with an accumulation point are identical there — this is the identity theorem for analytic functions. The real segment has accumulation points (indeed every point is one), so on the entire strip. Step 3: equal characteristic functions imply equal distributions. By Step 2, in particular for all real , i.e. for every . The Fourier inversion / uniqueness theorem for characteristic functions states: if two random variables have identical characteristic functions on all of , they have identical distribution functions. (This is proved via Fourier inversion formulas expressing in terms of by an explicit integral, or via the Stone–Weierstrass / Lévy continuity apparatus; it does not depend on the MGF theory developed here, so invoking it is not circular.) Combining Steps 1–3: on , hence everywhere. Remark on rigor. The only ingredient imported from outside this article is the uniqueness theorem for characteristic functions, a standard prerequisite-level fact about Fourier transforms of finite measures; every other step (analytic extension of the MGF, the identity theorem, restriction to the imaginary axis) is proved above from first principles.
∎Worked examples
Example 1: MGF of a Poisson random variable, and recovering mean and variance. Let with , so for . Compute the MGF:
This series converges for every real (the exponential series converges absolutely for all real ), so here — the Poisson MGF exists on the whole real line. With :
Differentiate once:
At : , matching the known mean . Differentiate again using the product rule on :
At : . By the theorem, , so . Then
correctly recovering for the Poisson, using only differentiation of — no direct summation of was needed.
Example 2: sum of two independent, non-identically-distributed normals, via MGFs. Let (mean , variance ) and (mean , variance ), independent. First derive the general normal MGF: for ,
Complete the square in the exponent: . So the exponent equals
The remaining Gaussian integral over equals (it is a normal density recentered at ), leaving
This converges for all real , so again . Apply this with the given parameters:
By independence and the sum lemma,
This has exactly the form with and . By the uniqueness theorem, since this MGF matches (on all of any interval around ) the MGF of a normal distribution with mean and variance , we conclude
without ever computing a convolution integral of two Gaussian densities. This matches the direct computation and (using independence for the variance additivity), confirming the algebra.
The uniqueness theorem requires and to be finite (not just formally equal as symbols) on a common open interval around . Without this, distinct distributions can share the same infinite sequence of moments and yet fail to be equal — moments alone do not determine a distribution when the MGF fails to exist. The classical example uses the lognormal distribution. Let have the lognormal density
(this is for ). One can show all moments are finite: substituting ,
(using the normal MGF formula from Example 2 with , evaluated at ), a finite number for every . Now define a perturbed density, for a parameter (Heyde's construction, classically; we use a general to show a whole family collides in moments):
One checks (since ) and (the sine term integrates to against , shown below), so is a genuine, different probability density, for every fixed . Same moments: For every integer ,
This holds because completing the square as in Example 2 gives , so the integral becomes . Substituting and using (since is an integer, is a period), this is , where is the standard normal density — an integral of an odd function ( is odd, is even, product is odd) over a symmetric domain, hence exactly . Consequently for every : has exactly the same moment sequence as , for every , yet as densities whenever . Why this doesn't contradict the uniqueness theorem: the theorem requires on an interval around . But for the lognormal, for every (the integrand grows without bound as for any fixed , since dominates ). So the lognormal MGF is finite only at , never on a two-sided interval containing — the hypothesis of the uniqueness theorem fails, and indeed the conclusion fails too: two different distributions ( and ) share every moment.
Scope, edge cases & common traps
| Situation | What happens |
|---|---|
| MGF finite on open interval around | Uniqueness theorem applies; distribution is determined |
| MGF finite only at (e.g. Cauchy, Student-, lognormal for ) | Moments may still exist but MGF-based uniqueness fails; use characteristic function instead |
| Only one-sided finiteness (e.g. lognormal has for only) | Not sufficient — need a genuine two-sided neighborhood of |
| Distribution has infinite moments of some order (e.g. Cauchy, -distribution with d.f.) | MGF is infinite for every ; MGF machinery gives no information |
| Sum of independent variables | MGF of sum = product of MGFs, only under independence |
| Matching MGFs to a "named" form | Valid identification only if the matched form is itself a genuine MGF on an interval around |
The mathematician behind it
Origins · 1 minPierre-Simon Laplace and how this was discovered
Laplace developed the transform that today bears his name, originally to solve difference and differential equations arising in celestial mechanics and in his theory of probability, Théorie analytique des probabilités (1812). The moment generating function is precisely a two-sided Laplace transform of a probability distribution (up to a sign convention), and Laplace's insight — that transforming a problem into "frequency" or "exponential" space can convert hard operations like convolution into simple multiplication — is the exact mechanism that makes MGFs so effective for sums of independent random variables.
Does every random variable have a moment generating function?
No. The MGF exists (in the sense used here) only when is finite on some open interval containing . Distributions with heavy tails, such as the Cauchy distribution or the Student- with few degrees of freedom, have for every , so their MGF does not exist beyond the trivial value . The lognormal distribution is a further cautionary case: its MGF is finite for but infinite for every , so it still fails to exist on a two-sided neighborhood of . In all such cases, the characteristic function remains a valid substitute, since guarantees it is always finite.
Why does matching MGFs let us skip computing a convolution?
Because the MGF of a sum of independent random variables is the product of their individual MGFs, as shown in the Sum of Independent Random Variables lemma above. Directly finding the distribution of from densities requires computing the convolution integral , which can be algebraically messy. Instead, one multiplies the two MGFs, simplifies the resulting expression, and — if it matches the known MGF form of a named family (normal, Poisson, gamma, etc.) — invokes the uniqueness theorem to conclude the sum belongs to that family, with the read-off parameters. This is purely an algebraic shortcut, valid precisely because of uniqueness.
Is the moment generating function the same thing as the characteristic function?
They are closely related but not identical. The characteristic function is , using the imaginary unit , and it always exists and is finite for every real and every random variable, because . The MGF uses a real exponent and can fail to exist. When the MGF does exist on an open interval around , the theory here shows it extends to an analytic function on a complex strip whose restriction to the imaginary axis equals the characteristic function; in that sense the MGF, when it exists, carries the same information as the characteristic function, but the characteristic function is the more robust, universally defined tool.
Can two different MGFs have the same value at every single positive integer without being the same function?
Yes in principle, but this would not contradict the uniqueness theorem, which requires agreement on an entire open interval, not just a discrete set of points. Two distinct analytic functions can certainly agree on infinitely many isolated points without being identical (for example, vanishes at every integer but is not the zero function). The identity theorem used in the uniqueness proof crucially needs an accumulation point of agreement, which an open interval provides but a discrete unbounded set like does not (that set has no accumulation point in the finite plane).
Why is the Poisson MGF finite for every real , while the normal MGF is also finite everywhere, but the lognormal MGF is not?
The Poisson MGF is , and is finite for every real , so this is finite everywhere; the tails of the Poisson distribution decay faster than any exponential can grow, because involves , which beats any exponential. The normal density decays like , again faster than any fixed exponential grows, since eventually dominates for any fixed . The lognormal density decays only like , a much slower decay in (though fast in ) — slow enough that for any , the growth of eventually overwhelms the decay of as , making the integral diverge.