Contents / Probability / Markov Chains
Chapter 8
Markov Chains
The Markov property and transition matrices, Chapman-Kolmogorov, classification of states, stationary distributions and convergence, reversibility, absorption and hitting times.
Introduction
Most of this subject so far has been about a fixed collection of random variables: one draw, or independent draws, or a sum of them. A Markov chain is the first model in the course where the randomness unfolds, and where the interesting questions are about the long run rather than any single step.
What makes such a model tractable is a drastic simplification, worth stating up front so that you can judge it honestly: the present screens off the past. Given where the process is now, how it got there tells you nothing about where it goes next. That is false for many real systems, and this chapter says where it fails — though the repair is usually not to abandon the model but to enlarge the state until the assumption becomes true.
What the assumption buys is a great deal. The entire law of the process collapses into one matrix ; looking steps ahead becomes matrix multiplication, so the eigenvalue machinery of linear algebra transfers over intact and delivers not just the limit but the rate; long-run behaviour becomes the single equation ; and "how long until?" becomes a linear system you can solve by hand.
The chapter builds that machinery in order: the Markov property and the transition matrix, Chapman–Kolmogorov and matrix powers, a classification of states, stationary distributions, the convergence theorem and the exact hypothesis — aperiodicity — it cannot do without, reversibility, and finally the two computations that come up most in practice, absorption and hitting times, both worked end to end on gambler's ruin. Everything is proved except where a full argument needs machinery beyond this course, and those places are labelled as proof sketches.
8.1The Markov property and the transition matrix
We work throughout with discrete time — the process is observed at steps — and a discrete state space , finite or countably infinite, with the state occupied at step . When is finite we take it to be , labelling states with words in the examples.
Definition 8.1 (The Markov property). A sequence of random variables taking values in a discrete set has the Markov property if for every , every and every history with ,
Such a sequence is a Markov chain.
Read this as an equality of two conditional distributions: the law of the next state given the whole history, and its law given only the current state. The positivity condition is not fussiness — conditional probability is undefined on a null event, so the requirement has to be imposed on histories the chain can actually produce.
Intuition. Imagine a token moving between rooms. The Markov property says someone who knows only which room it is in predicts the next move exactly as well as someone holding its entire itinerary: the room is a sufficient summary of the past.
This is not to say the past is irrelevant — it determined where the token is now. The property says the past exerts its influence only through the current position; once you know that, the route adds nothing.
The Markov property says the conditional law depends on the history only through . It does not say the law is the same at every time . That is a second, independent assumption, so often left silent that it deserves its own name.
Definition 8.2 (Time-homogeneity). A Markov chain is time-homogeneous if the one-step conditional probabilities do not depend on the time index: for all and all with ,
The common value is written , and the matrix is the (one-step) transition matrix of the chain.
Every chain here is assumed time-homogeneous, and every theorem below uses it. A queue whose arrival rate changes between morning and afternoon still has the Markov property, but no single matrix describes it and none of this chapter's long-run theory applies.
Notation (Row is the future of state ). In the first index is where you are and the second where you go, so row of is the conditional distribution of the next state given the chain is at . Some books use the transpose convention, with column-vector distributions and every product below reversed; mixing the two is the commonest source of wrong answers in this material.
Definition 8.3 (Stochastic matrix). A square matrix with non-negative entries whose every row sums to is a stochastic matrix. A probability vector is a row vector with and .
Proposition 8.4 (A transition matrix is stochastic). Let be the transition matrix of a time-homogeneous Markov chain on a discrete state space . Then for all , and for every with .
Proof. Non-negativity is immediate: each is a conditional probability.
For the row sums, fix . The events , as ranges over , are pairwise mutually exclusive and their union is certain, because the chain must be somewhere at time . Since is itself a probability measure, countable additivity and normalisation give
The converse also holds: any stochastic matrix together with any initial probability vector defines a Markov chain. So the objects of study are exactly the stochastic matrices.
Theorem 8.5 (The law of the chain factorises). Let be a time-homogeneous Markov chain with transition matrix and initial distribution , meaning . Then for every and every ,
Consequently the pair determines the joint law of the whole process.
Proof. Induction on . For the multiplication rule gives .
Suppose the formula holds for . If then both sides vanish — the left is the probability of a subset of a null event, and the right contains the factor the induction hypothesis equates to . Otherwise the multiplication rule gives
By the Markov property the second factor equals , and by time-homogeneity that is . Applying the induction hypothesis to the first factor completes the step.∎
This is the precise sense in which the matrix "is" the model, and note where each hypothesis entered: the Markov property collapsed the conditioning to one state, time-homogeneity made the resulting number independent of . Drop either and the product formula fails. One consequence governs every numerical computation below.
Proposition 8.6 (Marginal distributions by matrix multiplication). With regarded as a row vector,
Proof. By the law of total probability, partitioning on the state at time ,
where the terms with contribute nothing and may be included harmlessly. The right-hand side is precisely the -th entry of the row-vector-times-matrix product . Iterating from gives .∎
Pitfall (Which side do you multiply on?). Distributions are row vectors and multiply on the left: . A column vector multiplied on the right, , is different and equally useful — the vector of conditional expectations , which is what the first-step equations later compute. Keep track of which you are holding: pushes a distribution forward in time, pulls a payoff backward.
Every later numerical statement about "the weather chain" refers to this one.
Example 8.7 (The weather chain). A crude model of daily weather has three states — Sunny, Cloudy, Rainy — and assumes tomorrow's weather depends only on today's, with probabilities
the states ordered Sunny, Cloudy, Rainy. Check that is stochastic, and find the distribution of the weather two days after a sunny day.
Solution. Every entry is non-negative and each row sums to : , , . So is stochastic, as Proposition A transition matrix is stochastic requires.
Take . By Proposition Marginal distributions by matrix multiplication, is the first row of :
Then , entry by entry:
So , which sums to . The probability of sun has fallen from to to : the chain is losing memory of its sunny start. How far that goes, and how fast, is the subject of the convergence section.□
A small chain is clearer as a picture: one node per state, one labelled arrow per positive transition probability, a loop for .
It is worth seeing the assumption fail, because the repair is standard.
Example 8.9 (A process that is not Markov, and how to fix it). Let be independent fair coin flips coded and , and the number of heads in the -th consecutive pair. Is a Markov chain on ?
Solution. No. The event means is or , each with conditional probability . In the first case requires , probability ; in the second and is impossible. So .
Now add history. If additionally , then , so forces , and . The past changes the prediction, so the Markov property fails.
The repair is to enlarge the state space. Take . Then depends on only through its second coordinate plus a fresh independent flip, so is a Markov chain, with transition matrix (states ordered )
and is a deterministic function of . Remember more, and the process becomes Markov: that is how memory of depth is handled in general.□
Pitfall (Markov is a property of the state space, not of the world). "Is this process Markov?" is not well posed until you say what the state is: the same system is non-Markov in a coarse description and Markov in a finer one. When a model seems to need memory, ask what you would have to record to make memory unnecessary — that record is the right state space.
8.2Chapman-Kolmogorov and -step transitions
One step is described by . What describes steps?
Definition 8.10 ( -step transition probability). For the -step transition probability is
defined whenever . We write for the matrix , and set , so .
By time-homogeneity for every : only the elapsed number of steps matters.
Theorem 8.11 (Chapman-Kolmogorov equations). For all and all ,
Equivalently, .
Proof. Fix with . The events are pairwise mutually exclusive and exhaustive, so the law of total probability under gives
(terms with zero probability omitted). By the Markov property the conditioning on in the first factor may be dropped — screens off everything earlier — and time-homogeneity makes it . The second factor is . The resulting sum is the entry of .∎
Intuition. To get from to in steps you must be somewhere after . Enumerate that stop, multiply the probability of reaching it by the probability of finishing from it, and add. What makes the multiplication legitimate is the Markov property: on arriving at the chain continues as though freshly started there.
Corollary 8.12 ( -step transitions are matrix powers). for every . In particular is the entry of the -th power of the one-step transition matrix.
Proof. Induction on . The case is , and is the definition. Assuming , take and in Chapman–Kolmogorov: .∎
This corollary is the bridge to linear algebra, and it carries real weight: a transition matrix is a stochastic matrix in the sense of the linear algebra chapter on eigenvalues, so everything proved there applies here unchanged.
Theorem 8.13 (Eigenvalue and the spectral bound). Let be a finite stochastic matrix. Then:
- , where is the all-ones column vector; so is an eigenvalue of .
- Every eigenvalue of satisfies .
Consequently is a dominant eigenvalue of .
Proof. (1) The -th entry of is by the row-sum property. So , and is an eigenvector for . This is Theorem Every stochastic matrix has eigenvalue from the linear algebra chapter on eigenvalues, restated in probabilistic clothing.
(2) Let with , possibly complex. Choose an index maximising , so . Taking absolute values in the -th row of the eigenvalue equation and using the triangle inequality,
where the second inequality uses and . Dividing by gives .∎
Notice what part (1) is and is not. The right eigenvector for is the uninformative ; the interesting object is the left eigenvector with , which exists because and share a characteristic polynomial. Whether it can be scaled to a probability vector, and whether it is unique, is what the section on stationary distributions settles; Theorem Perron–Frobenius for regular chains and Definition Steady-state vector are the matrix-side statements of the same facts.
The spectrum also fixes the rate, via Theorem Powers of a diagonalizable matrix: if then , and every with decays geometrically. Only the eigenvalue survives, which is why tends to a rank-one matrix when the chain is well behaved.
Example 8.14 (Powers of the weather chain). For the weather chain of Example The weather chain, compute , and , find the eigenvalues of , and read off .
Solution. Squaring by rows gives
Every row sums to , as it must, since . The requested probability is the entry of , namely .
For the eigenvalues, one root of is by Theorem Eigenvalue and the spectral bound; dividing out of the characteristic cubic leaves , so
Three distinct eigenvalues in a matrix means is diagonalisable, by Corollary Distinct eigenvalues suffice, so with : the deviation from the limit is a combination of and , with eventually dominating. The third column above reads , so the gaps to the limiting are — halving each step, which is made visible.□
Pitfall ( is not the probability of first reaching at step ). The entry counts all paths of length from to , including those that visit earlier and come back. The probability of arriving at for the first time at step is a different quantity , related to it by a convolution. That distinction is the whole content of the recurrence criterion proved next.
8.3Classification of states
Before asking about long-run behaviour we need vocabulary for how a chain can be structured, all of it readable off the diagram: which states reach which, whether the chain can get stuck, and whether returns run on a rigid timetable.
Definition 8.15 (Accessibility and communication). State is accessible from state , written , if for some . States and communicate, written , if and .
Allowing is deliberate: it makes automatic, which is what turns communication into an equivalence relation.
Theorem 8.16 (Communication is an equivalence relation). On any state space , the relation is reflexive, symmetric and transitive.
Proof. Reflexive. , so , and hence .
Symmetric. The definition of is the conjunction of and , which is symmetric in and by inspection.
Transitive. Suppose and . We show ; the reverse direction follows by the same argument with the roles exchanged. Since there is with , and since there is with . By Chapman–Kolmogorov,
the inequality because every term of the sum is non-negative, so dropping all terms but can only decrease it. Hence .∎
The proof is short but the consequence is large: an equivalence relation partitions into disjoint communicating classes, so every chain decomposes into blocks, and "where can it go?" and "where does it end up?" become questions about how those blocks are arranged.
Definition 8.17 (Irreducible chain, closed class). A class is closed if whenever and — once in , the chain never leaves. A chain is irreducible if is a single communicating class, that is, if every state is accessible from every other.
Example 8.18 (Reading classes off a matrix). Classify the states of the chain with
Solution. From the chain reaches only and , and likewise from , so is a class, closed because rows and put no mass outside it. State has : it is absorbing, and is a closed class alone. State reaches , and , but column is zero except for , so nothing ever returns to ; hence is a class by itself and is not closed.
The classes are , , , so the chain is not irreducible. The weather chain, with every entry positive, is.□
The second structural feature is periodicity, which concerns the timetable of returns rather than their possibility.
Definition 8.19 (Period). For a state with for at least one , the period of is
State is aperiodic if , and periodic with period if .
Proposition 8.20 (A self-loop forces aperiodicity). If then .
Proof. , so belongs to the set whose greatest common divisor defines . Any common divisor of a set containing is .∎
Theorem 8.21 (Period is a class property). If then .
Proof. Since , pick with and . By the Chapman–Kolmogorov inequality used in Theorem Communication is an equivalence relation,
so .
Now let be any integer with . Then
so . Subtracting, . Thus divides every element of , and therefore divides their greatest common divisor: . Exchanging the roles of and gives , and two positive integers dividing each other are equal.∎
So for an irreducible chain the period is a single number attached to the chain, and one may speak of an aperiodic chain. The weather chain is aperiodic, immediately from Proposition A self-loop forces aperiodicity applied to any of its three diagonal entries.
Example 8.22 (A chain of period and a chain of period ). Compute the period of the two-state chain and of the three-state cycle sending with probability .
Solution. For , and , so exactly for even ; the gcd of the even positive integers is , so both states have period . Started at the chain is at at every even time and at at every odd time, with no randomness at all in when. For , and returns to occur exactly at multiples of , so .
Both chains are irreducible, which shows irreducibility does not imply aperiodicity. The two conditions are logically independent, and the convergence theorem needs both.□
Now the deeper dichotomy: does the chain come back?
Definition 8.23 (First-return probabilities, recurrence and transience). Let
be the probability of returning to for the first time at step , and let be the probability of ever returning.
State is recurrent if and transient if .
The criterion that makes this computable replaces first returns, awkward because they involve avoiding in between, by total returns, which are matrix entries.
Theorem 8.24 (The sum-of-return-probabilities criterion). A state is recurrent if and only if
and transient if and only if the sum is finite. Moreover, writing for the total number of visits to (counting time ), if is transient then , while if is recurrent then almost surely.
Proof. By the Markov property and time-homogeneity the chain restarts every time it is at : given that it has returned times, the probability of at least one more return is , whatever is. So the number of returns after time has the geometric-type law
Transient case. If then , so is finite almost surely, and summing the tail probabilities of a non-negative integer variable,
Recurrent case. If then for every , so and the expectation is infinite.
It remains to connect to the sum of the . Write . Expectations of non-negative terms may be exchanged with the sum (monotone convergence, or simply Tonelli for non-negative series), so
Combining: the sum is infinite exactly when , which by the two cases above happens exactly when , that is, exactly when is recurrent.∎
Intuition. A recurrent state is one the chain keeps coming back to, and "keeps" is literal: each return resets the clock, so the chain gets infinitely many independent chances. A transient state is visited a geometric number of times and then abandoned. The criterion tells the two apart by adding the diagonal entries of the powers of : divergence means returns forever, convergence means the visits dry up.
Example 8.25 (Using the criterion on a three-state chain). For
classify each state as recurrent or transient.
Solution. Column is zero below the diagonal, so states and can never reach state ; once the chain leaves , which it does with probability per step, it is gone for good. So being at at time requires having stayed there every step, giving and
so state is transient by Theorem The sum-of-return-probabilities criterion, which also gives — consistent with and .
States and form a closed communicating class. A finite closed class cannot be abandoned, so the chain inside it visits some state infinitely often; recurrence then spreads across the class by the proposition below. Both are recurrent.□
Proposition 8.26 (Recurrence is a class property). If and is recurrent, then is recurrent.
Proof. Choose with and . For every , Chapman–Kolmogorov applied twice and the term-dropping inequality give
Summing over and writing ,
the last equality because is recurrent. By Theorem The sum-of-return-probabilities criterion, is recurrent.∎
Recurrence says the chain returns, but nothing about how long the return takes. That is the last distinction.
Definition 8.27 (Positive and null recurrence). Let be the first return time to , and its mean. A recurrent state is positive recurrent if and null recurrent if .
Null recurrence sounds paradoxical — returns certain, expected waiting time infinite — but it is just a heavy-tailed return-time distribution: returns happen, but occasionally take so long that the mean diverges. The standard example is the simple symmetric random walk on , where but . Finite chains cannot do this.
Theorem 8.28 (Finite irreducible chains are positive recurrent). Every state of a finite irreducible Markov chain is positive recurrent.
Proof. Proof sketch. Two steps, the second using a limit theorem beyond this course. First, not every state can be transient. If all states were, then by Theorem The sum-of-return-probabilities criterion the expected number of visits to each would be finite, so the expected total number of time steps would be a finite sum of finite numbers — yet the chain occupies some state at each of infinitely many times. Contradiction. So some state is recurrent, and by Proposition Recurrence is a class property with irreducibility, all are.
Second, recurrence upgrades to positive recurrence. The step needing machinery we do not develop is the renewal-theoretic fact that the long-run fraction of time at a recurrent is , with . If every state were null recurrent every fraction would be , yet over states they must sum to — impossible when is finite. So some is finite, and a class argument propagates positive recurrence everywhere.
Both halves use finiteness essentially, which is why the theorem fails for infinite chains: the symmetric random walk on is irreducible and recurrent, but null recurrent.∎
8.4Stationary distributions
Now the question the whole theory is built around: is there a distribution the chain, once in it, stays in?
Definition 8.29 (Stationary distribution). A probability vector is a stationary distribution (or invariant distribution) for the transition matrix if
The component equations are the global balance equations: the probability flowing into in one step equals the probability already sitting at .
Proposition 8.30 (Stationarity is preserved for all time). If is stationary, then for every ; in fact the process started from is strictly stationary, meaning the law of does not depend on .
Proof. The first claim is induction: if then , by Proposition Marginal distributions by matrix multiplication. For the second, Theorem The law of the chain factorises started at time gives
which has no in it.∎
Intuition. Think of probability as a fluid of volume spread over the states, with describing how it is stirred each step. A stationary distribution is an arrangement the stirring leaves unchanged: particles keep moving, but the amount at each state stays in balance, every departure matched by an arrival.
Theorem 8.31 (Existence and uniqueness for a finite irreducible chain). Let be the transition matrix of an irreducible Markov chain on a finite state space. Then has exactly one stationary distribution , and for every state .
Proof. Proof sketch. By Theorem Eigenvalue and the spectral bound the eigenvalue belongs to , hence to , since a matrix and its transpose share a characteristic polynomial. So some non-zero row vector has . What needs more than linear algebra is that may be chosen with all entries of one sign, so it can be normalised, and that the eigenspace is one-dimensional.
Both follow from the Perron–Frobenius theorem for non-negative irreducible matrices: the dominant eigenvalue is simple, with a strictly positive eigenvector on each side. Applied to , whose dominant eigenvalue is , it yields a strictly positive left eigenvector unique up to scale; dividing by the sum of its entries, positive and finite because is finite, gives . Theorem Perron–Frobenius for regular chains is the special case recorded in the linear algebra chapter on eigenvalues; it assumes the stronger hypothesis that some power of has all entries positive, which rules out the periodic chains this theorem still covers.
A probabilistic route avoiding Perron–Frobenius builds from mean return times, the identity stated as Theorem Expected return time is the reciprocal of the stationary probability.∎
Both hypotheses work. Irreducibility forces uniqueness: a chain with two closed classes has a stationary distribution supported in each, and every mixture of them is stationary too. Finiteness forces existence: on the symmetric random walk's only invariant vectors are constant, and cannot be normalised.
Method 8.32 (Solving ).
- Write the balance equations , one per state — read down the columns of .
- Discard one. The system has rank at most , since the columns of sum to zero, so one equation is redundant.
- Solve the remaining for the up to a common scale.
- Impose to fix the scale. This is not optional bookkeeping: is homogeneous, so without it is determined only up to a multiple.
- Check by computing and confirming you get back.
Example 8.33 (The stationary distribution of the weather chain). Find for the weather chain of Example The weather chain.
Solution. Write for the probabilities of Sunny, Cloudy, Rainy. Reading down the columns of :
Discard the first, as Method Solving permits. The Cloudy equation gives and the Rainy equation , so . Substituting, , hence , , and . Normalising, , so
Check: the entries of are , then , then . So exactly.
Every row of the computed in Example Powers of the weather chain is already close to — the next section's convergence theorem, previewed.□
Example 8.34 (A chain with infinitely many stationary distributions). Show that
has a whole family of stationary distributions, and identify which hypothesis of Theorem Existence and uniqueness for a finite irreducible chain fails.
Solution. States and are absorbing. Try . The balance equation for state reads , forcing , after which the equations for states and become and , true for every .
So every with is stationary: a one-parameter family. The failed hypothesis is irreducibility — the classes are , , , with and closed. Note also that no stationary distribution charges the transient state , which is general.□
Pitfall ( is a left eigenvector, and the system is deliberately rank-deficient). Two errors account for most wrong stationary distributions. The first is solving — the right eigenvector problem — whose answer is the useless , by Theorem Eigenvalue and the spectral bound. Always read down the columns.
The second is expecting to have a unique solution, and concluding that something is wrong when it does not. The deficiency is structural: makes the rows dependent, and the vanishing column sums make the columns dependent too. The normalisation is the extra equation that restores uniqueness, and must be imposed by hand.
8.5The convergence theorem
Example Powers of the weather chain showed every row of drifting toward the same . That is the general behaviour, under exactly the hypotheses accumulated so far.
Theorem 8.35 (Convergence to the stationary distribution). Let be the transition matrix of an irreducible, aperiodic Markov chain on a finite state space, with stationary distribution . Then for all states ,
Equivalently , the matrix every one of whose rows is ; and for any initial distribution , .
Proof. Proof sketch. The argument is a coupling, worth carrying even though its measure-theoretic details are beyond this course.
Run two independent copies on one probability space: from state , and from , so for every by Proposition Stationarity is preserved for all time. The pair is a Markov chain on with .
The step that uses aperiodicity is that is irreducible. Irreducibility of alone is not enough: in a period- chain with the copies on opposite phases they are never in the same state at the same time. Aperiodicity repairs this, because for an irreducible aperiodic chain there is an with for all — positive return times with gcd eventually fill in every large integer. The product chain is then irreducible and finite, so by Theorem Finite irreducible chains are positive recurrent it is recurrent and hits the diagonal with probability .
Let be the first time , and after swap the copies: by the Markov property the process following before and after has the same law as . Since the two agree on ,
The bound is stronger than the statement: it controls the total variation distance by , so the whole distribution converges at the rate two independent copies meet.∎
Aperiodicity, in one sentence, is what allows two independent copies of the chain to be in the same state at the same time. Without it they march out of phase forever, and nothing converges.
Example 8.36 (The period- counterexample). For the alternating chain of Example A chain of period and a chain of period , show that a unique stationary distribution exists but does not converge, and identify what does.
Solution. The chain is irreducible, so Theorem Existence and uniqueness for a finite irreducible chain applies: gives , hence , uniquely. But the powers oscillate:
So alternates between and and has no limit, while . The conclusion of Theorem Convergence to the stationary distribution fails, and the only hypothesis that fails with it is aperiodicity — the chain is irreducible, finite and positive recurrent. This is why aperiodicity cannot be dropped.
What does converge is the average:
since exactly half the terms are and half are . So keeps its meaning as the long-run fraction of time in state — half the steps in each — even though it is not the limiting probability of being there at a named time.□
Intuition. Irreducibility says the chain cannot get stuck in a corner, which makes the long-run answer independent of where you started. Aperiodicity says returns are not on a rigid timetable, which makes "where is it at time ? " have a limit rather than a cycle. One guarantees a unique answer; the other guarantees the question has an answer at all.
The rate is governed by the spectrum, exactly as the linear algebra suggests.
Proposition 8.37 (Geometric rate from the second eigenvalue). Suppose is finite, diagonalisable, with eigenvalues and where . Then there is a constant with
Proof. Diagonalise as in Theorem Powers of a diagonalizable matrix, so with . Split with , giving .
The first term does not depend on ; since and the second term tends to , it must equal . Every entry of is a fixed linear combination of , each of modulus at most , so taking to be the largest coefficient sum gives the bound.∎
Example 8.38 (The weather chain converges at rate ). Using from Example Powers of the weather chain, track how fast the distribution started at Sunny approaches .
Solution. Applying repeatedly from :
The last column is the total variation distance . From it halves exactly each step — — which is taking over from the faster-decaying (the step from to still shrinks by a factor , slightly more than a half, because the term has not yet died away), as Proposition Geometric rate from the second eigenvalue predicts. Within eight days the model has forgotten the sunny start to one part in a thousand.□
Corollary 8.40 (Long-run fraction of time). For a finite irreducible chain with stationary distribution , the long-run fraction of steps spent in state ,
equals almost surely, regardless of the starting state, and regardless of whether the chain is aperiodic.
Proof. Proof sketch. This is the ergodic theorem for Markov chains. Write for the limiting fraction. Two things are needed, and only the first goes beyond this course. First, the limit exists almost surely and does not depend on the starting state: by the Markov property the excursions between successive visits to a fixed state are i.i.d., and the strong law applied to their lengths turns the count of visits in steps into an almost-sure limit. Second, the resulting vector is a probability vector with : the fraction of steps spent at equals, up to a boundary term of order , the fraction of steps that arrive at , which is . By Theorem Existence and uniqueness for a finite irreducible chain the only such vector is , so . Aperiodicity is not needed, because time averages survive periodicity intact — see Example The period- counterexample.∎
8.6Detailed balance and reversibility
Solving means solving a linear system. For many chains there is a shortcut, and it carries a structural meaning.
Definition 8.41 (Detailed balance and reversibility). A probability vector satisfies the detailed balance equations for if
A chain for which such a exists is called reversible, and is a reversible measure for it.
Theorem 8.42 (Detailed balance implies stationarity). If is a probability vector satisfying the detailed balance equations for , then ; that is, is stationary.
Proof. Fix and sum the detailed balance equations over :
using the row-sum property of Proposition A transition matrix is stochastic at the second-to-last step. The left side is the -th entry of , so .∎
Intuition. Global balance says the total flow into each state matches the total flow out. Detailed balance is far stronger: the flow balances across every individual edge separately, so a reversible chain has no net circulation anywhere.
The name comes from the fact that, started in , such a chain is statistically identical run backwards: , so a film of it gives no clue which way time runs.
The converse fails, which is the point the definition usually comes with.
Example 8.43 (Stationary but not reversible). Consider a three-state chain that prefers to move "clockwise":
Show that the uniform distribution is stationary but that no distribution satisfies detailed balance.
Solution. Every column of sums to as well as every row — is doubly stochastic — so with we get , and is stationary. (The uniform distribution is stationary for any doubly stochastic matrix.)
Now suppose a probability vector satisfied detailed balance. The pair gives , so ; the pair gives ; the pair gives , forcing and hence . That is not a probability vector, so no reversible measure exists.
So detailed balance is sufficient for stationarity but not necessary. The chain has a perfectly good stationary distribution; what it lacks is edgewise balance. There is a persistent net circulation , and this film run backwards shows the circulation reversed — visibly a different process.□
Proposition 8.44 (Kolmogorov's cycle criterion). If a chain is reversible, then for every cycle of states ,
(The converse also holds for irreducible chains, giving a test that never mentions .)
Proof. Let satisfy detailed balance; it is strictly positive by Theorem Existence and uniqueness for a finite irreducible chain. Rewrite each left-hand factor as and multiply over . Around a closed cycle every appears once in a numerator and once in a denominator, so the -factors telescope away, leaving the product of the reversed transitions.∎
This is exactly what failed in Example Stationary but not reversible: around the product is , against the other way. The workhorse example of a chain that passes the test is a random walk on a line of states.
Definition 8.45 (Birth-death chain). A birth–death chain on has whenever : from the chain moves only to , or .
Theorem 8.46 (Every birth-death chain is reversible). Let be an irreducible birth–death chain on , with up-probabilities for and down-probabilities for . Then
(with the empty product equal to ) satisfies detailed balance, and is therefore the stationary distribution.
Proof. For both sides of are , and for it is a tautology, so only neighbouring pairs need checking: for . The stated formula gives , which rearranges to exactly that. Since is positive and normalised by , it is a probability vector satisfying detailed balance, hence stationary by Theorem Detailed balance implies stationarity.∎
Example 8.47 (A four-state birth-death chain). Find the stationary distribution of
using detailed balance, and verify the answer.
Solution. The up-probabilities are , ; the down-probabilities , . Theorem Every birth-death chain is reversible gives
So with we get , , , and :
Checking edge by edge: ✓; ✓; ✓.
Solving directly would have meant a linear system; detailed balance needed three ratios. That is why reversibility is worth checking for before reaching for linear algebra — and why Markov chain Monte Carlo methods, which must construct a chain with a prescribed stationary distribution, construct reversible ones.□
Pitfall (Not every chain is reversible, and the shortcut fails silently). For a chain that is not reversible the equations are inconsistent, yet a subset of them will still "solve" and hand you a vector that is not stationary. In Example Stationary but not reversible, the edges and alone give , that is , which is not stationary. Always verify against , as Method Solving step 5 instructs.
8.7Absorbing chains and the fundamental matrix
Not every chain is irreducible, and often the interesting question is not where the chain settles but where it stops.
Definition 8.48 (Absorbing state, absorbing chain). A state is absorbing if . A chain is an absorbing chain if it has at least one absorbing state and from every state some absorbing state is accessible.
Relabelling the states so that the transient ones come first and the absorbing ones last puts into canonical form
where is (transient to transient) and is (transient to absorbing); the zero block records that an absorbing state never returns to a transient one, and that it stays put. Block multiplication gives
which is the whole computational content of this section in one line: everything is governed by powers of .
Lemma 8.49 (The transient block decays). For an absorbing chain, entrywise as .
Proof. Proof sketch. From each transient state some absorbing state is reachable within steps with probability . Put and , both over the finitely many transient states. From any transient state the probability of not being absorbed within steps is at most , and this applies afresh over each successive block of steps, so the probability of surviving steps is at most . Entries of are bounded by that and are monotone, so . What the argument glosses is the formal use of the strong Markov property to restart at each block boundary.∎
Theorem 8.50 (The fundamental matrix). For an absorbing chain with transient block , the matrix is invertible, and
Moreover is the expected number of visits to transient state before absorption, starting from transient state (counting time ).
Proof. Invertibility. If then , so for every by induction; letting with Lemma The transient block decays gives . The null space is trivial, so is invertible.
The series. From the telescoping identity ,
since ; in particular the series converges.
The interpretation. Let count visits to the transient state . Exchanging expectation and a sum of non-negative terms, as in the proof of Theorem The sum-of-return-probabilities criterion,
where because a path between transient states stays transient throughout: it cannot pass through an absorbing state and come back.∎
Theorem 8.51 (Expected time to absorption). Let be the number of steps until absorption. Starting from transient state ,
Proof. Until absorption the chain occupies transient states, so . Taking expectations and using Theorem The fundamental matrix,
which is the -th entry of .∎
Theorem 8.52 (Absorption probabilities). Let be the probability that the chain, started at transient state , is eventually absorbed in absorbing state . Then
Proof. Absorption into happens at some step , from a transient state occupied at step . Partitioning on and using the Markov property,
the interchange being legitimate because all terms are non-negative. The right side is .∎
Now the classical application, worked from those matrices.
Example 8.53 (Gambler's ruin, end to end). A gambler starts with chips and makes repeated independent bets, winning a chip with probability and losing one with probability , stopping at (ruin) or (target). For each starting fortune find the fundamental matrix, the expected number of bets, and the probability of reaching before .
Solution. The state is the current fortune, , a birth–death chain with and absorbing. Ordering the states then ,
the columns of being absorption at and at .
The fundamental matrix. Inverting the tridiagonal , whose determinant is , gives exactly
Entry says a gambler starting with one chip holds one chip on about occasions before the game ends, counting the start; says she rarely reaches four.
Expected duration. By Theorem Expected time to absorption, is the row sums:
The longest games start in the middle, furthest from absorption in either direction.
Absorption probabilities. By Theorem Absorption probabilities, ; since has only in row of its first column and in row of its second, and :
So from chips the chance of reaching before is only , though she needs to gain just and can afford to lose . Each row sums to : absorption is certain.
Cross-check. For , with , the classical formula for reaching before from is
With , : ✓, matching exactly.□
Example 8.55 (The fair game, for contrast). Repeat the calculation with , .
Solution. Now has the same tridiagonal pattern with off the diagonal, and
So and , the familiar fair-game answers. Against Example Gambler's ruin, end to end: shifting from to cuts the chance of success from chips from to , and shortens the expected game from bets to — it ends sooner because it ends badly sooner.□
Pitfall (Order the states before you read off and ). The formulas , and assume canonical form, transient states first. Take in the natural ordering of the gambler's fortunes and you get a matrix with singular, and nothing works. Relabel first, and read the answer back through the relabelling.
8.8Hitting times and expected return times
Absorption answers "where does it stop?". The same technique answers "how long until it first reaches a given state?" for any chain, absorbing or not.
Definition 8.56 (Hitting time). For a set , the hitting time of is
with if the chain never enters . For a single state we write , and the first return time to is , which differs from only in that it ignores .
Theorem 8.57 (First-step equations for hitting times). Let . Then for , and for ,
If the chain is finite and is reachable from every state, this system has a unique finite solution.
Proof. For the chain is already in at time , so . For at least one step is needed; condition on the first move:
By the Markov property and time-homogeneity, given the remaining time is the hitting time of a chain started at , with one step already elapsed: . Substituting,
using the row-sum property for the first term.∎
Intuition. "Take one step, then you are facing the same problem from wherever you landed." Every calculation in this section is that sentence turned into a linear equation. The counts the step you just took; the sum averages the remaining cost over where the step put you.
The same one-step argument with a payoff instead of a cost gives absorption probabilities without the matrix machinery.
Proposition 8.58 (First-step equations for hitting probabilities). Let and be disjoint sets of states and let . Then for , for , and for ,
Proof. The boundary values are immediate. For , partition on the first step: by the law of total probability and the Markov property, the probability from is the -weighted average of the same probability from . No appears, because we are accumulating probability rather than counting time.∎
Example 8.59 (Hitting times in the weather chain). In the weather chain, find the expected number of days until the first rainy day, starting from a sunny day and from a cloudy day; then the probability that, starting from Sunny, the first non-sunny day is rainy rather than cloudy.
Solution. Take , so , and write for the hitting times from Sunny and Cloudy. Theorem First-step equations for hitting times gives
that is and . Adding, , so ; then , so too.
So from either a sunny or a cloudy day the model expects days until rain. The two agree because Sunny and Cloudy both send probability to Rainy in one step, and the route between them does not change the total wait.
For the second question take , in Proposition First-step equations for hitting probabilities, so and :
So a sunny spell ends in rain one time in three and in cloud two times in three — the ratio of the two ways of leaving Sunny, as it must be, since the only alternative to leaving is staying.□
The last result of the chapter ties hitting times back to , and gives it its most concrete meaning.
Theorem 8.60 (Expected return time is the reciprocal of the stationary probability). Let be an irreducible positive recurrent Markov chain with stationary distribution , and let be the mean first return time to as in Definition Positive and null recurrence. Then
Proof. Proof sketch. By Corollary Long-run fraction of time the long-run fraction of steps at is . Now split the trajectory at successive visits to : by the Markov property the excursions between consecutive visits are i.i.d. with mean length , so steps contain about of them and hence about visits, a long-run visit fraction of . Equating the two expressions for the same fraction gives .
The step needing machinery beyond this course is the renewal-reward argument turning "about excursions" into an almost-sure limit, where the strong law is applied to the i.i.d. excursion lengths.∎
Example 8.61 (Return times in the weather chain). Use to find the mean return time to each state, and verify two of them from first-step equations.
Solution. By Theorem Expected return time is the reciprocal of the stationary probability,
Rain occurs on one day in five, so rainy days average five days apart — a long-run frequency converted into a waiting time.
Direct verification for Rainy. Conditioning on the first step out of Rainy,
where come from Example Hitting times in the weather chain. The last term adds nothing beyond the step already counted, since returns the chain to Rainy at once. Hence
matching exactly.
And for Sunny. The hitting times of solve and , giving , so
Pitfall (The hitting time of from is zero, not ). Definition Hitting time sets , so starting at gives . The mean return time requires and is a different number. Setting and solving the first-step equations therefore returns . Compute the hitting times from every other state instead, and assemble , as in Example Return times in the weather chain.
Summary (The chapter in one page).
- A Markov chain depends on the past only through the present, and is assumed time-homogeneous, so one stochastic matrix describes it; distributions evolve by .
- Chapman–Kolmogorov gives , hence . The eigenvalue is dominant; the sub-dominant eigenvalue sets the rate at which powers settle.
- Communication is an equivalence relation partitioning states into classes; irreducible means one class. Period and recurrence are class properties, and is recurrent exactly when . Finite irreducible chains are positive recurrent.
- A stationary distribution solves with , and is unique and strictly positive for a finite irreducible chain.
- Convergence to needs irreducibility and aperiodicity: has a unique but oscillates forever. Time averages converge regardless.
- Detailed balance implies stationarity but is strictly stronger; birth–death chains are reversible, cyclic chains generally are not.
- Absorbing chains: in canonical form , the fundamental matrix gives expected visits, the expected time to absorption, and the absorption probabilities.
- Hitting times solve ; the mean return time to is .
- Multiplying on the wrong side. Distributions are row vectors: . The right eigenvector of for is the uninformative .
- Forgetting the normalisation. is homogeneous and rank-deficient by construction, so without you have only up to a scalar — and is not a distribution.
- Assuming convergence without aperiodicity. Irreducibility alone gives a unique but not . A single in an irreducible finite chain settles aperiodicity at a glance.
- **Treating as a first-passage probability.** It counts every path of length , including those that reach early and return. First passage needs the first-step equations, not a matrix power.
- Assuming detailed balance. Sufficient for stationarity, never necessary. A chain with circulation has a stationary distribution the detailed balance equations cannot find, and an inconsistent subset of them yields a confident wrong answer.
- **Using without canonical form.** Transient states first; is the transient-to-transient block only. Including absorbing states in makes singular.
- Confusing hitting time with return time. started at is ; the mean return time is , which for the weather chain's rainy state is .
- Applying the finite theory to an infinite chain. Positive recurrence, existence of and convergence all used finiteness. The symmetric random walk on is irreducible, aperiodic and recurrent, yet has no stationary distribution at all.