Home › Probability › Lesson 11

Markov Chains

Lesson 11 of 12

Key idea of this section

P(Xₙ₊₁ = j | X₀, …, Xₙ) = p(Xₙ, j);   πP = π;   for an irreducible, aperiodic,
positive recurrent chain,  Pⁿ(i, j) → π(j) = 1/Ej[Tj]  for all i, j.

Definitions

Let S be a finite or countable state space. A stochastic matrix P = (p(i, j)) has nonnegative entries and rows summing to 1. A sequence X₀, X₁, … is a Markov chain with transition matrix P if

P(Xₙ₊₁ = j | X₀ = i₀, …, Xₙ₋₁ = iₙ₋₁, Xₙ = i) = p(i, j)

whenever the conditioning event has positive probability. The future depends on the past only through the present. Summing over intermediate states gives the Chapman–Kolmogorov equations Pᵐ⁺ⁿ = PᵐPⁿ, so the n-step transition probabilities are the entries of the matrix power Pⁿ, and if X₀ has law λ (a row vector) then Xₙ has law λPⁿ. The strong Markov property states that, at any stopping time T with XT = i, the process (XT+n) is again a Markov chain started from i, independent of the past before T.

Classification of states

State j is accessible from i if Pⁿ(i, j) > 0 for some n ≥ 0; i and j communicate if each is accessible from the other. Communication is an equivalence relation, and the chain is irreducible if there is only one class. The period of i is d(i) = gcd{n ≥ 1 : Pⁿ(i, i) > 0}; it is a class property, and the chain is aperiodic if d = 1 (for instance, if some p(i, i) > 0 in an irreducible chain).

Let Tᵢ = inf{n ≥ 1 : Xₙ = i} be the first return time. State i is recurrent if Pᵢ(Tᵢ < ∞) = 1 and transient otherwise. By the strong Markov property the number of visits Vᵢ to i is geometric when i is transient, and infinite a.s. when i is recurrent, so

i is recurrent  ⇔  Eᵢ Vᵢ = ∑ₙ Pⁿ(i, i) = ∞

A recurrent state is positive recurrent if Eᵢ Tᵢ < ∞ and null recurrent otherwise. Recurrence and positive recurrence are class properties. In a finite irreducible chain every state is positive recurrent.

Theorem 11.1 (Pólya, 1921). The simple symmetric random walk on ℤᵈ is recurrent for d = 1 and d = 2 and transient for d ≥ 3.

Proof for d = 1 and a sketch for d ≥ 2. Returns occur only at even times, and P²ⁿ(0, 0) = C(2n, n) 2⁻²ⁿ ∼ 1/√(πn) by Stirling's formula. The series ∑ n−1/2 diverges, so the walk is recurrent. In dimension d the return probability at time 2n is of order n−d/2 (for d = 2 it is exactly [C(2n, n) 2⁻²ⁿ]², because the walk rotated by 45° splits into two independent one-dimensional walks), and ∑ n−d/2 converges precisely when d ≥ 3. ∎

In three dimensions the probability of ever returning to the origin is approximately 0.3405. Kakutani's quip summarises the theorem: a drunk man will find his way home, but a drunk bird may get lost forever.

Stationary distributions

A probability vector π is stationary if πP = π: if X₀ has law π, so does every Xₙ.

Theorem 11.2. An irreducible chain has a stationary distribution if and only if it is positive recurrent. The stationary distribution is then unique and given by π(j) = 1/Ej Tj.

The construction behind the theorem: fix a state k and let μ(j) be the expected number of visits to j during an excursion from k, that is, before Tₖ. Then μ is invariant (μP = μ), μ(k) = 1 and ∑ⱼ μ(j) = Eₖ Tₖ; normalising gives π(k) = 1/Eₖ Tₖ.

A useful sufficient condition is detailed balance: if π(i) p(i, j) = π(j) p(j, i) for all i, j, then summing over i gives πP = π. Such chains are reversible, since in equilibrium the process has the same law run forwards and backwards. For a random walk on a finite connected graph, moving to a uniformly random neighbour, π(v) = deg(v)/(2|E|) satisfies detailed balance.

