MATH 4810Computational Modelling

Module 05 · Unit 5.1 · Lesson 2 of 3

Multi-Step and Steady-State Behaviour

Markov chains have both short-run and long-run behaviour. The n-step transition matrix describes the former; the stationary distribution describes the latter.

Duration ≈ 3 hours Prerequisite Lesson 1 Feeds Lab 9 · Assignment 5
  1. Lesson 1
  2. Lesson 2
  3. Lesson 3

1 Modelling context

Lesson 1 developed the one-step specification of a Markov chain. In applications, however, the questions of interest are usually about multiple steps: what is the probability of being in a given state after n steps, and what does the chain look like in the long run?

This lesson develops the n-step transition matrix via the Chapman–Kolmogorov equations, and the stationary distribution that describes the chain's long-run behaviour. Both are computed from the one-step transition matrix, so the specification work of Lesson 1 is the foundation for everything in this lesson.

Short run and long run are different questions

The stationary distribution describes the chain's behaviour in the infinite-time limit. It does not describe the chain's behaviour over a finite horizon, which may differ substantially. For decision-making, it is important to know which question the model is being used to answer.

2 Learning objectives

By the end of this lesson you will be able to

  • State and apply the Chapman–Kolmogorov equations.
  • Compute the n-step transition matrix as P^n.
  • Compute the stationary distribution of a Markov chain.
  • Interpret the stationary distribution in terms of long-run proportions of time.
  • Identify when the stationary distribution does not describe short-run behaviour.
  • Recognise the conditions (irreducibility, aperiodicity) under which the stationary distribution is unique.

3 Prerequisite review

Matrix powers
For a square matrix P, the power P^n is the product of n copies of P. Computed iteratively or by diagonalization.
Eigenvalues and eigenvectors
A nonzero vector v with P v = λ v is an eigenvector of P with eigenvalue λ. The stationary distribution is related to the left eigenvector with eigenvalue 1.
Law of total probability
P(A) = Σ_i P(A | B_i) P(B_i) for a partition {B_i}. Used to derive the Chapman–Kolmogorov equations.
Convergence
The property that P^n tends to a limit as n → ∞. Guaranteed under irreducibility and aperiodicity.

4 Mathematical formulation

The Chapman–Kolmogorov equations

Let P_ij^(n) denote the probability of being in state j after n steps, starting from state i. The Chapman–Kolmogorov equations express the n-step probabilities in terms of intermediate steps:

P_ij^(n+m) = Σ_k P_ik^(n) P_kj^(m)

In matrix form, this says that the n-step transition matrix is P^n. So

P^(n) = P^n  (matrix power)

The n-step state distribution from an initial distribution π^(0) is therefore

π^(n) = π^(0) P^n

The stationary distribution

The stationary distribution of a Markov chain is a probability distribution π* that satisfies

π* P = π*

Equivalently, π* is a left eigenvector of P with eigenvalue 1, normalised to sum to 1. If the chain starts in its stationary distribution, the distribution does not change: π^(0) = π* implies π^(t) = π* for all t ≥ 0.

Existence and uniqueness

For a finite-state Markov chain, the existence of a stationary distribution is guaranteed. Uniqueness requires additional conditions:

  • Irreducibility. Every state is reachable from every other state. If the chain has multiple closed communicating classes, the stationary distribution is not unique.
  • Positive recurrence. Every state is visited infinitely often with probability 1. For finite irreducible chains, this is automatic.

For an irreducible, aperiodic chain with n states:

lim_{t→∞} P^t = [ 1 ; 1 ; … ; 1 ] π*

In words: the rows of P^t all converge to the same distribution π*, regardless of the starting state.

Solving for the stationary distribution

The stationary distribution satisfies the linear system

π* P = π*
Σ_i π*_i = 1

Rearranged, this is

π* ( P − I ) = 0
Σ_i π*_i = 1

This is a linear system in the n unknown components of π*. Since the rows of P sum to 1, the matrix P − I is singular, so the n equations are not independent. The normalisation condition Σ π*_i = 1 supplies the additional constraint.

A standard approach is to drop one of the n equations from π* (P − I) = 0, replace it with the normalisation, and solve the resulting n × n system.

Long-run proportion of time

A useful interpretation: for an ergodic chain, the component π*_i equals the long-run proportion of time the chain spends in state i:

π*_i = lim_{T→∞} (1/T) Σ_{t=1}^T 1{X_t = i}

This is the ergodic theorem for Markov chains. It is the bridge between the theory of Markov chains and the empirical behaviour observed in simulation (Lesson 3).

Convergence of state distributions to the stationary distribution A line plot showing the probability of being in state A over time for three different initial distributions. All three curves converge to the same horizontal value, the stationary probability of state A, within about ten steps. t P(X_t = A) π*_A initial: state A initial: state C initial: state B
Figure 5.2. Convergence of the state probability P(X_t = A) to the stationary value π*_A, for three different starting states. The convergence is geometric; after a moderate number of steps, the initial condition is forgotten.

Stationary is not an absorbing state

