Markov Chains Cheat Sheet

Transition matrices, steady state distributions, absorbing states, PageRank algorithm, and Markov chain applications in data science.

Last Updated: May 1, 2025

Basics

ItemDescription
Markov Property: P(X_t+1 | X_t, X_t-1, ...) = P(X_t+1 | X_t)Future state depends only on current state, not history
State SpaceSet of all possible states — finite or countable
Transition Probability: p_ij = P(X_t+1 = j | X_t = i)Probability of moving from state i to state j in one step
Transition Matrix PSquare matrix where entry (i,j) = p_ij — rows sum to 1
n-Step Transition: P^(n)Probability after n steps — multiply matrix by itself n times
Chapman-Kolmogorov: P^(m+n) = P^(m) * P^(n)Multi-step transitions can be composed

Classification of States

ItemDescription
RecurrentProcess returns to state with probability 1 — visited infinitely often
TransientProcess eventually leaves and never returns — finite visits
AbsorbingOnce entered, cannot leave — p_ii = 1
PeriodicCan only return at multiples of period d (e.g., pendulum)
ErgodicAperiodic + positive recurrent — unique steady state exists
CommunicatingStates i and j reach each other — in the same class

Steady State

ItemDescription
pi = pi * P (pi is row vector)Steady state: probability distribution that doesn't change after transition
Solving: pi*(I - P + ones_matrix) = ones_vectorSolve linear system for pi (also pi is left eigenvector of P with eigenvalue 1)
Interpretation of pi_iLong-run proportion of time spent in state i
Convergence: P^n -> 1*pi as n -> infinityFor ergodic chains, n-step transitions converge to steady state
Existence ConditionFinite, irreducible, aperiodic chain has unique steady state
Mixing TimeHow long until distribution is close to steady state — key for MCMC

PageRank & Applications

ItemDescription
Random Surfer ModelPageRank: P = (1-d)/n * ones + d * A (where A is normalized adjacency)
Damping Factor d (typically 0.85)Probability surfer follows a link vs jumping randomly
Steady State = PageRank ScoresHigher score = more important page in the web graph
Markov Decision Processes (MDP)Add actions and rewards to Markov chains — foundation of RL
Hidden Markov Models (HMM)States are hidden — observed through emissions; Viterbi algorithm for decoding
Pro Tip: The Markov property means 'the future depends only on the present, not the past.' If your system has memory beyond the current state, use higher-order Markov chains instead.