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 E[X],E[X2],E[X3],…E[X], E[X^2], E[X^3],\dots into one analytic function MX(t)=E[etX]M_X(t) = E[e^{tX}]. Extract moments back out by differentiating at t=0t=0. 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.

Key takeaways
  • The MGF of XX is MX(t)=E[etX]M_X(t) = E[e^{tX}], defined for tt in some interval containing 00.
  • If MXM_X is finite on an open interval around 00, its derivatives at 00 recover the moments: MX(n)(0)=E[Xn]M_X^{(n)}(0) = E[X^n].
  • MGFs turn sums of independent random variables into products: MX+Y(t)=MX(t)MY(t)M_{X+Y}(t) = M_X(t)M_Y(t).
  • Uniqueness theorem: if two MGFs agree on an open interval around 00, the distributions are identical.
  • Existence is not automatic — heavy-tailed distributions (e.g. Cauchy, lognormal) can have infinite MGF for every t≠0t \neq 0.
  • Key idea: the MGF packages an infinite sequence of moments into one function, and that function's local behavior at 00 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 χ2\chi^2-distributed by multiplying MGFs, underlying the derivation of the FF and tt 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 MX(t)=(0.4+0.6et)10M_X(t) = (0.4 + 0.6e^t)^{10} for all real tt, what is E[X]E[X]?]

  • 4
  • 6 ✓
  • 10
  • 0.6

:::quiz[For Z∼N(μ,σ2)Z\sim N(\mu,\sigma^2), differentiating MZ(t)=exp⁡(μt+σ2t2/2)M_Z(t) = \exp(\mu t + \sigma^2 t^2/2) twice and evaluating at t=0t=0 gives E[Z2]E[Z^2] equal to]

  • σ2\sigma^2
  • μ2\mu^2
  • μ2+σ2\mu^2+\sigma^2 ✓
  • 2σ22\sigma^2

:::faq[Does the moment-extraction formula MX(n)(0)=E[Xn]M_X^{(n)}(0)=E[X^n] require the MGF to exist on the whole real line?] No — only on some open interval (−h,h)(-h,h) around 00, however small h>0h>0 is. The proof of the moments theorem only uses local behavior near t=0t=0: the dominated convergence argument for differentiating under the expectation only needs MXM_X 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?

DefinitionMoment Generating Function

Let XX be a random variable on a probability space (Ω,F,P)(\Omega, \mathcal F, P). The moment generating function of XX is the function

MX(t)=E ⁣[etX],t∈R,M_X(t) = E\!\left[e^{tX}\right], \qquad t \in \mathbb{R},

wherever this expectation is finite. We say the MGF exists if there is some h>0h>0 such that MX(t)<∞M_X(t) < \infty for all t∈(−h,h)t \in (-h, h). Concretely:

  • If XX is discrete with probability mass function pXp_X, then MX(t)=∑xetxpX(x)M_X(t) = \sum_{x} e^{tx} p_X(x).
  • If XX is continuous with density fXf_X, then MX(t)=∫−∞∞etxfX(x) dxM_X(t) = \int_{-\infty}^{\infty} e^{tx} f_X(x)\, dx.

Note MX(0)=E[e0]=1M_X(0) = E[e^{0}] = 1 always, regardless of the distribution; the substantive content is the behavior of MXM_X for t≠0t \neq 0.

Intuition

Think of MX(t)M_X(t) as a "loaded" version of XX's distribution: multiplying the density or mass function by etxe^{tx} and summing/integrating exponentially tilts the distribution toward large values (for t>0t>0) or small values (for t<0t<0). Because etxe^{tx} can be expanded as a power series, MX(t)M_X(t) automatically bundles together all the moments of XX simultaneously — the coefficient of tn/n!t^n/n! in the Taylor expansion of MXM_X is exactly E[Xn]E[X^n]. This is why differentiating MXM_X at t=0t=0 is such a clean way to generate moments: the exponential does the work of tracking every power of XX at once. The second key intuition is algebraic: expectation of a product of independent exponentials factors, because independence means expectations factor. This single fact — E[et(X+Y)]=E[etX]E[etY]E[e^{t(X+Y)}] = E[e^{tX}]E[e^{tY}] for independent X,YX,Y — 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 −t-t.

Figure
Exponential tilting: the MGF integrand for a standard normal density at three values of tt
x density f(x), standard normal e^{tx} f(x), t = 1 e^{tx} f(x), t = -1 0

