Skip to text
Measure of Chance

Chapter XV · 28 min

Markov Chains

Tomorrow asks only about today

The probability of the next letter depends only on the letter just written.

After A. A. Markov, on Eugene Onegin (1913)

So far a random variable has been a number attached to one experiment. A Markov chain is a sequence of those numbers — today’s weather, tomorrow’s, the day after — with a merciful rule: the future cares about the past only through the present. You do not need yesterday’s rain to predict tomorrow, once you know today.

That rule is the whole subject. The linear algebra is a way of writing it down: a row of today’s chances, a table of “from → to”, a multiplication that produces tomorrow. We will do the multiplication by hand. Eigenvectors can wait; two equations will do.

Only today

Write for the state at times . The chain is Markov when

In English: given where you are, the next step forgets how you arrived. That is the same mood as the geometric and the exponential — memoryless — but now the “memory” that is discarded is the whole path, not just a waiting time.

SunRain0.30.50.7 stay0.5 stay
A two-state weather. From sun, stay with chance 0.7 or rain with 0.3. From rain, flip a fair coin between stay and sun. Tomorrow asks only about today.

The only matrices you need

A vector, here, is a row of numbers that add to one: today’s distribution over states. A matrix is a table. Each row of the table is “where I go tomorrow, given I am in this state today”. Those rows also add to one. Multiplying the row by the table is ordinary arithmetic: for each destination, add up “chance I am here × chance I step there”.

from \ toSunRainSun0.70.3Rain0.50.5each row is a tomorrow, given today — rows sum to 1
The weather table. Rows are ‘from’, columns are ‘to’. Each row is a conditional distribution — a complete tomorrow, given today.
WordOn the pageIn EnglishIn the weather
Statei, ja place the chain can sitSun or Rain
Distributionπa row of chances, summing to 1(0.8, 0.2) — likely sun
TransitionP_{ij}P(next = j | now = i)P_{Sun,Rain} = 0.3
One stepπ Ptomorrow’s row, from today’smultiply, then the new row sums to 1

If today is 80% sun,

That is matrix multiplication. You just did it. The compact line is . After two steps, — apply the table twice. No inverse, no determinant, no eigenvalue yet.

Where the crowd settles

Start at sun, or rain, or 80% sun. Apply the table again and again. For this weather, the row forgets its start and settles at one place:

Two unknowns, two honest equations. From the rain column (or sun — they are redundant once rows sum to one),

With , you get , hence , . In the long run this climate is sunny five days in eight, whatever the first day was. That settled row is the stationary distribution.

  • Not every chain settles. A deterministic flip-flop Sun→Rain→Sun never forgets the parity of the day.
  • If you can eventually reach anywhere from anywhere, and you are not trapped in a forced cycle, one stationary row exists and the crowd finds it.
  • Absorbing states — “the game ended” — keep you once you arrive. Then the long run is “which ending?”, not a blend of weather.