The stationary distribution is a distribution over states, not a single absorbing state. Even when the chain is in its stationary distribution, individual transitions continue; only the overall distribution remains constant.

5 Worked example

The stationary distribution of the weather model

Return to the weather model from Lesson 1:

       S    C    R
S   [ 0.7  0.2  0.1 ]
C   [ 0.3  0.4  0.3 ]
R   [ 0.2  0.3  0.5 ]

Step 1 — Set up the system of equations.

The stationary distribution π* = (π_S, π_C, π_R) satisfies π* P = π*. Writing this out:

0.7 π_S + 0.3 π_C + 0.2 π_R = π_S    (1)
0.2 π_S + 0.4 π_C + 0.3 π_R = π_C    (2)
0.1 π_S + 0.3 π_C + 0.5 π_R = π_R    (3)

Rearranging equations (1)–(3):

−0.3 π_S + 0.3 π_C + 0.2 π_R = 0
 0.2 π_S − 0.6 π_C + 0.3 π_R = 0
 0.1 π_S + 0.3 π_C − 0.5 π_R = 0

Step 2 — Drop one equation and use normalisation.

The three equations are linearly dependent, so drop equation (3) and add the normalisation condition:

−0.3 π_S + 0.3 π_C + 0.2 π_R = 0    (1)
 0.2 π_S − 0.6 π_C + 0.3 π_R = 0    (2)
 π_S + π_C + π_R = 1                (N)

Step 3 — Solve.

From (N): π_R = 1 − π_S − π_C. Substituting into (1):

