Birth–Death Lab

Birth–Death Lab

CSM §6.4. A birth–death process moves from state j to j+1 at rate λj and to j−1 at rate μj. It stays in j for an exponential time with rate λj+μj.

How it works and what to try

How it works: In two tabs. (1) Finite chain: set λj and μj for up to ten states, or pick a preset (the book’s Example 6.18, M/M/1/K, an M/M/∞-style chain, or a bottleneck). The page draws the state-transition-rate diagram, simulates a sample path, and compares the time spent in each state with the stationary distribution π*j = π*0 ∏ λi/μi+1. (2) Semi-infinite chain: with the same λ and μ in every state (the M/M/1 queue), run several sample paths from one starting state, and watch the whole distribution π(t) evolve as a heat map, with E[N(t)] and π0(t) settling to ρ/(1 − ρ) and 1 − ρ.

Try this: On the finite chain, lengthen the horizon until the time fractions match π*. Set one λj to 0 and see the chain become reducible. On the semi-infinite chain, push ρ = λ/μ towards 1 and then past it: the paths stop forgetting where they started, E[N(t)] grows without bound, and the stationary distribution disappears.

Section, example and equation numbers refer to Chapter 6 of S. Keshav, Mathematical Foundations of Computer Networking, Addison-Wesley, 2012.

Chain

Rates (per unit time)

jλj (up)μj (down)

Simulation

Edit any rate and the diagram, the stationary distribution and the trajectory update. New trajectory advances the seed, so a seed always reproduces the same sample path.

State-transition-rate diagram

Arcs to the right carry λj; arcs to the left carry μj. Read the Q matrix off this picture.

A typical trajectory

One sample path X(t), simulated jump by jump: wait Exp(λj+μj), then go up with probability λj/(λj+μj).

▼birth (marks the new, higher state)▲death (marks the new, lower state)

Time average vs. π*

Fraction of this path's time spent in each state, against the stationary distribution from Eq. 6.29–6.30. Lengthen T and watch them agree.

time fraction on this pathπ*j

Numbers

π*j = π*0 ∏i<j λi/μi+1. Time fraction is from the current sample path.