The central theorem

TheoremMoments from the MGF

Let XX be a random variable whose MGF MX(t)M_X(t) is finite for all tt in some open interval (−h,h)(-h, h) with h>0h > 0. Then: 1. XX has finite moments of every order: E[∣X∣n]<∞E[|X|^n] < \infty for all n≥1n \ge 1. 2. MXM_X is infinitely differentiable on (−h,h)(-h,h), differentiation may be passed inside the expectation, and

MX(n)(0)=E[Xn]for every n≥0.M_X^{(n)}(0) = E[X^n] \quad \text{for every } n \ge 0.

3. On (−h,h)(-h,h), MXM_X has the convergent power series expansion

MX(t)=∑n=0∞E[Xn] tnn!.M_X(t) = \sum_{n=0}^{\infty} E[X^n]\,\frac{t^n}{n!}.
Proof

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 t0∈(0,h)t_0 \in (0,h). Since MX(t0)=E[et0X]<∞M_X(t_0) = E[e^{t_0 X}] < \infty and MX(−t0)=E[e−t0X]<∞M_X(-t_0) = E[e^{-t_0 X}] < \infty, we have

E[et0X+e−t0X]<∞.E\left[e^{t_0 X} + e^{-t_0 X}\right] < \infty.

For any n≥1n \ge 1, elementary calculus gives, for all real xx,

∣x∣n≤n!t0n(et0x+e−t0x).|x|^n \le \frac{n!}{t_0^n}\left(e^{t_0 x} + e^{-t_0 x}\right).

(This holds because et0x≥(t0x)nn!e^{t_0 x} \ge \frac{(t_0 x)^n}{n!} when t0x≥0t_0 x \ge 0, using the fact that all terms of the exponential series are nonnegative there, giving ∣x∣n≤n!t0net0x|x|^n \le \frac{n!}{t_0^n} e^{t_0 x} when x≥0x \ge 0; the symmetric argument with e−t0xe^{-t_0 x} handles x<0x < 0; adding the two bounds covers both cases with one inequality valid for all xx.) Taking expectations,

E[∣X∣n]≤n!t0n E[et0X+e−t0X]<∞.E[|X|^n] \le \frac{n!}{t_0^n}\, E\left[e^{t_0 X} + e^{-t_0 X}\right] < \infty.

So every moment of XX is finite. Step 2: differentiating under the expectation sign. We show ddtE[etX]=E[XetX]\frac{d}{dt} E[e^{tX}] = E[Xe^{tX}] for tt in a slightly smaller interval (−h′,h′)(-h', h') with 0<h′<h0 < h' < h. Fix such tt and let δ=min⁡(h−h′,h′)/2>0\delta = \min(h - h', h' )/2 > 0 so that t±δ∈(−h,h)t \pm \delta \in (-h,h). For s≠0s \neq 0 with ∣s∣<δ|s| < \delta, consider the difference quotient

e(t+s)X−etXs=etX⋅esX−1s.\frac{e^{(t+s)X} - e^{tX}}{s} = e^{tX}\cdot \frac{e^{sX}-1}{s}.

By the mean value theorem applied to the exponential function, for each fixed X=xX = x there is ξ\xi between 00 and ss with

esx−1s=xeξx.\frac{e^{sx}-1}{s} = x e^{\xi x}.

Since ∣ξ∣<δ|\xi| < \delta, we bound ∣xeξx∣≤∣x∣(eδx+e−δx)|xe^{\xi x}| \le |x|\left(e^{\delta x} + e^{-\delta x}\right) crudely (as eξx≤eδx+e−δxe^{\xi x}\le e^{\delta x}+e^{-\delta x} regardless of sign of xx and ξ\xi). Hence the difference quotient is dominated in absolute value by

g(X):=∣X∣etX(eδX+e−δX)=∣X∣(e(t+δ)X+e(t−δ)X),g(X) := |X| e^{tX}\left(e^{\delta X} + e^{-\delta X}\right) = |X|\left(e^{(t+\delta)X} + e^{(t-\delta)X}\right),

