24 min total

Probability

Markov chains

Markov chains

A Markov chain models movement between states. Given the present state, its next-step distribution does not need the rest of the past. The observations over time are usually dependent.

The transition matrix

For a time-homogeneous chain, define . Every entry is nonnegative and every row sums to one. With row-vector state probabilities :

Recurrence, communication, and periodicity

  • A state is recurrent if, starting there, the probability of eventually returning is one. It is transient if that return probability is less than one.
  • A chain is irreducible if every state can eventually reach every other state. All states in a finite irreducible chain are recurrent.
  • A state’s period is the greatest common divisor of its possible positive return times. Period one is aperiodic. In an irreducible chain all states have the same period.

Stationary does not automatically mean convergent

A stationary distribution remains unchanged after one step. A finite irreducible chain has a unique stationary distribution. Aperiodicity is additionally needed for the state distribution to converge to it from every initial distribution.

A two-state chain that deterministically alternates is the simplest warning: it has stationary probabilities one half and one half, but starting at one state makes its distribution alternate forever. Long-run time averages and convergence of the distribution at a particular time are different statements.

Two-state example

At stationarity, the probability flow from the first state to the second matches the reverse flow. Solving that balance together with normalization gives:

With and , the stationary probabilities are and . For a finite irreducible chain, the expected positive return time to state , starting at , is . The second state therefore has expected return time four steps.

Detailed balance and random walks

These detailed-balance equations are sufficient for stationarity and define reversibility with respect to the distribution. They are often easier to solve than the full stationary equations.

For a simple random walk on a finite connected undirected graph, choose the next vertex uniformly from the current vertex’s neighbors. Its stationary probability is proportional to vertex degree.

For example, connect A–B, B–C, C–A, and C–D. The adjacency list describes the whole graph without a diagram:

VertexNeighborsDegreeStationary probability
AB, C21/4
BA, C21/4
CA, B, D33/8
DC11/8

The triangle allows returns of lengths two and three, so this connected walk is aperiodic. On a connected bipartite graph, the ordinary walk has period two. Making the walk lazy—stay put with probability one half, otherwise take an ordinary step—removes that periodicity while preserving the stationary distribution.