Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Weather with a short memory
Suppose tomorrow’s weather depends only on today’s: after a sunny day there’s a 90% chance of sun, after a rainy day a 50% chance. You don’t need to remember last week, only today. A process like this, hopping between states with probabilities that depend only on where it is now, is a Markov chain.
Run it for a long time and something remarkable happens: the fraction of sunny days settles to a fixed number, whatever the weather was on day one. The chain forgets where it started.
A rover’s terrain type, a machine’s health state (OK / degraded / failed), a user’s next click, a robot’s next grid cell. All are modelled as Markov chains. Reinforcement learning, speech recognition, Google’s PageRank and the MCMC samplers behind Bayesian inference are all Markov chains underneath.
- 1. In a Markov chain, the next state depends on…
- 2. After a long time, the fraction of time in each state…
- 3. Does the long-run fraction depend on the starting state (for a well-connected chain)?
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Transition matrices
A chain on states is defined by . Each row is a probability distribution, so and . This is a stochastic matrix.
- Distributions move by right-multiplication: if is the row vector of , then and .
- Chapman–Kolmogorov: , so is the -step transition probability.
Stationary distributions
is stationary if : start there and you stay there in distribution. It’s a left eigenvector with eigenvalue 1. For two states with , .
- 1. Each row of a transition matrix sums to…
- 2. The distribution after t steps is…
- 3. For a = 0.3, b = 0.1, π equals…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.When does the chain forget its start?
- Irreducible: every state can reach every other.
- Aperiodic: returns to a state aren’t forced onto a fixed rhythm. For example, a chain that alternates 1, 2, 1, 2 has period 2. A self-loop () is enough to break periodicity.
Convergence theorem. A finite, irreducible, aperiodic chain has a unique with all , and for every . The error shrinks geometrically, roughly like , where is the second-largest eigenvalue in modulus. The spectral gap sets the mixing speed.
Ergodic theorem. For an irreducible chain, the fraction of time spent in state converges a.s. to , and . This is the law of large numbers for dependent samples (A4.3-4).
Absorbing chains
If some states are absorbing (), order the states transient first: . The fundamental matrix gives the expected visits. The expected time to absorption is , and the absorption probabilities are . That answers “how long until the rover reaches the dock, and how likely is it to fall off the cliff first?”
- 1. Mixing speed is governed by…
- 2. A chain alternating 1 → 2 → 1 → 2 is…
- 3. The expected time to absorption is…
Level 3: Advanced
★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.Why the convergence theorem holds (coupling sketch)
Run two copies of the chain: started at and started at , independently until they first meet, then together.
- Coupling inequality. Since for all , , where is the meeting time.
- The meeting time is finite. Irreducibility and aperiodicity give some with for all . So in every block of steps the copies meet with probability at least .
- Geometric decay. Hence . ∎
Detailed balance and reversibility
If for all (detailed balance), then summing over gives . Such chains are reversible: run backwards they look the same. Birth–death chains always are, which gives .
Metropolis–Hastings builds a reversible chain for any target : propose from , then accept with probability . Only ratios of are needed, so normalizing constants cancel. That’s why MCMC can sample posteriors (Metropolis et al., 1953; Hastings, 1970).
Exercise 3.1: Show that detailed balance implies stationarity
.
- 1. The coupling inequality bounds TV distance by…
- 2. Metropolis–Hastings needs π only up to…
- 3. Detailed balance means…
Level 4: Expert
★★★★★ Expert⏱ 45 minResearchers: original papers and open problems.Sampling a multimodal belief with MCMC
A robot’s belief over 40 corridor cells has two bumps: it’s probably near cell 10 or cell 28. A lazy random-walk Metropolis chain samples it exactly in the long run, by detailed balance. But the low-probability valley between the bumps acts as a bottleneck. The chain takes about 7× longer to mix than on a flat target. That’s the central practical problem of MCMC (and of exploration in RL), and the motivation for tempering, Hamiltonian Monte Carlo and teleporting moves. Google’s PageRank is the stationary distribution of a “random surfer” chain made irreducible and fast-mixing by teleporting with probability 0.15 (Brin and Page, 1998).
Markov chains in AI, robotics and aerospace
- MDPs and RL. A policy turns an MDP into a Markov chain. Its stationary distribution weights the average-reward objective and on-policy learning (Puterman, 1994; Sutton and Barto, 2018).
- Hidden Markov models. The state is a Markov chain observed through noise. The forward algorithm and Viterbi decoding power speech recognition, gesture recognition and terrain classification (Rabiner, 1989).
- Reliability and health management. Degradation is modelled as chains OK → degraded → failed, with absorbing failure states. The fundamental matrix gives the mean time to failure for spacecraft subsystems.
- MCMC for Bayesian inference (Gelman et al., 2013). Convergence diagnostics such as R-hat and effective sample size exist because mixing can be slow.
- Multi-model filters (IMM) model the switching between motion regimes as a Markov chain (Blom and Bar-Shalom, 1988; A4.2-6).
References
- D. Levin, Y. Peres (2017). Markov Chains and Mixing Times, 2nd ed. AMS.
- J. Norris (1997). Markov Chains. Cambridge University Press.
- A. A. Markov (1906). “Extension of the law of large numbers to dependent quantities.” Izv. Fiz.-Matem. Obsch. Kazan Univ., 15.
- N. Metropolis, A. Rosenbluth, M. Rosenbluth, A. Teller, E. Teller (1953). “Equation of state calculations by fast computing machines.” Journal of Chemical Physics, 21(6).
- W. K. Hastings (1970). “Monte Carlo sampling methods using Markov chains and their applications.” Biometrika, 57(1).
- S. Brin, L. Page (1998). “The anatomy of a large-scale hypertextual web search engine.” Computer Networks, 30.
- L. Rabiner (1989). “A tutorial on hidden Markov models and selected applications in speech recognition.” Proceedings of the IEEE, 77(2).
- M. Puterman (1994). Markov Decision Processes. Wiley.
- A. Gelman et al. (2013). Bayesian Data Analysis, 3rd ed. CRC Press.
- J. Kemeny, J. L. Snell (1976). Finite Markov Chains. Springer.