Markov Chains and Transition Matrices
Suppose you want to predict tomorrow's weather from today's. You don't care whether last Tuesday was sunny or rainy. How much of the past do you actually need to remember? This question — how much history matters — sits at the heart of one of the most useful ideas in all of probability. A Markov chain answers it by declaring, as a modeling assumption, that the future depends on the past only through the present state, no further back. This single postulate, the Markov property, is deceptively simple. Yet it compresses an infinite, unwieldy dependency structure into a finite table of numbers. The idea matters because an enormous range of random phenomena can be modeled this way. Genetic drift, board games, queueing systems, web-page ranking, weather, stock-price models, card shuffling, and language generation are examples. Each can be modeled, at least approximately, as a sequence of states. These states are visited according to fixed transition probabilities. Once we accept the Markov property, all of the chain's short-run and long-run behavior becomes computable. It all follows from a single object: the transition matrix. Matrix algebra then takes over where probabilistic reasoning alone would become intractable. The big picture is this: a Markov chain lives on a state space. This is a set of possible configurations the system can occupy. It evolves in discrete time steps. At each step, the chain jumps from its current state to a new one. It may even stay at the same one. This happens according to probabilities that depend only on the current state. They never depend on how it got there. Collecting these one-step probabilities into a matrix produces a distinctive algebraic signature. Every row is a probability distribution. This is the notion of a stochastic matrix. It is exactly the right structure to capture "one step of Markov evolution." This article gives the precise definition of a (discrete-time, time-homogeneous) Markov chain. It proves that the one-step transition matrix is stochastic. Conversely, it shows that any stochastic matrix generates a legitimate Markov chain. It also builds the intuition needed for later study. This includes multi-step transitions via the Chapman-Kolmogorov Equations. It also includes the long-run behavior captured by the Classification of States.
- A Markov chain is a sequence of random variables where the future depends on the past only through the present — the Markov property.
- The state space is the (here, countable) set of values the chain can take.
- The one-step transition matrix collects all conditional probabilities .
- Every row of sums to and every entry is nonnegative — is a stochastic matrix.
- Conversely, any stochastic matrix paired with an initial distribution defines a genuine Markov chain, via Conditional Probability and the chain rule.
- Key idea: memorylessness turns an infinite-dimensional dependency structure into a single finite matrix that fully governs the chain's evolution.
Where this lives today
Markov chains and their transition matrices are a working tool across quantitative science. In web search, Google's original PageRank algorithm models a "random surfer" clicking links as a Markov chain on the graph of web pages, with the transition matrix built directly from the hyperlink structure; the long-run distribution ranks pages by importance. In statistical physics, Markov chains underlie Monte Carlo methods (Metropolis–Hastings, Gibbs sampling) used to sample from complex distributions like the Boltzmann distribution of an Ising model, where the transition matrix is engineered so its stationary distribution matches the target. In genetics, DNA and protein sequence evolution and hidden Markov models for gene finding rely on state spaces of nucleotides or amino acids with empirically estimated transition matrices. In queueing theory and operations research, transition matrices model customers moving between service states, inventory levels, or machine breakdown/repair cycles, feeding directly into the study of stationary throughput and reliability. In finance, credit-rating migrations (e.g. a bond moving from AA to A to default) are modeled with transition matrices whose entries are estimated from historical rating-change data. In natural language processing, -gram models and simple text generators are literal instances of Markov's own original example, now scaled to billions of words. In cryptography and randomized algorithms, card-shuffling processes (e.g. the riffle shuffle) are Markov chains on the symmetric group, and their transition matrices are studied to bound how many shuffles are needed to reach near-uniform randomness — a question resolved using the tools that begin with the Chapman–Kolmogorov equations for computing .
Ask the tutor: How do we compute -step transition probabilities from , and why does matrix multiplication correctly capture "summing over all intermediate paths"?
Let be a finite or countable set, called the state space. A sequence of random variables , each taking values in , is a Markov chain if for every and all states with
the following Markov property holds:
The chain is time-homogeneous if, in addition, the right-hand side does not depend on : there exist numbers , for , such that
The numbers are the one-step transition probabilities, and the matrix is the (one-step) transition matrix of the chain. Unless stated otherwise, "Markov chain" in this article means discrete-time and time-homogeneous. A matrix is called stochastic if
The distribution of , given by , is the initial distribution of the chain.
Intuition
Picture the state space as a collection of nodes, and imagine standing at one node at each tick of a clock. At every tick you roll a state-dependent die and jump — possibly back to the same node — according to fixed odds that depend only on where you currently stand. The Markov property says the die's odds do not care about your itinerary before arriving; it is as if the chain has amnesia about everything except its current location. This is why one models it with a directed, weighted graph: nodes are states, and a directed edge from to carries weight , the probability of jumping from to in one step. The constraint that each row of sums to is just the statement that, wherever you stand, you must go somewhere (possibly staying put) with total probability one — the outgoing edge-weights from each node form a probability distribution. This graph picture also explains why the transition matrix is the natural computational engine of the theory. Multiplying probability row-vectors by advances the chain by one time step; multiplying by (matrix power) advances it by steps, a fact whose justification is exactly the content of the Chapman–Kolmogorov equations. For now, the goal is to nail down the correspondence between "Markov chain" (a probabilistic object, a sequence of random variables satisfying a conditional-independence condition) and "stochastic matrix" (a purely algebraic object, a nonnegative matrix with unit row sums) — and to see that this correspondence is exact: every Markov chain produces a stochastic matrix, and every stochastic matrix (with a chosen initial distribution) produces a Markov chain.
Part 1 (Necessity). Let be a time-homogeneous Markov chain on a countable state space with transition probabilities (defined whenever ; extend arbitrarily, e.g. by , to states of prior probability zero, or restrict attention throughout to states that are reachable). Then the matrix is stochastic:
Part 2 (Sufficiency / Construction). Conversely, let be countable, let be any probability distribution on , and let be any stochastic matrix. Then there exists a probability space and a sequence of random variables on it, taking values in , such that is a time-homogeneous Markov chain with initial distribution and one-step transition matrix .
Part 3 (Determination of the finite-dimensional distributions). Under the hypotheses of Part 2, for every and states ,
We prove the three parts in order. The technique throughout is direct manipulation of conditional probabilities via the definition and the multiplication (chain) rule, together with a standard existence construction (Kolmogorov-type extension for countable products, done explicitly here since the state space is countable and no abstract extension theorem is needed).
Part 1. Fix with . By definition, for each . Conditional probabilities are themselves probabilities of events (with respect to the conditional measure ), hence: 1. Nonnegativity. for every , since probabilities are nonnegative by the axioms of probability. 2. Row sums equal 1. The events , as ranges over , are pairwise disjoint (a random variable takes only one value at a time) and their union is the whole sample space (since must take some value in , as is by hypothesis the full state space of the chain). Hence by countable additivity of the conditional probability measure ,
For states with , we adopted the convention (stated in the theorem) of assigning some valid row, e.g. and for ; this row trivially satisfies nonnegativity and sums to , and it does not affect any computation of actual chain probabilities since has probability zero (so no conditioning on it is ever actually invoked along a positive-probability path — see the finite-dimensional formula in Part 3, all of whose terms multiply against ). This proves is stochastic.
Part 2 and Part 3. We construct the process explicitly on the countable product space and verify it satisfies the Markov property with the prescribed transition matrix; along the way we obtain the finite-dimensional distribution formula of Part 3, which we then use to re-derive the Markov property directly (avoiding any circularity, since we build the distributions of the process first and check the defining conditional-probability identity from them afterward). Construction. Let , whose elements are sequences with each . Define by (the coordinate maps). Since is countable, the collection of cylinder sets
generates the product -algebra . Define, for each and each choice of , the number
(an empty product for , so ). We check these numbers are consistent: for fixed ,
using that is a stochastic matrix (row sums ). This consistency, together with , means the assignment is a finitely additive, countably-additive-on-cylinders set function that extends (by the standard countable-product measure construction — the countable-state-space case of the [Kolmogorov extension theorem], here elementary because at each stage we are just distributing mass over a countable index set) to a unique probability measure on satisfying
for every and every choice of states. This is exactly the claimed formula of Part 3. Verifying the Markov property (completing Part 2). We must show that for all and all with ,
By the definition of conditional probability and the formula from Part 3,
where the cancellation is valid precisely because the denominator, which equals by Part 3, is assumed strictly positive. This quantity does not depend on at all — it depends only on and — which simultaneously establishes the Markov property and shows that the conditional probability (computed the same way, dropping the earlier coordinates) equals the same , and does not depend on . Hence is a time-homogeneous Markov chain with initial distribution and one-step transition matrix , completing Part 2.
∎Worked examples
Example 1 — A three-state inventory/weather-type chain with asymmetric transitions. Consider a chain on (think: Low, Medium, High stock level at the end of the day) with transition matrix
Step 1 — check it is stochastic. All entries are . Row sums: row 1 is ; row 2 is ; row 3 is . All nonnegative, all rows sum to : is indeed a valid stochastic matrix, consistent with Part 1 of the theorem applied in reverse — this matrix is a legitimate candidate transition matrix. Step 2 — initial distribution. Suppose (started at Medium most likely). Check: , valid. Step 3 — compute a specific path probability using Part 3 of the theorem. Find .
Compute stepwise: ; then ; then . So
Step 4 — a marginal one-step-ahead distribution. Find the distribution of given : , i.e. (row vector times matrix).
Check: . Good — is again a valid probability distribution, exactly as it must be since is stochastic (a probability row-vector times a stochastic matrix is again a probability row-vector, a fact used repeatedly when studying the Chapman-Kolmogorov Equations).
Example 2 — Verifying the Markov property fails to be violated (a "trap" check) using conditioning on more history. Take the same as above. Someone claims: "surely differs from in general, since gives extra information." Let's actually verify the Markov property holds here, using Part 3's formula directly (not assuming the conclusion). We compute both sides from the joint law constructed in the theorem.
Numerator: . Denominator: . So . Now the unconditional-on- version:
directly from the matrix (row 3, column 1 entry is ). Indeed : the two match, confirming the Markov property numerically for this instance (as the theorem guarantees it must, for every choice of history with positive probability) — the apparent "extra information" from turns out not to change the conditional law of at all, because it is already fully screened off by . This also illustrates a genuinely structural fact: entry means state ("Low") is not reachable in one step from state ("High"); no amount of extra conditioning on the past can create a transition probability that the matrix itself forbids.
The theorem's construction (Part 2) crucially used a single fixed matrix applied at every time step. Two things can go wrong if we relax the hypotheses, and both destroy the clean "one matrix governs everything" picture.
(a) Dropping time-homogeneity. Consider a chain that does satisfy the Markov property (the conditional law of given the whole past depends only on ) but where the transition probabilities are allowed to depend on : say and
with the complementary probabilities filling out each row to sum to . This is a perfectly good non-homogeneous (time-inhomogeneous) Markov chain: it still has the property that the future depends on the past only through the present. But there is no single transition matrix with valid for all , because the entry genuinely changes with (it is at , at , at , and so on, never stabilizing). The clean statement "the chain's whole future is governed by a single stochastic matrix ," which is the entire payoff of Part 2 and Part 3 of the theorem, simply fails: one would instead need an infinite sequence of matrices , one per time step, and the elegant matrix-power formula for -step transitions (Chapman–Kolmogorov) does not hold in the simple form .
(b) Dropping the Markov property outright. Let and let be defined by if a fair coin flip at time matches the flip at time (for ; set a fresh fair coin flip encoded as ), and otherwise — i.e. records whether consecutive flips of an i.i.d. fair-coin sequence agree. Then can depend on as well as (knowing whether flips matched, combined with whether matched, gives partial information about the actual flip at time , which affects whether will match, in a way not reducible to alone). Concretely, alone does not determine enough about the underlying coin sequence to screen off : the pair carries strictly more predictive information about than alone. Hence no matrix with can correctly predict from the full past — the entire premise of Part 1 (that a well-defined, past-independent exists at all) fails, so there is no legitimate "transition matrix" for as a chain in alone. (One repairs this by passing to a bigger state space, e.g. tracking the last flip rather than just the agreement indicator — a standard trick, but it shows the Markov property is a genuine restriction on which processes admit a transition-matrix description, not an automatic feature of "nice" processes.)
Scope, edge cases & common traps
| Situation | What holds | What can fail |
|---|---|---|
| Finite state space | is a finite stochastic matrix; row sums exactly , computable by direct summation | — |
| Countably infinite | is an infinite stochastic matrix; row sums still (a convergent series) | Column sums need not be ; need not be doubly stochastic |
| Time-homogeneous | Single matrix governs all steps; -step transitions are | Fails if transition rule genuinely varies with (see counterexample (a)) |
| State with | Row can be defined arbitrarily (as a valid distribution) without affecting any actual path probability | Careless choices can make an unreachable state look reachable in naive computations if one forgets |
| Continuous or general state space | Analogous theory exists (transition kernels replace matrices) | The clean finite/countable row-sum- picture must be replaced by measure-theoretic kernels; outside Tier-1 scope |
The mathematician behind it
Origins · 1 minAndrei Andreyevich Markov and how this was discovered
Andrei Markov was a Russian mathematician working in the tradition of Chebyshev, initially known for contributions to number theory and the theory of continued fractions before turning to probability. He is best remembered for introducing, around 1906, chains of dependent random variables in which each term depends on its immediate predecessor — partly as a rebuttal to critics (notably Pavel Nekrasov) who argued that the Law of Large Numbers required independence. Markov showed dependent sequences could still obey striking regularities, using as his first examples the alternation of vowels and consonants in Pushkin's verse Eugene Onegin, an early instance of what would become statistical language modeling.
Does every random process with a "matrix of probabilities" automatically satisfy the Markov property?
No. Having some table of transition-like numbers around does not make a process Markov; the Markov property is a genuine, checkable condition on the process's full joint distribution. As Counterexample (b) shows, you can define a process on a small state space where naive one-step frequencies exist, yet the true conditional law of given the whole past depends on more than just . The correct logical order is: first verify the Markov property holds (for every history and every ), and only then read off the transition matrix from the resulting well-defined conditional probabilities .
Why must every row of a transition matrix sum to exactly 1, but not necessarily every column?
Each row corresponds to "starting in state , where do I go next?" — and wherever you start, you must end up somewhere in the state space with total probability , since is assumed to contain all possible outcomes. That is a probabilistic law-of-total-probability fact, forced by the axioms. Columns, by contrast, correspond to "how much probability flows into state from various sources," and there is no a priori reason this has to total — some states might be easy to enter from many states (column sum ) or hard to reach at all (column sum small). Matrices where both rows and columns sum to are a special class called doubly stochastic matrices.
Can a state have ? What does that mean?
Yes — this means state is absorbing: once the chain enters , it stays there forever, since the entire row's probability mass is concentrated on the diagonal entry. This is consistent with the definition, since the row still sums to (as and all other entries in that row are forced to be ). Absorbing states show up naturally in models of eventual outcomes, such as "game over," "bankruptcy," or "fixation of an allele" in population genetics, and they become central objects when one studies the Classification of States.
Is the initial distribution part of the transition matrix, or separate?
Separate. The transition matrix encodes only the dynamics — how probability moves from one step to the next — and is entirely independent of where the chain starts. The initial distribution specifies the starting point's randomness. Together, fully determine every finite-dimensional distribution of the chain, exactly as shown in Part 3 of the theorem: . Changing changes the chain's law but never changes , and vice versa.
Why is the state space allowed to be only finite or countable in this treatment?
Restricting to countable lets every conditional probability be an honest, elementary conditional probability (a ratio of two probabilities of events), and lets the transition matrix be an actual matrix (rows/columns indexed by a countable set) with row sums given by a convergent series that must equal . When the state space is uncountable (say, ), individual points typically have probability zero, so "" is not meaningful as stated; one needs measure-theoretic transition kernels for (measurable) sets , which generalize stochastic matrices. That extension is a deliberately more advanced topic than this foundational treatment.
How does the transition matrix relate to predicting several steps ahead, not just one?
The single-step matrix already contains, in principle, all information about multi-step behavior, because -step transition probabilities turn out to equal the entries of the matrix power . Proving this rigorously — that — is precisely the content of the Chapman-Kolmogorov Equations, which build directly on the Markov property and the stochastic-matrix structure established here. This article deliberately stops at the one-step matrix so that the foundational correspondence (chain stochastic matrix) is completely nailed down before layering on multi-step machinery.
What is the quickest way to check a proposed table of numbers is a legitimate transition matrix?
Two checks, both mechanical: first, scan every entry and confirm none is negative (probabilities cannot be negative); second, sum each row separately and confirm every row total equals exactly (probabilities of mutually exclusive, exhaustive outcomes from a fixed starting state must add to ). Both checks are necessary and, together, sufficient — this is exactly the definition of a stochastic matrix proved to correspond to genuine one-step chain dynamics in Part 1 and Part 2 of the theorem above. Skipping the row-sum check is the single most common bookkeeping error when constructing chain models by hand.