uniformly in ss with ∣s∣<δ|s|<\delta. Since t+δ,t−δ∈(−h,h)t+\delta, t-\delta \in (-h,h), Step 1's argument (applied with exponent n=1n=1 combined with e(t±δ)Xe^{(t\pm\delta)X} playing the role of the tilting factor) shows E[g(X)]<∞E[g(X)] < \infty: indeed ∣x∣e(t+δ)x≤1δ(e(t+2δ)x+e(t)x)⋅|x|e^{(t+\delta)x} \le \frac{1}{\delta}\left(e^{(t+2\delta)x}+ e^{(t)x}\right)\cdot(bounded constant), and more directly, E[∣X∣e(t±δ)X]<∞E[|X|e^{(t\pm\delta)X}]<\infty follows because ∣X∣|X| has finite exponential moments whenever XX does, by the same Step-1-type inequality applied to the shifted variable. Since gg is an integrable dominating function not depending on ss, dominated convergence gives

lim⁡s→0E[etXesX−1s]=E[lim⁡s→0etXesX−1s]=E[XetX],\lim_{s\to 0} E\left[e^{tX}\frac{e^{sX}-1}{s}\right] = E\left[\lim_{s\to 0} e^{tX}\frac{e^{sX}-1}{s}\right] = E[Xe^{tX}],

using that esX−1s→X\frac{e^{sX}-1}{s}\to X pointwise as s→0s \to 0 (definition of the derivative of esxe^{sx} at s=0s=0). This proves MX′(t)=E[XetX]M_X'(t) = E[Xe^{tX}] for t∈(−h′,h′)t \in (-h',h'); since h′<hh'<h was arbitrary, this holds on all of (−h,h)(-h,h). By induction, the same dominated-convergence argument (using ∣X∣n+1|X|^{n+1} in place of ∣X∣|X|, which has finite exponential moments by Step 1) gives

MX(n)(t)=E[XnetX],t∈(−h,h), n≥1.M_X^{(n)}(t) = E\left[X^n e^{tX}\right], \qquad t \in (-h,h),\ n \ge 1.

Setting t=0t=0 and using e0=1e^{0}=1:

MX(n)(0)=E[Xn].M_X^{(n)}(0) = E[X^n].

Step 3: the power series. Since MXM_X is infinitely differentiable at 00 with all derivatives given by moments, Taylor's theorem with remainder gives, for tt in a neighborhood of 00,

MX(t)=∑n=0NE[Xn]tnn!+RN(t).M_X(t) = \sum_{n=0}^{N} E[X^n] \frac{t^n}{n!} + R_N(t).

To show RN(t)→0R_N(t) \to 0 (so the series converges to MX(t)M_X(t), not just formally matches derivatives), fix t0∈(0,h)t_0 \in (0,h) and tt with ∣t∣<t0|t| < t_0. Using the integral (or Lagrange) form of the Taylor remainder together with the bound ∣MX(N+1)(θ)∣=∣E[XN+1eθX]∣≤E[∣X∣N+1(et0X+e−t0X)]|M_X^{(N+1)}(\theta)| = |E[X^{N+1}e^{\theta X}]| \le E[|X|^{N+1}(e^{t_0 X}+e^{-t_0X})], one shows, exactly as in Step 1's inequality (applied with exponent t0′t_0' strictly between ∣t∣|t| and t0t_0), that

∣RN(t)∣≤(N+1)!(N+1)!(∣t∣t0)N+1⋅C(t0)→0as N→∞,|R_N(t)| \le \frac{(N+1)!}{(N+1)!}\left(\frac{|t|}{t_0}\right)^{N+1} \cdot C(t_0) \to 0 \quad \text{as } N \to \infty,

for a constant C(t0)C(t_0) depending only on t0t_0, because ∣t∣/t0<1|t|/t_0 < 1. Hence the Taylor series converges to MX(t)M_X(t) on (−t0,t0)(-t_0, t_0); as t0<ht_0 < h was arbitrary, it converges on all of (−h,h)(-h,h). ■\blacksquare

∎
LemmaMGF of a sum of independent random variables

If XX and YY are independent random variables whose MGFs both exist on a common interval (−h,h)(-h,h), then X+YX+Y has an MGF on (−h,h)(-h,h) given by

MX+Y(t)=MX(t)MY(t).M_{X+Y}(t) = M_X(t) M_Y(t).

More generally, if X1,…,XnX_1,\dots,X_n are independent with MGFs existing on a common interval, then

MX1+⋯+Xn(t)=∏i=1nMXi(t).M_{X_1+\cdots+X_n}(t) = \prod_{i=1}^n M_{X_i}(t).
Proof