−0.3 π_S + 0.3 π_C + 0.2(1 − π_S − π_C) = 0
−0.5 π_S + 0.1 π_C + 0.2 = 0
−0.5 π_S + 0.1 π_C = −0.2
5 π_S − π_C = 2                (1')

Substituting into (2):

0.2 π_S − 0.6 π_C + 0.3(1 − π_S − π_C) = 0
−0.1 π_S − 0.9 π_C + 0.3 = 0
0.1 π_S + 0.9 π_C = 0.3
π_S + 9 π_C = 3                (2')

From (1'): π_C = 5 π_S − 2. Substituting into (2'):

π_S + 9(5 π_S − 2) = 3
π_S + 45 π_S − 18 = 3
46 π_S = 21
π_S ≈ 0.4565

Then π_C ≈ 5(0.4565) − 2 ≈ 0.2826 and π_R ≈ 1 − 0.4565 − 0.2826 ≈ 0.2609.

Step 4 — Verify.

π* P = (0.4565, 0.2826, 0.2609) P
     ≈ (0.4565, 0.2826, 0.2609) = π*  ✓

Step 5 — Interpretation.

In the long run, the chain spends approximately 45.7 percent of its days sunny, 28.3 percent cloudy, and 26.1 percent rainy — regardless of the initial weather. This does not mean that the distribution after 1 step matches this; it only describes the asymptotic behaviour.

6 Verification check

Checks to perform

  • Check π* P = π*. Compute the product directly and compare against π*. Any discrepancy indicates an error.
  • Check that components sum to 1. A valid distribution must satisfy Σ π*_i = 1.
  • Check nonnegativity. All components must be nonnegative. A negative component indicates an error in the solution.
  • Compare with iterated matrix powers. Iterate π^(t) = π^(0) P^t for large t and confirm it approaches π*, regardless of π^(0).
  • Check irreducibility and aperiodicity. For a finite irreducible chain, the stationary distribution is unique. Verify that the chain has these properties before relying on uniqueness.

7 Interpretation

The stationary distribution is the central quantity in Markov-chain analysis. Its main interpretations:

  • Long-run proportion of time. The component π*_i is the fraction of time the chain spends in state i over a long horizon.
  • Limiting distribution. For an irreducible, aperiodic chain, the distribution of X_t converges to π* as t → ∞, regardless of the starting distribution.
  • Left eigenvector with eigenvalue 1. The stationary distribution is the unique normalised left eigenvector of P corresponding to eigenvalue 1.

These three interpretations coincide for an ergodic chain. For non-ergodic chains they may differ, and the interpretation must be stated carefully.

Applications of the stationary distribution

In applications, the stationary distribution often has a natural interpretation. For a customer loyalty chain, it gives the long-run market shares. For a machine reliability chain, it gives the long-run fraction of time the machine is operational. For a queueing chain, it gives the long-run distribution of queue lengths.

8 Uncertainty and limitations

The stationary distribution carries the uncertainty of the transition matrix from which it was computed. Two sources are worth distinguishing.

Limitations of stationary analysis
Limitation Effect
Estimated transition probabilities The stationary distribution inherits the estimation uncertainty
Short horizons The stationary distribution may not describe finite-time behaviour
Non-ergodic chains The stationary distribution may not be unique, or may not be the limiting distribution
Time-inhomogeneous dynamics The stationary distribution is not defined if transitions change over time

Convergence may be slow

Even for an ergodic chain, convergence to the stationary distribution may be slow. The rate of convergence is governed by the second largest eigenvalue of P. If that eigenvalue is close to 1, the chain converges slowly, and the stationary distribution may not describe behaviour over any reasonable time horizon.

9 Common implementation errors

Watch for these

  • Forgetting the normalisation condition. The equation π* (P − I) = 0 has infinitely many solutions (all scalar multiples of π*). The normalisation Σ π*_i = 1 is required.
  • Using all n equations plus normalisation. The n equations from π* (P − I) = 0 are linearly dependent. Including all of them with the normalisation produces an over-determined system. Drop one equation.
  • Confusing P^n with element-wise powers. P^n is the matrix product of n copies of P, not the element-wise n-th power of each entry.
  • Assuming convergence for a periodic chain. For a periodic chain, P^n does not converge, though the stationary distribution still exists. The correct interpretation is the long-run proportion of time.
  • Assuming the stationary distribution describes short-run behaviour. A decision based on a short horizon should use the transient distribution, not the stationary one.
  • Not verifying irreducibility and aperiodicity. For non-ergodic chains, the stationary distribution may not be unique or may not be reached. Verify the conditions before interpreting.

10 Independent modelling task

Your turn

  1. Use the transition matrix from Lesson 1's modelling task.
  2. Compute P^2, P^5, and P^10 by repeated multiplication. Verify numerically that the rows of P^n become more similar as n grows.
  3. Solve for the stationary distribution by setting up the linear system π* (P − I) = 0 with the normalisation Σ π*_i = 1.
  4. Verify π* P = π* numerically.
  5. Start from three different initial distributions and compute π^(t) for t = 1, 2, 5, 10, 20. Plot the three trajectories for each state and confirm convergence to π*.
  6. Estimate the second-largest eigenvalue of P. How does it relate to the rate of convergence?

This exercise forms part of Laboratory 9 and the analysis component of Assignment 5.

11 Reflection prompt

Reflect before continuing

The stationary distribution describes long-run behaviour. Give an example of a decision where short-run behaviour matters more, and the stationary distribution would be misleading.

Two or three sentences. Consider settings where the chain is far from its stationary distribution over the relevant time horizon.

12 Lesson summary

Key takeaways

  • The n-step transition matrix is P^n. The n-step distribution from an initial distribution is π^(0) P^n.
  • The Chapman–Kolmogorov equations connect multi-step probabilities to one-step probabilities.
  • The stationary distribution satisfies π* P = π*. It is a normalised left eigenvector with eigenvalue 1.
  • For an ergodic chain, the stationary distribution is unique and describes the long-run proportion of time spent in each state.
  • Convergence to the stationary distribution depends on the second-largest eigenvalue. A slow convergence rate limits the usefulness of stationary analysis over finite horizons.

Coming next

Lesson 3 simulates the chain directly and compares empirical state frequencies against the theoretical distribution — a verification of the model and a first encounter with stochastic simulation.

§ Self-quiz, practice, and homework

Self-quiz

Q1

The Chapman–Kolmogorov equations state:

Show answer

P_ij^(n+m) = Σ_k P_ik^(n) P_kj^(m). Equivalently, P^(n) = P^n as a matrix product.

Q2

The stationary distribution satisfies:

Show answer

π* P = π*. Under the row-vector convention.

Q3

To compute the stationary distribution, one needs:

Show answer

The equations π* (P − I) = 0 and the normalisation Σ π*_i = 1. Drop one of the n equations to avoid over-determination.

Q4

The component π*_i equals:

Show answer

The long-run proportion of time spent in state i.

Q5

A Markov chain that is not irreducible:

Show answer

May have multiple stationary distributions. Irreducibility is required for uniqueness.

Practice exercises

  1. For the two-state chain with P_{on→off} = 0.1 and P_{off→on} = 0.3, find the stationary distribution by solving π* P = π* with π_on + π_off = 1.
  2. For the weather model, verify that the stationary distribution from the worked example satisfies π* P = π* numerically.
  3. Compute P^3 for the weather model. Compare the rows of P^3 against π*.
  4. For a chain that is periodic with period 2, explain in two sentences why P^n does not converge, but the stationary distribution still exists.

Homework problems

  1. Stationary analysis. Using the transition matrix from the Lesson 1 homework, solve for the stationary distribution. Verify π* P = π* numerically. Compute the second-largest eigenvalue of P and estimate the number of steps required for the chain to approach stationarity. Write a 500-word report.
  2. Convergence study. For your chain, compute π^(t) from three different initial distributions for t = 1, 2, 5, 10, 20, 50. Plot the trajectories and estimate the rate of convergence. Compare against the second-largest eigenvalue.
  3. Short-run vs. long-run. Identify a decision that depends on the state distribution after 3 steps rather than on the stationary distribution. Compute both and show that they differ substantially.

Mini project

Choose a Markov-chain model of your own. Compute the stationary distribution, its second-largest eigenvalue, and the convergence time. Interpret the stationary distribution in terms of the application. Write a two-page technical report and submit the spreadsheet. This is part of Laboratory 9 and Assignment 5.

👤