Quant Memo
Advanced

Probability Generating Functions

A single function that packs an entire discrete distribution's probabilities into its Taylor coefficients — and turns the hard problem of combining independent counts into simple multiplication.

Prerequisites: Convolution and Sums of Random Variables

Combining two independent random counts — the number of trades filled in the morning session plus the afternoon session — normally means computing a full convolution, sliding one distribution across the other value by value. There is a shortcut that turns this fiddly sliding-and-summing into ordinary multiplication of two simple algebraic expressions. It works by packaging an entire distribution into a single function, in a way that makes "combine two independent counts" as easy as multiplying two polynomials.

The analogy: a probability distribution written as a shopping receipt

Imagine writing a receipt where the "price" of buying kk units of something is P(X=k)P(X=k), and the "quantity" is a placeholder variable sks^k. Add up every line item: P(X=0)s0+P(X=1)s1+P(X=2)s2+P(X{=}0)s^0 + P(X{=}1)s^1 + P(X{=}2)s^2 + \cdots. That polynomial (or infinite series) is the distribution, just rewritten with each probability attached to a marker sks^k that remembers which outcome it belongs to. Now here is the payoff: if you have two independent receipts like this and you multiply them together as ordinary polynomials, the coefficient of sns^n in the product automatically sums up every way the two counts could add to nn — which is exactly the convolution formula, done for free by polynomial multiplication.

Writing it down

For a non-negative integer-valued random variable XX, the probability generating function (PGF) is

GX(s)=E[sX]=k=0P(X=k)sk.G_X(s) = E\big[s^X\big] = \sum_{k=0}^{\infty} P(X=k)\, s^k .

In words: GX(s)G_X(s) is the sum of ss raised to each possible outcome, weighted by that outcome's probability — precisely the "receipt" described above. Two properties do the heavy lifting.

Recovering probabilities. P(X=k)P(X=k) is the coefficient of sks^k in the series, retrievable by differentiating kk times and evaluating at s=0s=0: P(X=k)=GX(k)(0)k!P(X=k) = \dfrac{G_X^{(k)}(0)}{k!}. In words: the whole distribution is stored inside GXG_X, and you can read any individual probability back out.

Sums of independent variables. If XX and YY are independent, then

GX+Y(s)=GX(s)GY(s).G_{X+Y}(s) = G_X(s) \, G_Y(s) .

In words: the PGF of a sum of independent counts is just the product of their individual PGFs — no convolution sum required, only ordinary multiplication.

G_X(s) = 0.5 + 0.3s + 0.2s² G_Y(s) = 0.6 + 0.4s G_X(s)·G_Y(s) = G_{X+Y}(s) = 0.30 + 0.38s + 0.24s² + 0.08s³
Multiplying two probability generating functions like polynomials produces the generating function of their sum directly — each coefficient collects every way the two counts could combine to that total.

Worked example 1: combining two independent counts by multiplying PGFs

XX takes values 0,1,20,1,2 with probabilities 0.5,0.3,0.20.5, 0.3, 0.2, so GX(s)=0.5+0.3s+0.2s2G_X(s) = 0.5 + 0.3s + 0.2s^2. YY takes values 0,10,1 with probabilities 0.6,0.40.6, 0.4, so GY(s)=0.6+0.4sG_Y(s) = 0.6+0.4s. Multiply them out term by term: GX(s)GY(s)=(0.5)(0.6)+[(0.5)(0.4)+(0.3)(0.6)]s+[(0.3)(0.4)+(0.2)(0.6)]s2+(0.2)(0.4)s3G_X(s)G_Y(s) = (0.5)(0.6) + \big[(0.5)(0.4)+(0.3)(0.6)\big]s + \big[(0.3)(0.4)+(0.2)(0.6)\big]s^2 + (0.2)(0.4)s^3. Compute each bracket: constant term 0.300.30; s1s^1 term 0.20+0.18=0.380.20+0.18=0.38; s2s^2 term 0.12+0.12=0.240.12+0.12=0.24; s3s^3 term 0.080.08. So GX+Y(s)=0.30+0.38s+0.24s2+0.08s3G_{X+Y}(s) = 0.30+0.38s+0.24s^2+0.08s^3, meaning P(X+Y=0)=0.30P(X{+}Y{=}0)=0.30, P(X+Y=1)=0.38P(X{+}Y{=}1)=0.38, P(X+Y=2)=0.24P(X{+}Y{=}2)=0.24, P(X+Y=3)=0.08P(X{+}Y{=}3)=0.08. Check one entry directly: P(X+Y=1)P(X{+}Y{=}1) needs (X,Y)=(0,1)(X,Y)=(0,1) or (1,0)(1,0), probability 0.5×0.4+0.3×0.6=0.20+0.18=0.380.5{\times}0.4 + 0.3{\times}0.6 = 0.20+0.18=0.38. Matches, with none of the manual convolution bookkeeping.

Worked example 2: extracting the mean from the PGF

The PGF also hands you moments for free. Differentiate GX(s)G_X(s) once and evaluate at s=1s=1: GX(s)=0.3+0.4sG_X'(s) = 0.3 + 0.4s, so GX(1)=0.3+0.4=0.7=E[X]G_X'(1) = 0.3+0.4 = 0.7 = E[X]. Check directly: E[X]=0(0.5)+1(0.3)+2(0.2)=0.3+0.4=0.7E[X] = 0(0.5)+1(0.3)+2(0.2) = 0.3+0.4=0.7. Matches. This works because differentiating sks^k gives ksk1k\,s^{k-1}, and setting s=1s=1 collapses every sk1s^{k-1} to 1, leaving kkP(X=k)=E[X]\sum_k k\,P(X{=}k) = E[X] — the derivative "brings down" the exponent, which is exactly the count you're averaging.

What this means in practice

Aggregate claim counts in insurance, order-arrival counts in market microstructure, and any model built from sums of independent discrete counts (a Poisson process's increments, a binomial tree's up-move count) use PGFs to avoid manual convolution. Multiplying two Poisson PGFs, for instance, gives you the closed-form fact that the sum of two independent Poissons is itself Poisson with summed rates — a fact that takes one line to prove with PGFs and considerably more with direct convolution.

The probability generating function GX(s)=E[sX]G_X(s)=E[s^X] packages an entire discrete distribution into one function, with P(X=k)P(X{=}k) recoverable as a Taylor coefficient. Its main power: for independent variables, the PGF of a sum is the product of the individual PGFs, replacing convolution with ordinary multiplication.

PGFs only apply cleanly to non-negative integer-valued random variables — trying to build one for a continuous variable like a stock return doesn't work the same way (moment or characteristic generating functions are the continuous-variable analogues). A second common slip: forgetting that GX+Y=GXGYG_{X+Y}=G_XG_Y requires independence — for dependent counts (correlated arrival processes, say), the PGF of the sum is not simply the product, and using the shortcut anyway silently produces the wrong distribution.

Related concepts

Practice in interviews

Further reading

  • Wilf, Generatingfunctionology (ch. 1-2)
  • Feller, An Introduction to Probability Theory, Vol. 1 (ch. 11)
ShareTwitterLinkedIn