Technique: independence turns expectation of a product into a product of expectations. For t∈(−h,h)t \in (-h,h),

MX+Y(t)=E[et(X+Y)]=E[etXetY].M_{X+Y}(t) = E\left[e^{t(X+Y)}\right] = E\left[e^{tX} e^{tY}\right].

Because XX and YY are independent, so are the transformed random variables etXe^{tX} and etYe^{tY} (a measurable function of XX is independent of a measurable function of YY whenever X⊥YX \perp Y). For independent random variables U,VU, V with E[U2],E[V2]<∞E[U^2],E[V^2]<\infty or, more generally, whenever E∣U∣,E∣V∣<∞E|U|, E|V| < \infty and UVUV is integrable, independence gives E[UV]=E[U]E[V]E[UV] = E[U]E[V]; here U=etX,V=etYU=e^{tX}, V=e^{tY} are both integrable by hypothesis (t∈(−h,h)t \in (-h,h) lies in the domain of both MGFs), and E[UV]=MX+Y(t)<∞E[UV] = M_{X+Y}(t) < \infty follows from Hölder's inequality since E[e2tX],E[e2tY]<∞E[e^{2tX}], E[e^{2tY}] < \infty for tt in a slightly smaller subinterval — or directly from the standard factorization property of expectation under independence for nonnegative random variables (both U,V≥0U,V \ge 0 here, so Tonelli's theorem applies without integrability worries). Hence

MX+Y(t)=E[etX]E[etY]=MX(t)MY(t).M_{X+Y}(t) = E[e^{tX}]E[e^{tY}] = M_X(t)M_Y(t).

The nn-variable case follows by induction on nn, applying the two-variable result to X1+⋯+Xn−1X_1+\cdots+X_{n-1} (independent of XnX_n) and XnX_n. ■\blacksquare

∎
TheoremUniqueness of the moment generating function

Let XX and YY be random variables such that MX(t)M_X(t) and MY(t)M_Y(t) are both finite and equal for all tt in some open interval (−h,h)(-h,h), h>0h>0. Then XX and YY have the same cumulative distribution function:

FX(x)=FY(x)for all x∈R.F_X(x) = F_Y(x) \quad \text{for all } x \in \mathbb{R}.
Proof

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 MXM_X to a complex strip. Because MX(t)=E[etX]<∞M_X(t) = E[e^{tX}] < \infty for t∈(−h,h)t \in (-h,h), the same Step-1 bound from the Moments Theorem shows E[∣X∣n]<∞E[|X|^n] < \infty for all nn, and in fact the bound is uniform enough that for complex z=t+isz = t + is with ∣t∣<h|t| < h, the series

E[ezX]:=∑n=0∞E[Xn]znn!E\left[e^{zX}\right] := \sum_{n=0}^\infty E[X^n]\frac{z^n}{n!}