Worked example 11.3. Consider the chain on {1, 2, 3} with

P = [ 1/2  1/2   0  ]
    [ 1/4  1/2  1/4 ]
    [  0   1/2  1/2 ]

Detailed balance gives π(1) · 1/2 = π(2) · 1/4 and π(2) · 1/4 = π(3) · 1/2, so π(2) = 2π(1) and π(3) = π(1). Normalising, π = (1/4, 1/2, 1/4). By Theorem 11.2 the mean return time to state 2 is 2 steps, and to state 1 it is 4 steps.

Convergence to equilibrium

Theorem 11.4 (convergence theorem). If the chain is irreducible, aperiodic and has stationary distribution π, then for every initial state i, ∑ⱼ |Pⁿ(i, j) − π(j)| → 0.

Proof by coupling (Doeblin, 1938). Run the chain X from i and an independent copy Y from π. Aperiodicity and irreducibility imply that the product chain (X, Y) is irreducible, and it has the stationary distribution π ⊗ π, so it is recurrent and the coupling time τ = inf{n : Xₙ = Yₙ} is finite a.s. After τ, let X follow Y; this does not change the law of X. Then for every set A of states, |P(Xₙ ∈ A) − π(A)| ≤ P(τ > n), which is the total variation bound ‖Pⁿ(i, ·) − π‖TV ≤ P(τ > n) → 0. ∎

Aperiodicity is necessary: the chain on {1, 2} that always switches state has π = (1/2, 1/2) but Pⁿ(1, 1) alternates between 0 and 1. For a finite chain the rate is governed by the eigenvalues of P: if all eigenvalues other than 1 have modulus at most λ* < 1, the distance decays like (λ*)ⁿ up to a polynomial factor. For the two-state chain with p(1, 2) = a and p(2, 1) = b (0 < a + b < 2),

π = ( b/(a + b),  a/(a + b) ),      Pⁿ(1, 1) = b/(a + b) + (a/(a + b)) (1 − a − b)ⁿ

The ergodic theorem completes the picture: for an irreducible positive recurrent chain and any bounded f, (1/n) ∑k<n f(Xₖ) → ∑ⱼ π(j) f(j) almost surely, whatever the initial state. Time averages equal space averages. This is the basis of Markov chain Monte Carlo: to sample from a complicated π (for example a posterior distribution), the Metropolis–Hastings algorithm builds a reversible chain with stationary law π and averages along its path. The study of how long such chains take to mix, including the cutoff phenomenon discovered by Diaconis and Shahshahani (seven riffle shuffles suffice to mix a 52-card deck, in the sense of Bayer and Diaconis, 1992), is an active research area.

Exercise

  • (a)
    For the two-state chain with a = 0.3 and b = 0.1, find π and P¹⁰(1, 1) to four decimal places.
  • (b)
    A random walk moves on the vertices of a star graph with one centre joined to 5 leaves. Find the stationary distribution and the mean return time to the centre. Is the chain aperiodic?
  • (c)
    Use Stirling's formula to estimate P²⁰⁰(0, 0) for the simple symmetric random walk on ℤ.
Show solution

Answers: (a) π = (0.25, 0.75); P¹⁰(1, 1) = 0.25 + 0.75 · 0.6¹⁰ ≈ 0.25 + 0.75 · 0.0060466 ≈ 0.2545. (b) The centre has degree 5 and each leaf degree 1, with 2|E| = 10, so π(centre) = 1/2 and π(leaf) = 1/10; the mean return time to the centre is 2. The chain has period 2 (it alternates between the centre and the leaves), so it is not aperiodic and Pⁿ does not converge. (c) n = 100: 1/√(100π) ≈ 0.0564 (the exact value C(200, 100)/2²⁰⁰ ≈ 0.0563).

V.3.1