Run a Markov chain for a long time and, for most chains, the distribution of the state stops changing: the chain forgets where it started. That limiting distribution is the stationary distribution, found by solving a small linear system, as in elimination.
Key idea
Why it works
Worked examples
Worked example: Two states
- $\pi P = \pi$, first entry: $\pi_1 = \frac{1}{2}\pi_1 + \frac{1}{4}\pi_2$, so $\frac{1}{2}\pi_1 = \frac{1}{4}\pi_2$: flow out of Sunny equals flow in.
- So $\pi_2 = 2\pi_1$. With $\pi_1 + \pi_2 = 1$: $\pi = \left(\frac{1}{3}, \frac{2}{3}\right)$.
Answer: $\frac{2}{3}$ of days are rainy in the long run.
Worked example: Three states
- Column A: $\pi_A = \frac{1}{4}\pi_B + \frac{1}{3}\pi_C$. Column B: $\pi_B = \frac{1}{2}\pi_A + \frac{1}{2}\pi_B + \frac{1}{3}\pi_C$.
- Drop the third equation (it follows from the others) and add $\pi_A + \pi_B + \pi_C = 1$. Solving: $\pi = \left(\frac{2}{9}, \frac{4}{9}, \frac{1}{3}\right)$.
- Check column C: $$\frac{1}{2} \cdot \frac{2}{9} + \frac{1}{4} \cdot \frac{4}{9} + \frac{1}{3} \cdot \frac{1}{3} = \frac{1}{9} + \frac{1}{9} + \frac{1}{9} = \frac{1}{3}$$ Mean return time to A: $\frac{9}{2}$ steps.
Answer: $\pi = \left(\frac{2}{9}, \frac{4}{9}, \frac{1}{3}\right)$; $\frac{9}{2}$ steps.
Worked example: A small queue
- Flow up across each gap equals flow down: $\frac{1}{3}\pi_0 = \frac{1}{2}\pi_1$ and $\frac{1}{3}\pi_1 = \frac{1}{2}\pi_2$.
- So $\pi \propto \left(1, \frac{2}{3}, \frac{4}{9}\right)$, with total $\frac{19}{9}$.
- $\pi = \left(\frac{9}{19}, \frac{6}{19}, \frac{4}{19}\right)$.
Answer: $\left(\frac{9}{19}, \frac{6}{19}, \frac{4}{19}\right)$
Common mistake