On this page
A Markov chain moves between states with fixed probabilities that depend only on where it is now, not on how it got there. Grinstead and Snell's free textbook Introduction to Probability dates the idea to 1907, when A. A. Markov began studying such processes. Its stationary distribution tells you the long-run share of time in each state.
What is a stationary distribution of a Markov chain?
In the transition matrix P, row i, column j is the probability of moving from state i to state j, so every row adds up to 1. A stationary distribution is a row vector π of probabilities, adding up to 1, with πP = π. Grinstead and Snell call it the fixed row vector and point out that it is a left eigenvector of P for the eigenvalue 1 (textbook, section 11.3). If today is drawn from π, so is tomorrow.
How do you find the stationary distribution by hand?
Take the Land of Oz chain, Example 11.1 in Grinstead and Snell: never two nice days in a row; after a nice day, rain and snow are equally likely; after rain or snow, the weather repeats half the time, and a change is to nice half the time. With states in the order Rain, Nice, Snow, the rows of P are:
Rain: 1/2, 1/4, 1/4
Nice: 1/2, 0, 1/2
Snow: 1/4, 1/4, 1/2
Write one equation per column of πP = π. Nice: πN = (1/4)πR + (1/4)πS. Rain: (1/2)πR = (1/2)πN + (1/4)πS.
Drop one column equation; because rows of P add up to 1, one is always redundant.
Set πR = 1 for now, as the textbook does. Then πN = 1/4 + πS/4 and 2 = 2πN + πS, which give πS = 1 and πN = 1/2.
Divide (1, 1/2, 1) by its sum, 5/2, to get π = (0.4, 0.2, 0.4).
Check with the dropped Snow column: (1/4)(0.4) + (1/2)(0.2) + (1/2)(0.4) = 0.4.
The textbook confirms it: the sixth power of P has every row equal to (.4, .2, .4) to three decimal places (Example 11.18), and a simulated run of 10,000 Oz days spent fractions .401, .19 and .409 of the time in rain, nice and snow (Example 11.21, Grinstead and Snell).
Why does the chain converge to π from any start?
Grinstead and Snell call a chain regular if some power of P has only positive entries. Their Theorem 11.7 says that for a regular chain, Pⁿ approaches a matrix whose rows all equal π, and Theorem 11.9 says the distribution after n steps tends to π whatever the starting distribution (textbook, section 11.3). Oz's P has a zero, but P² has none.
An irreducible (every state reachable) and aperiodic (no forced rhythm) finite chain always qualifies, by Proposition 1.7 of Markov Chains and Mixing Times.
P has trace 1 and determinant −1/16, so its eigenvalues are 1, 1/4 and −1/4. From rain, the chance of rain on day n is exactly 0.4 + 0.5(1/4)ⁿ + 0.1(−1/4)ⁿ: 1, 0.5, 0.4375, 0.40625, 0.4023 on days 0 to 4. The gap from 0.4 shrinks sixteenfold every two days. Our posts on finding large powers of a matrix by diagonalisation and the Perron–Frobenius theorem for positive matrices show why the largest eigenvalue wins.
What is detailed balance, and when does it save time?
If πi pij = πj pji for every pair of states, π is stationary: add both sides over i, and the right side becomes πj times a row sum of P, which is πj. Such a chain is called reversible.
For Oz, rain and nice give πR/4 = πN/2, so πR = 2πN. Nice and snow: πN/2 = πS/4, so πS = 2πN. Rain and snow: πR/4 = πS/4, which agrees. So π is proportional to (2, 1, 2), giving (0.4, 0.2, 0.4) again.
The shortcut can fail. Put three states in a circle, stepping clockwise with probability 2/3 and anticlockwise with 1/3. Columns of P also add up to 1, so π = (1/3, 1/3, 1/3), yet (1/3)(2/3) ≠ (1/3)(1/3) (Example 1.22 in the same book). When pair equations contradict, go back to πP = π.
Why does a periodic chain never settle?
Grinstead and Snell's Example 11.16 has two states that swap every step: P has rows (0, 1) and (1, 0). π = (1/2, 1/2) satisfies πP = π, yet a chain started in state 1 is there with probability 1, 0, 1, 0 forever. Every state reaches every other, but every power of P has zeros (textbook, section 11.3).
Still, by Theorems 11.11 and 11.12, the long-run fraction of time in each state tends to π. And the lazy chain (1/2)(I + P) is regular with the same π (proof of Theorem 11.10).
If eigenvectors are the weak link, the Fermi Concept Library gives each mathematics concept its own lesson. For practice, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning. To revise the 2×2 case first, read what the eigenvalues of a 2×2 matrix mean.



