Skip to main content
Examonaut

Topic 7 · Lesson 1 of 3

Generating functions and standard distributions

The definition

For a random variable XX taking values 0,1,2,…0, 1, 2, \ldots,

GX(t)=E(tX)=∑xP(X=x) tx=P(X=0)+P(X=1)t+P(X=2)t2+⋯\text{G}_X(t) = \text{E}(t^X) = \sum_x \text{P}(X = x)\,t^x = \text{P}(X = 0) + \text{P}(X = 1)t + \text{P}(X = 2)t^2 + \cdots

The coefficient of txt^x is P(X=x)\text{P}(X = x). For example, if XX takes the values 0, 1, 2, 3 with probabilities 0.1, 0.4, 0.3, 0.2, then

GX(t)=0.1+0.4t+0.3t2+0.2t3\text{G}_X(t) = 0.1 + 0.4t + 0.3t^2 + 0.2t^3

Two facts follow at once:

  • GX(1)=∑P(X=x)=1\text{G}_X(1) = \sum \text{P}(X = x) = 1. This is how you find an unknown constant: if GX(t)=k(1+t)4\text{G}_X(t) = k(1 + t)^4, then 16k=116k = 1.
  • GX(0)=P(X=0)\text{G}_X(0) = \text{P}(X = 0).

A function can only be a PGF if, expanded as a series in tt, its coefficients are all between 0 and 1 and G(1)=1\text{G}(1) = 1.

Reading off probabilities

To find P(X=r)\text{P}(X = r), expand GX(t)\text{G}_X(t) and pick out the coefficient of trt^r.

  • GX(t)=116(1+3t)2=116(1+6t+9t2)\text{G}_X(t) = \frac{1}{16}(1 + 3t)^2 = \frac{1}{16}(1 + 6t + 9t^2), so P(X=1)=616=38\text{P}(X = 1) = \frac{6}{16} = \frac{3}{8}.
  • GX(t)=12−t=12(1−t2)−1=12(1+t2+t24+⋯ )\text{G}_X(t) = \frac{1}{2 - t} = \frac{1}{2}\left(1 - \frac{t}{2}\right)^{-1} = \frac{1}{2}\left(1 + \frac{t}{2} + \frac{t^2}{4} + \cdots\right), so P(X=r)=(12)r+1\text{P}(X = r) = \left(\frac{1}{2}\right)^{r + 1}.
  • GX(t)=e2.5(t−1)=e−2.5e2.5t=e−2.5(1+2.5t+(2.5t)22!+⋯ )\text{G}_X(t) = e^{2.5(t - 1)} = e^{-2.5}e^{2.5t} = e^{-2.5}\left(1 + 2.5t + \frac{(2.5t)^2}{2!} + \cdots\right), so P(X=2)=e−2.52.522!\text{P}(X = 2) = \frac{e^{-2.5}2.5^2}{2!}.

Use the binomial expansion, the expansion of exe^x and geometric series: the same tools as for Maclaurin series.

The standard generating functions

These are in the formula booklet, but you need to be able to derive them. Let q=1−pq = 1 - p.

  • Binomial B(n,p)\text{B}(n, p): G(t)=(q+pt)n\text{G}(t) = (q + pt)^n.
  • Poisson Po(λ)\text{Po}(\lambda): G(t)=eλ(t−1)\text{G}(t) = e^{\lambda(t - 1)}.
  • Geometric Geo(p)\text{Geo}(p): G(t)=pt1−qt\text{G}(t) = \frac{pt}{1 - qt}, for ∣t∣<1q|t| < \frac{1}{q}.
  • Negative binomial NB(r,p)\text{NB}(r, p): G(t)=(pt1−qt)r\text{G}(t) = \left(\frac{pt}{1 - qt}\right)^r, for ∣t∣<1q|t| < \frac{1}{q}.

Deriving them

Binomial. ∑x=0n(nx)pxqn−xtx=∑x=0n(nx)(pt)xqn−x=(q+pt)n\sum_{x=0}^{n}\binom{n}{x}p^xq^{n-x}t^x = \sum_{x=0}^{n}\binom{n}{x}(pt)^xq^{n-x} = (q + pt)^n by the binomial theorem.

Poisson. ∑x=0∞e−λλxx!tx=e−λ∑x=0∞(λt)xx!=e−λeλt=eλ(t−1)\sum_{x=0}^{\infty}\frac{e^{-\lambda}\lambda^x}{x!}t^x = e^{-\lambda}\sum_{x=0}^{\infty}\frac{(\lambda t)^x}{x!} = e^{-\lambda}e^{\lambda t} = e^{\lambda(t - 1)}.

Geometric. ∑x=1∞pqx−1tx=pt(1+qt+(qt)2+⋯ )\sum_{x=1}^{\infty}pq^{x-1}t^x = pt\left(1 + qt + (qt)^2 + \cdots\right), a geometric series with sum pt1−qt\frac{pt}{1 - qt}, which converges when ∣qt∣<1|qt| < 1.

Negative binomial. An NB(r,p)\text{NB}(r, p) variable is the sum of rr independent Geo(p)\text{Geo}(p) variables (the waits for each success in turn), so its PGF is the geometric one raised to the power rr, by the product rule for sums in the next lesson.

Recognising distributions

Because a PGF determines the distribution, you can identify a distribution from its PGF:

  • (0.3+0.7t)6(0.3 + 0.7t)^6 is B(6,0.7)\text{B}(6, 0.7);
  • e4t−4e^{4t - 4} is Po(4)\text{Po}(4);
  • t3−2t=13t1−23t\frac{t}{3 - 2t} = \frac{\frac{1}{3}t}{1 - \frac{2}{3}t} is Geo(13)\text{Geo}\left(\frac{1}{3}\right).

Rearranging into the standard form (dividing top and bottom by a constant, as in the last example) is often the key step.

Practise this topic

Both are part of Premium.