TExcelTAD
Home › Probability Theory › Branching Processes

Branching Processes

Each individual in a population has a random number of children, independently, with the same distribution. Will the family line survive forever or die out? This model, the Galton–Watson branching process, was invented to study the extinction of surnames. It also describes chain reactions, epidemics, viral sharing and the growth of search trees, and generating functions solve it elegantly.

The model

Start with one individual (generation 0). Each individual has kk children with probability pkp_k, independently. Let ZnZ_n be the size of generation nn and m=∑kkpkm = \sum_k k p_k the mean number of children. By Wald's identity, E[Zn+1]=m E[Zn]E[Z_{n+1}] = m\,E[Z_n], so

E[Zn]=mnE[Z_n] = m^n

The population grows on average if m>1m > 1 (supercritical), shrinks if m<1m < 1 (subcritical), and stays level on average if m=1m = 1 (critical).

Extinction probability

Let G(s)=∑kpkskG(s) = \sum_k p_k s^k be the offspring PGF. Generation sizes have PGFs that are iterates of GG: GZn=G∘G∘⋯∘GG_{Z_n} = G \circ G \circ \cdots \circ G (random sums). The extinction probability dd is the probability that some generation is empty, and it satisfies

d=G(d)d = G(d)

because the line dies out exactly when each of the first individual's children starts a line that dies out. The answer is the smallest root of s=G(s)s = G(s) in [0,1][0, 1]. If m≤1m \le 1, that root is 1: extinction is certain (except in the trivial case p1=1p_1 = 1). If m>1m > 1, there is a root d<1d < 1, and the line survives forever with probability 1−d1 - d.

python · try it yourself
from sympy import symbols, Rational, solve, nsimplify

s = symbols("s")
# offspring: 0, 1, 2 children with probabilities 1/4, 1/4, 1/2  (m = 1.25)
G = Rational(1, 4) + Rational(1, 4) * s + Rational(1, 2) * s ** 2
roots = solve(G - s, s)
print("roots of G(s) = s:", roots, " extinction probability:", min(r for r in roots if 0 <= r <= 1))

# iterate d_{n+1} = G(d_n): probability of extinction by generation n
d = 0.0
Gf = lambda x: 0.25 + 0.25 * x + 0.5 * x * x
for n in range(1, 31):
    d = Gf(d)
    if n in (1, 2, 5, 10, 30):
        print(f"P(extinct by generation {n:2d}) = {d:.5f}")
roots of G(s) = s: [1/2, 1]  extinction probability: 1/2
P(extinct by generation  1) = 0.25000
P(extinct by generation  2) = 0.34375
P(extinct by generation  5) = 0.44776
P(extinct by generation 10) = 0.48882
P(extinct by generation 30) = 0.49997

The iteration dn+1=G(dn)d_{n+1} = G(d_n) starting from d0=0d_0 = 0 gives the probability of extinction by generation nn, increasing to the smallest fixed point.

Simulation

python · try it yourself
import random

rng = random.Random(4)
def offspring():
    u = rng.random()
    return 0 if u < 0.25 else (1 if u < 0.5 else 2)

def dies_out(max_gen=60, cap=2000):
    z = 1
    for _ in range(max_gen):
        if z == 0:
            return True
        if z > cap:                       # so large that extinction is practically impossible
            return False
        z = sum(offspring() for _ in range(z))
    return z == 0

runs = 5000
print("simulated extinction probability:", sum(dies_out() for _ in range(runs)) / runs, " theory 0.5")
simulated extinction probability: 0.4972  theory 0.5

The critical case

With m=1m = 1, extinction is certain, yet the expected generation size stays 1 forever. The two facts are reconciled by rare huge families: most lines die quickly, a few grow large. The probability of surviving to generation nn decays only like 2σ2n\frac{2}{\sigma^2 n} (Kolmogorov's estimate), where σ2\sigma^2 is the offspring variance.

Epidemics and R0R_0

In an early epidemic, each infected person infects a random number of others, with mean R0R_0. A branching process predicts that an outbreak started by one case dies out with probability dd, the root of d=G(d)d = G(d). With Poisson(R0R_0) offspring, G(s)=eR0(s−1)G(s) = e^{R_0(s-1)}; for R0=2R_0 = 2, d≈0.203d \approx 0.203. So even a fairly contagious disease fizzles out about 20% of the time when introduced once, and reducing R0R_0 below 1 guarantees extinction.

In software

Branching processes model viral content spread (each share triggers a random number of reshares), cascading failures, and the size of search trees in backtracking algorithms. The critical case explains why "every request spawns on average one retry" is dangerous: the expected load is stable, but rare cascades are huge.

Exercises

Exercise 1: Mean generation size

Each individual has 0 or 3 children with probabilities 1/21/2 and 1/21/2. What is E[Z4]E[Z_4]?

Answer

1.54≈5.061.5^4 \approx 5.06.

Solution

m=3/2m = 3/2 and E[Zn]=mnE[Z_n] = m^n.

Exercise 2: Extinction

For the offspring distribution of Exercise 1, find the extinction probability.

Answer

5−12≈0.618\frac{\sqrt{5} - 1}{2} \approx 0.618.

Solution

G(s)=12+12s3G(s) = \frac{1}{2} + \frac{1}{2}s^3. Solve s3−2s+1=0s^3 - 2s + 1 = 0: (s−1)(s2+s−1)=0(s - 1)(s^2 + s - 1) = 0, with roots 11 and −1±52\frac{-1 \pm \sqrt{5}}{2}. The smallest root in [0,1][0, 1] is 5−12\frac{\sqrt{5} - 1}{2}.

Exercise 3: Epidemic extinction (code)

Solve d=eR0(d−1)d = e^{R_0(d - 1)} by iteration for R0=1.2,1.5,2,3R_0 = 1.2, 1.5, 2, 3.

Answer

About 0.686, 0.417, 0.203 and 0.060.

Solution
python · try it yourself
import math

for R0 in [1.2, 1.5, 2, 3]:
    d = 0.0
    for _ in range(2000):
        d = math.exp(R0 * (d - 1))
    print(R0, round(d, 3))
1.2 0.686
1.5 0.417
2 0.203
3 0.06

Test yourself

If the mean number of offspring is m=0.9m = 0.9, the probability of eventual extinction is…

  1. 0.9
  2. 0.1
  3. 1
  4. 0.5

The extinction probability is the smallest root in [0,1][0, 1] of…

  1. G(s)=0G(s) = 0
  2. G(s)=sG(s) = s
  3. G′(s)=1G'(s) = 1
  4. G(s)=1G(s) = 1