converges absolutely (since ∑∣E[Xn]∣∣z∣n/n!≤∑E[∣X∣n]∣z∣n/n!=MX(∣z∣)<∞\sum |E[X^n]| |z|^n/n! \le \sum E[|X|^n]|z|^n/n! = M_X(|z|) < \infty for ∣z∣<h|z| < h, using the real MGF's finiteness and the triangle inequality ∣E[Xn]∣≤E[∣X∣n]|E[X^n]|\le E[|X|^n]). This defines an analytic function M^X(z)\widehat M_X(z) on the strip {z:∣Re(z)∣<h}\{z : |\mathrm{Re}(z)| < h\} (justification: a power series is analytic on its disk of convergence, and here the relevant variable is zz itself since E[ezX]E[e^{zX}], viewed as a function of complex zz, has a power series representation valid on ∣z∣<h|z|<h by the dominated convergence argument extending Step 2 of the Moments Theorem to complex increments). In particular, restricting to the imaginary axis z=isz = is gives

M^X(is)=E[eisX]=φX(s),\widehat M_X(is) = E[e^{isX}] = \varphi_X(s),

the characteristic function of XX, for all real ss (the series for M^X\widehat M_X converges for every purely imaginary z=isz=is since E[ezX]E[e^{zX}] was shown analytic on the whole strip ∣Re(z)∣<h|\mathrm{Re}(z)|<h, which includes the imaginary axis where Re(z)=0<h\mathrm{Re}(z)=0<h). Step 2: equality of MGFs on (−h,h)(-h,h) forces equality of the analytic extensions on the whole strip. M^X(z)\widehat M_X(z) and M^Y(z)\widehat M_Y(z) are both analytic on the strip ∣Re(z)∣<h|\mathrm{Re}(z)|<h, and they agree on the real segment (−h,h)(-h,h) (since MX=MYM_X = M_Y 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 (−h,h)(-h,h) has accumulation points (indeed every point is one), so M^X≡M^Y\widehat M_X \equiv \widehat M_Y on the entire strip. Step 3: equal characteristic functions imply equal distributions. By Step 2, in particular M^X(is)=M^Y(is)\widehat M_X(is) = \widehat M_Y(is) for all real ss, i.e. φX(s)=φY(s)\varphi_X(s) = \varphi_Y(s) for every s∈Rs \in \mathbb{R}. The Fourier inversion / uniqueness theorem for characteristic functions states: if two random variables have identical characteristic functions on all of R\mathbb{R}, they have identical distribution functions. (This is proved via Fourier inversion formulas expressing FXF_X in terms of φX\varphi_X 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: φX≡φY\varphi_X \equiv \varphi_Y on R\mathbb{R}, hence FX=FYF_X = F_Y everywhere. ■\blacksquare 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 X∼Poisson(λ)X \sim \mathrm{Poisson}(\lambda) with λ=3.2\lambda = 3.2, so P(X=k)=e−λλk/k!P(X=k) = e^{-\lambda}\lambda^k/k! for k=0,1,2,…k = 0,1,2,\dots. Compute the MGF:

MX(t)=∑k=0∞etk⋅e−λλkk!=e−λ∑k=0∞(λet)kk!=e−λeλet=exp⁡ ⁣(λ(et−1)).M_X(t) = \sum_{k=0}^\infty e^{tk} \cdot \frac{e^{-\lambda}\lambda^k}{k!} = e^{-\lambda}\sum_{k=0}^\infty \frac{(\lambda e^t)^k}{k!} = e^{-\lambda} e^{\lambda e^t} = \exp\!\left(\lambda(e^t - 1)\right).

This series converges for every real tt (the exponential series ∑(λet)k/k!\sum (\lambda e^t)^k/k! converges absolutely for all real λet\lambda e^t), so h=∞h = \infty here — the Poisson MGF exists on the whole real line. With λ=3.2\lambda = 3.2:

MX(t)=exp⁡ ⁣(3.2(et−1)).M_X(t) = \exp\!\left(3.2(e^t-1)\right).

Differentiate once:

MX′(t)=λetexp⁡ ⁣(λ(et−1))=3.2 etexp⁡ ⁣(3.2(et−1)).M_X'(t) = \lambda e^t \exp\!\left(\lambda(e^t-1)\right) = 3.2\, e^t \exp\!\left(3.2(e^t-1)\right).

At t=0t=0: MX′(0)=3.2⋅1⋅1=3.2M_X'(0) = 3.2 \cdot 1 \cdot 1 = 3.2, matching the known mean E[X]=λ=3.2E[X] = \lambda = 3.2. Differentiate again using the product rule on MX′(t)=λetMX(t)M_X'(t) = \lambda e^t M_X(t):

MX′′(t)=λetMX(t)+λet⋅MX′(t)=λetMX(t)+λet⋅λetMX(t)=λetMX(t)(1+λet).M_X''(t) = \lambda e^t M_X(t) + \lambda e^t \cdot M_X'(t) = \lambda e^t M_X(t) + \lambda e^t \cdot \lambda e^t M_X(t) = \lambda e^t M_X(t)\left(1 + \lambda e^t\right).

At t=0t=0: MX′′(0)=λ⋅1⋅1⋅(1+λ)=λ+λ2=3.2+10.24=13.44M_X''(0) = \lambda \cdot 1 \cdot 1 \cdot (1+\lambda) = \lambda + \lambda^2 = 3.2 + 10.24 = 13.44. By the theorem, MX′′(0)=E[X2]M_X''(0) = E[X^2], so E[X2]=13.44E[X^2] = 13.44. Then

Var(X)=E[X2]−(E[X])2=13.44−3.22=13.44−10.24=3.2,\mathrm{Var}(X) = E[X^2] - (E[X])^2 = 13.44 - 3.2^2 = 13.44 - 10.24 = 3.2,

correctly recovering Var(X)=λ=3.2\mathrm{Var}(X) = \lambda = 3.2 for the Poisson, using only differentiation of MXM_X — no direct summation of ∑k2p(k)\sum k^2 p(k) was needed.

Example 2: sum of two independent, non-identically-distributed normals, via MGFs. Let X∼N(2,3)X \sim N(2, 3) (mean 22, variance 33) and Y∼N(−5,7)Y \sim N(-5, 7) (mean −5-5, variance 77), independent. First derive the general normal MGF: for Z∼N(μ,σ2)Z \sim N(\mu,\sigma^2),

MZ(t)=E[etZ]=∫−∞∞etz12πσ2exp⁡ ⁣(−(z−μ)22σ2)dz.M_Z(t) = E[e^{tZ}] = \int_{-\infty}^\infty e^{tz} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\!\left(-\frac{(z-\mu)^2}{2\sigma^2}\right) dz.

Complete the square in the exponent: tz−(z−μ)22σ2=−12σ2[(z−μ)2−2σ2tz]=−12σ2[(z−μ−σ2t)2−2μσ2t−σ4t2]tz - \frac{(z-\mu)^2}{2\sigma^2} = -\frac{1}{2\sigma^2}\left[(z-\mu)^2 - 2\sigma^2 t z\right] = -\frac{1}{2\sigma^2}\left[(z - \mu - \sigma^2 t)^2 - 2\mu\sigma^2 t - \sigma^4 t^2\right]. So the exponent equals

−(z−μ−σ2t)22σ2+μt+σ2t22.-\frac{(z-\mu-\sigma^2 t)^2}{2\sigma^2} + \mu t + \frac{\sigma^2 t^2}{2}.

The remaining Gaussian integral over zz equals 11 (it is a normal density recentered at μ+σ2t\mu + \sigma^2 t), leaving

MZ(t)=exp⁡ ⁣(μt+σ2t22),t∈R.M_Z(t) = \exp\!\left(\mu t + \frac{\sigma^2 t^2}{2}\right), \qquad t \in \mathbb{R}.

This converges for all real tt, so again h=∞h=\infty. Apply this with the given parameters:

MX(t)=exp⁡ ⁣(2t+32t2),MY(t)=exp⁡ ⁣(−5t+72t2).M_X(t) = \exp\!\left(2t + \tfrac{3}{2}t^2\right), \qquad M_Y(t) = \exp\!\left(-5t + \tfrac{7}{2}t^2\right).

By independence and the sum lemma,

MX+Y(t)=MX(t)MY(t)=exp⁡ ⁣(2t+32t2−5t+72t2)=exp⁡ ⁣(−3t+5t2)=exp⁡ ⁣((−3)t+(10)2t2).M_{X+Y}(t) = M_X(t)M_Y(t) = \exp\!\left(2t + \tfrac{3}{2}t^2 - 5t + \tfrac{7}{2}t^2\right) = \exp\!\left(-3t + 5t^2\right) = \exp\!\left((-3)t + \tfrac{(10)}{2}t^2\right).

This has exactly the form exp⁡(μt+σ2t2/2)\exp(\mu t + \sigma^2 t^2/2) with μ=−3\mu = -3 and σ2=10\sigma^2 = 10. By the uniqueness theorem, since this MGF matches (on all of R⊃\mathbb R \supset any interval around 00) the MGF of a normal distribution with mean −3-3 and variance 1010, we conclude

X+Y∼N(−3,10),X + Y \sim N(-3, 10),

without ever computing a convolution integral of two Gaussian densities. This matches the direct computation E[X+Y]=2+(−5)=−3E[X+Y] = 2+(-5) = -3 and Var(X+Y)=3+7=10\mathrm{Var}(X+Y) = 3+7=10 (using independence for the variance additivity), confirming the algebra.

CounterexampleWhy "MGF exists on an open interval around 0" cannot be dropped

The uniqueness theorem requires MXM_X and MYM_Y to be finite (not just formally equal as symbols) on a common open interval around 00. 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 XX have the lognormal density

f(x)=1x2πexp⁡ ⁣(−(ln⁡x)22),x>0,f(x) = \frac{1}{x\sqrt{2\pi}} \exp\!\left(-\frac{(\ln x)^2}{2}\right), \qquad x > 0,

(this is eZe^{Z} for Z∼N(0,1)Z \sim N(0,1)). One can show all moments E[Xn]E[X^n] are finite: substituting x=ezx=e^z,

E[Xn]=∫0∞xnf(x) dx=∫−∞∞enz12πe−z2/2 dz=en2/2,E[X^n] = \int_0^\infty x^n f(x)\,dx = \int_{-\infty}^{\infty} e^{nz} \frac{1}{\sqrt{2\pi}} e^{-z^2/2}\,dz = e^{n^2/2},

(using the normal MGF formula from Example 2 with μ=0,σ2=1\mu=0,\sigma^2=1, evaluated at t=nt=n), a finite number for every nn. Now define a perturbed density, for a parameter ϵ∈(0,1)\epsilon \in (0,1) (Heyde's construction, ϵ=1\epsilon=1 classically; we use a general ϵ\epsilon to show a whole family collides in moments):

g(x)=f(x)[1+ϵsin⁡(2πln⁡x)],x>0.g(x) = f(x)\left[1 + \epsilon \sin(2\pi \ln x)\right], \qquad x>0.

One checks g≥0g \ge 0 (since ∣ϵsin⁡(2πln⁡x)∣≤ϵ<1|\epsilon \sin(2\pi\ln x)|\le \epsilon < 1) and ∫0∞g(x) dx=1\int_0^\infty g(x)\,dx = 1 (the sine term integrates to 00 against ff, shown below), so gg is a genuine, different probability density, for every fixed ϵ∈(0,1)\epsilon \in (0,1). Same moments: For every integer n≥0n \ge 0,

∫0∞xnf(x)sin⁡(2πln⁡x) dx=∫−∞∞enze−z2/22πsin⁡(2πz) dz=0.\int_0^\infty x^n f(x)\sin(2\pi \ln x)\,dx = \int_{-\infty}^\infty e^{nz}\frac{e^{-z^2/2}}{\sqrt{2\pi}}\sin(2\pi z)\,dz = 0.

This holds because completing the square as in Example 2 gives enz−z2/2=en2/2e−(z−n)2/2e^{nz - z^2/2} = e^{n^2/2} e^{-(z-n)^2/2}, so the integral becomes en2/2∫−∞∞e−(z−n)2/22πsin⁡(2πz) dze^{n^2/2}\int_{-\infty}^\infty \frac{e^{-(z-n)^2/2}}{\sqrt{2\pi}}\sin(2\pi z)\,dz. Substituting u=z−nu = z-n and using sin⁡(2π(u+n))=sin⁡(2πu)\sin(2\pi(u+n)) = \sin(2\pi u) (since nn is an integer, 2πn2\pi n is a period), this is en2/2∫−∞∞ϕ(u)sin⁡(2πu) due^{n^2/2}\int_{-\infty}^\infty \phi(u)\sin(2\pi u)\,du, where ϕ\phi is the standard normal density — an integral of an odd function (sin⁡\sin is odd, ϕ\phi is even, product is odd) over a symmetric domain, hence exactly 00. Consequently ∫0∞xng(x) dx=∫0∞xnf(x) dx+ϵ⋅0=en2/2\int_0^\infty x^n g(x)\,dx = \int_0^\infty x^n f(x)\,dx + \epsilon \cdot 0 = e^{n^2/2} for every n≥0n \ge 0: gg has exactly the same moment sequence as ff, for every ϵ∈(0,1)\epsilon \in (0,1), yet g≠fg \ne f as densities whenever ϵ>0\epsilon > 0. Why this doesn't contradict the uniqueness theorem: the theorem requires MX(t)<∞M_X(t)<\infty on an interval around 00. But for the lognormal, MX(t)=E[etX]=∫0∞etxf(x) dx=∞M_X(t) = E[e^{tX}] = \int_0^\infty e^{tx}f(x)\,dx = \infty for every t>0t>0 (the integrand etxf(x)∼etx−(ln⁡x)2/2e^{tx}f(x) \sim e^{tx - (\ln x)^2/2} grows without bound as x→∞x\to\infty for any fixed t>0t>0, since txtx dominates (ln⁡x)2(\ln x)^2). So the lognormal MGF is finite only at t≤0t \le 0, never on a two-sided interval containing 00 — the hypothesis of the uniqueness theorem fails, and indeed the conclusion fails too: two different distributions (ff and gg) share every moment.

Scope, edge cases & common traps

SituationWhat happens
MGF finite on open interval around 00Uniqueness theorem applies; distribution is determined
MGF finite only at t=0t=0 (e.g. Cauchy, Student-tt, lognormal for t>0t>0)Moments may still exist but MGF-based uniqueness fails; use characteristic function instead
Only one-sided finiteness (e.g. lognormal has MX(t)<∞M_X(t)<\infty for t≤0t\le0 only)Not sufficient — need a genuine two-sided neighborhood of 00
Distribution has infinite moments of some order (e.g. Cauchy, tt-distribution with 11 d.f.)MGF is infinite for every t≠0t\ne0; MGF machinery gives no information
Sum of independent variablesMGF of sum = product of MGFs, only under independence
Matching MGFs to a "named" formValid identification only if the matched form is itself a genuine MGF on an interval around 00

The mathematician behind it

Origins · 1 minPierre-Simon Laplace and how this was discovered
PL
Pierre-Simon Laplace
1749–1827 · French mathematician and astronomer, foundational figure in probability theory

Laplace developed the transform ∫e−stf(t) dt\int e^{-st} f(t)\, dt 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.

History
- 1782 — Laplace begins systematic use of the transform later named after him, in work on generating functions for solving recurrences.
- 1812 — Laplace's Théorie analytique des probabilités develops generating-function methods extensively for probability problems.
- 1920s–1930s — Paul Lévy and others formalize characteristic functions (Fourier transforms of distributions) and prove rigorous uniqueness and continuity theorems, providing the modern proof route used above.
- 1934–1935 — Harald Cramér's work on asymptotic expansions and moment problems clarifies exactly when moment sequences determine distributions (the classical "moment problem"), explaining counterexamples like the lognormal.
- Mid-20th century — MGFs become a standard textbook tool for identifying distributions of sums, exemplified by identifying sums of independent Poissons, normals, and gammas via MGF matching, cementing their place in probability curricula.
Does every random variable have a moment generating function?

No. The MGF exists (in the sense used here) only when E[etX]E[e^{tX}] is finite on some open interval containing 00. Distributions with heavy tails, such as the Cauchy distribution or the Student-tt with few degrees of freedom, have E[etX]=∞E[e^{tX}] = \infty for every t≠0t \ne 0, so their MGF does not exist beyond the trivial value MX(0)=1M_X(0)=1. The lognormal distribution is a further cautionary case: its MGF is finite for t≤0t \le 0 but infinite for every t>0t>0, so it still fails to exist on a two-sided neighborhood of 00. In all such cases, the characteristic function φX(t)=E[eitX]\varphi_X(t) = E[e^{itX}] remains a valid substitute, since ∣eitX∣=1|e^{itX}|=1 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 X+YX+Y from densities requires computing the convolution integral ∫fX(u)fY(x−u) du\int f_X(u) f_Y(x-u)\,du, 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 φX(t)=E[eitX]\varphi_X(t) = E[e^{itX}], using the imaginary unit ii, and it always exists and is finite for every real tt and every random variable, because ∣eitX∣=1|e^{itX}| = 1. The MGF MX(t)=E[etX]M_X(t) = E[e^{tX}] uses a real exponent and can fail to exist. When the MGF does exist on an open interval around 00, 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 t=1,2,3,…t=1,2,3,\dots 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, sin⁡(πz)\sin(\pi z) 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 {1,2,3,… }\{1,2,3,\dots\} does not (that set has no accumulation point in the finite plane).

Why is the Poisson MGF finite for every real tt, while the normal MGF is also finite everywhere, but the lognormal MGF is not?

The Poisson MGF is exp⁡(λ(et−1))\exp(\lambda(e^t-1)), and ete^t is finite for every real tt, so this is finite everywhere; the tails of the Poisson distribution decay faster than any exponential etxe^{tx} can grow, because P(X=k)P(X=k) involves 1/k!1/k!, which beats any exponential. The normal density decays like e−x2/2σ2e^{-x^2/2\sigma^2}, again faster than any fixed exponential etxe^{tx} grows, since x2x^2 eventually dominates txtx for any fixed tt. The lognormal density decays only like e−(ln⁡x)2/2/xe^{-(\ln x)^2/2}/x, a much slower decay in xx (though fast in ln⁡x\ln x) — slow enough that for any t>0t>0, the growth of etxe^{tx} eventually overwhelms the decay of f(x)f(x) as x→∞x\to\infty, making the integral diverge.

Before this

Where this leads