Computing Library › Probability Statistics
Probability Statistics

Stationary Distributions

A stationary distribution is a state distribution that a Markov chain leaves unchanged, and often the limit it converges to.

Definition

A distribution π over states is stationary for a chain with transition matrix P if π = πP. If the chain starts in π it stays in π forever: the fraction of probability entering each state equals the fraction leaving. It is the balance point of the dynamics.

Existence and uniqueness

Kronos motion — state estimation

Every finite Markov chain has at least one stationary distribution. If the chain is irreducible (all states communicate) the stationary distribution is unique, and if it is also aperiodic the chain converges to π from any starting distribution. These conditions are what make long-run predictions well defined.

Detailed balance

A stronger, easily checked condition is detailed balance: π_i P[i][j] = π_j P[j][i] for all states. A chain satisfying it is called reversible, and detailed balance guarantees π is stationary. This is precisely the condition Metropolis-Hastings enforces to sample from a target distribution.

Finding it

The stationary distribution is the left eigenvector of P with eigenvalue 1, normalized to sum to one. For small chains you solve π = πP with Σ π_i = 1 directly; for large ones you iterate the chain until the distribution stops changing.

python
# power iteration for a 2-state chain
P = [[0.9,0.1],[0.5,0.5]]
pi = [0.5,0.5]
for _ in range(100):
    pi = [pi[0]*P[0][0]+pi[1]*P[1][0], pi[0]*P[0][1]+pi[1]*P[1][1]]
print([round(v,4) for v in pi])  # ~[0.8333, 0.1667]

Why it matters

Stationary distributions give the long-run fraction of time spent in each state, which answers steady-state questions in queueing and reliability. In MCMC the whole method is designed backward from this idea: build a chain whose stationary distribution is the one you want to sample.