Sums of Random Variables and Convolution
Distribution of a sum via convolution and MGFs, and the closure properties of common families.
Assumes you know
Sums of Random Variables and Convolution
Intuition first
Sums are everywhere: total claim cost, cumulative waiting time, aggregate demand, the numerator of every sample mean. So the distribution of is one of the most frequently needed objects in probability.
Its mean and variance are easy — linearity and independence handle them. The distribution is harder, because can happen in many ways: small and large, or the reverse, or anything between. Summing over all those combinations is what convolution does.
There are two routes. Convolve directly, which is an integral (or a sum) and is often unpleasant. Or multiply moment generating functions, which turns the problem into algebra — and for the standard families lets you recognise the answer instantly. The second route is why MGFs earn their keep.
Convolution
Discrete:
Continuous:
Both assume independence.
Solved problem 1 · Two dice, by discrete convolution
Two fair dice. Find the distribution of the sum by convolution.
Step 1 — set up
Each die has for . For the sum :
over all with both and .
Step 2 — determine the valid range of k
The two constraints give
The number of valid is the number of terms, each contributing .
Step 3 — count terms for a few values
Step 4 — the general formula
Step 5 — verify
The triangular shape is the convolution of two rectangles — a general fact, and the reason sums of uniforms become bell-shaped surprisingly quickly.
Answer
, peaking at for .
Closure properties
Some families are closed under addition of independent members. These are worth memorising, because recognising one saves the whole convolution.
| Sum of independent | Result | Condition |
|---|---|---|
| Same | ||
| Always | ||
| Always | ||
| Same | ||
| Always | ||
| terms | Same | |
| Triangular, not uniform | — |
Proving closure with MGFsAdvanced
For independent and , . Since an MGF determines a distribution uniquely, recognising the product identifies the sum.
Poisson. With :
which is Poisson.
Gamma. With :
Closure holds because the bases match — which is exactly why the same scale is required. With different scales the product is not of gamma form, and the sum is not gamma.
Why binomial needs the same . With :
Again the bases must be identical. Different gives a product of two different bases, which is not a binomial MGF — the sum is then a Poisson-binomial distribution with no closed form.
Solved problem 2 · Sum of two independent uniforms
independent. Find the density of by convolution.
Step 1 — write the convolution integral
Both densities equal 1 on and 0 elsewhere, so the integrand is 1 exactly when
The second condition rearranges to .
Step 2 — intersect the constraints
The integral of 1 over this interval is simply its length.
Step 3 — case s in (0,1)
Here and , so the interval is with length :
Step 4 — case s in [1,2)
Here and , so the interval is with length :
Step 5 — assemble and check
A triangle peaking at . Normalisation is the area of a triangle with base 2 and height 1:
Step 6 — moments, as an independent check
Answer
Triangular on : for and for . Two flat distributions convolve into a peaked one — the first step of the CLT visible in one calculation.
Sums of dependent variables
Convolution requires independence. Without it, the mean still adds by linearity, but the variance needs the covariance term and the distribution requires the full joint:
A random number of terms
For with random and independent of the — a compound distribution — condition on :
Deriving the compound varianceAdvanced
Apply the variance decomposition from the conditional expectation lesson. Given , the sum of i.i.d. terms has
Now:
Adding gives the stated result. The first term is variability in the individual claim sizes, the second variability in how many claims arrive.
This is the foundation of insurance risk modelling: total annual claims is a compound distribution, usually with Poisson (giving ) and gamma or lognormal.
import numpy as np
from scipy import stats
rng = np.random.default_rng(0)
# Two dice: convolution against simulation.
pmf = np.array([(6 - abs(s - 7)) / 36 for s in range(2, 13)])
rolls = rng.integers(1, 7, (500_000, 2)).sum(axis=1)
print("s theory empirical")
for i, s in enumerate(range(2, 13)):
print(f"{s:2d} {pmf[i]:.5f} {np.mean(rolls == s):.5f}")
# Sum of two uniforms is triangular.
S = rng.random(500_000) + rng.random(500_000)
print(f"\nsum of 2 uniforms: mean {S.mean():.4f} (1.0) var {S.var():.4f} ({1/6:.4f})")
print(f"density near s=1 is ~2x density near s=0.5:")
for s in (0.25, 0.5, 1.0):
band = np.mean(np.abs(S - s) < 0.01) / 0.02
print(f" s={s}: empirical {band:.3f} theory {s if s <= 1 else 2-s:.3f}")
# Closure: same p works, different p does not.
a = rng.binomial(10, 0.5, 400_000) + rng.binomial(10, 0.5, 400_000)
b = rng.binomial(10, 0.3, 400_000) + rng.binomial(10, 0.7, 400_000)
print(f"\nBin(10,.5)+Bin(10,.5): var {a.var():.3f} Bin(20,.5) var {20*0.25:.3f} <- matches")
print(f"Bin(10,.3)+Bin(10,.7): var {b.var():.3f} Bin(20,.5) var {20*0.25:.3f} <- does NOT")
# Compound: total claims with Poisson count and gamma severity.
N = rng.poisson(12, 400_000)
total = np.array([rng.gamma(2, 500, n).sum() if n else 0.0 for n in N[:20_000]])
EX, VarX, EN = 2*500, 2*500**2, 12
print(f"\ncompound: mean {total.mean():,.0f} theory {EN*EX:,.0f}")
print(f" var {total.var():,.0f} theory {EN*VarX + EN*EX**2:,.0f}")Exercise 1
and , independent. Find .
Show solutionHide solution
By the closure property, .
About 1.07%.
Verifying by direct convolution — three terms, since and must sum to 2:
The closure property replaced three terms with one — and would replace 101 terms with one if we wanted .
Exercise 2
An insurer expects 20 claims per year (Poisson) with claim sizes averaging £4,000 and standard deviation £6,000. Find the mean and standard deviation of annual total claims.
Show solutionHide solution
A compound Poisson. With (Poisson), , :
Mean:
Variance:
Two things worth noting. The coefficient of variation is , so year-to-year totals swing substantially — a bad year of £145,000 is under a 2-standard-deviation event.
And the decomposition is informative: 69% of the variance comes from uncertainty in claim sizes and 31% from uncertainty in the number of claims. Reducing severity variability — through policy limits or reinsurance — would cut total risk more than stabilising claim frequency.
For a Poisson count the formula simplifies to , which is a useful check: ✓.
Next: The Multivariate Normal Distribution, the last distribution in the module.