Hexa Scholar

Stationary distributions of Markov chains

A small red railcar on a track between a navy platform and a gold platform.
The two platforms stand for the states, and the railcar shows a move between them.

The question

Can you choose the switch probabilities so the chance of being at A never settles?

Start at A and build the transition matrix yourself.

  1. 1 SeeBuild a chain and test it.
  2. 2 TryPredict a limit, then change the matrix.
  3. 3 ProveBuild the convergence argument.
  4. 4 ApplySolve for probabilities and eigenvalues.
Before you start · 3 quick checks on probability, matrix products, and eigenvectors

Two ideas before you start

2 ideas

Read a row from the current state

The bars compare the chances of ending the next step at A and B, given the current state.

Start at

Select a starting state to read its row. One entry gives the chance of staying, and the other gives the chance of switching.

Exact definition

A transition matrix \(P\) has entry \(P_{ij}\) equal to the probability of moving to state \(j\) in one step when the current state is \(i\). Its entries are nonnegative and each row sums to one. We use a finite set of states and discrete steps. The current state determines the next-step probabilities, and the same matrix applies at each step.

List the probabilities of the current state in a row vector \(p\). The next distribution is \(pP\). Its entry for a destination \(j\) sums the incoming probability \(p_iP_{ij}\) over the possible origins \(i\).

Compare a distribution before and after a step

The bars compare the probability at A before and after one step in the same example chain.

Try both mixes. When the probability at A is unchanged, the probability at B is unchanged too.

Exact definition

A distribution \(\pi\) is stationary for \(P\) if \(\pi P=\pi\). It is a row of nonnegative entries whose sum is one. If you initialize the chain with \(\pi\), its distribution is \(\pi\) at every later step. An individual walker can still move.

This equation makes \(\pi\) a left eigenvector of \(P\) for eigenvalue \(1\). Equivalently, the column \(\pi^{\mathsf T}\) is a right eigenvector of \(P^{\mathsf T}\).

Notation for the two-state chain

Use \(a\) for the chance of a move from A to B and \(b\) for the chance of a move from B to A. Both lie in the closed interval from zero to one. In the matrix below, rows and columns are ordered A, B.

\[P=\begin{pmatrix}1-a&a\\ b&1-b\end{pmatrix}.\]

Write \(x_n\) for the chance of being at A after \(n\) steps. The row distribution is \((x_n,1-x_n)\). Starting at A means all the initial mass is at A. You can also start with a mixture, such as a population of walkers assigned to different initial states.

1 See

Build a chain that never settles from A

2 Try

Predict a limit, then change the matrix

Check your prediction to open the explorer.

3 Prove

Why the two-state probabilities settle

Theorem for two states

Use the fixed two-state matrix from Start, with \(0\le a,b\le 1\). Assume \(0\lt a+b\lt2\). Let \(x_0\) be any starting probability at A. There is a unique stationary distribution \(\pi=(x_*,1-x_*)\), where \(x_*=b/(a+b)\). The distributions from every start converge to \(\pi\).

To be at A next, the walker can stay at A or move in from B. Adding those two contributions gives

\[\begin{aligned} x_{n+1} &= (1-a)x_n \\ &\quad + b(1-x_n). \end{aligned}\]
4 Apply

Solve for stationary shares and limits

Enter a number in each box. Enter probabilities as decimals. Each problem lists the accepted absolute error and has hints and a worked solution.

Key point To find a fixed probability row, solve \(\pi P=\pi\) with entries that sum to one. To decide whether it describes the long run from a given start, study what repeated updates do to the difference from that row.
Level Intermediate Prerequisites Markov chains and eigenvectors Time About 30 min

Further reading