Markov Chains, InteractiveInteractive companion
Where Markov chains began

January
1913

Scroll to begin

Andrei Markov opened Pushkin's Eugene Onegin and counted the first 20,000 letters by hand.

Not out of literary interest, but to win an argument. A rival had claimed that the law of large numbers only works for fully independent events, and used that claim to argue for free will. Markov set out to prove him wrong with dependent data.

How likely is the next letter to be a vowel? It depends entirely on the letter before it.

0.0%

a vowel after a vowel

0.0%

a vowel after a consonant

Each number is a transition probability: after a vowel, another vowel is rare, but after a consonant a vowel is likely. The letters were far from independent, yet the law of large numbers still held once that dependence was written down. That is the whole idea of a Markov chain, and everything ahead builds on it.

Chapter 2.2 · The Markov property

The one rule that starts everything

X₀X₁X₂XₜXₜ₊₁

The next state depends only on the present one.

The entire past can be forgotten.

Whether the sun shines tomorrow depends on today's weather, not on last week's. That single rule, called memorylessness, is what makes the whole model tractable.

Chapter 2.3 · Transition matrix

A whole model in one grid

SCR
S0.600.300.10= 1.0
C0.200.500.30= 1.0
R0.100.300.60= 1.0

Every row sums to exactly 1.

SCR

Each number is a named, checkable probability.

Rain in two days, starting sunny? 21%.

0.6·0.1 + 0.3·0.3 + 0.1·0.6 = 0.21 — the sum over every path through an intermediate state (Chapman-Kolmogorov).

Chapter 2.5 · Stationary distribution

It forgets where it began

100.0%
Sunny
0.0%
Cloudy
0.0%
Rainy
n = 0

Start fully certain it is sunny.

Each step multiplies by P and spreads the probability.

It settles at 27.5 / 37.5 / 35 — the same limit from any start.

Chapter 3.2 · PageRank

The web is one giant chain

ABCD

A surfer clicks random links, forever.

Rank is just how often the walk lands on a page in the long run.

Sometimes it teleports to a random page.

That damping (d = 0.85) makes the chain irreducible, so a unique ranking is guaranteed to exist.

C wins. D hits the floor.

C: 38% · A: 37% · B: 21% · D: 3.75%. D links generously but earns nothing, because nothing points back to it.

Chapter 3.3 · Absorbing chains

The night a chain had to end

Lusail Stadium · 18 December 2022 · level after 120 minutes

A shoot-out never settles. It runs until it is swallowed by one of two endings.

ARG winV = 1
or
FRA winV = 0

Two absorbing states. We do not ask where the chain rests, but which ending it reaches. Scroll to take every kick.

Penalties · Lusail0 / 8
ARG
0
FRA
0

Scroll — France steps up first

Live win probability
ARG 50%50% FRA
The timeline

How the win probability moved

050100+23.1

One shared conversion rate, p = 0.75, turned the kick sheet into this curve. Coman’s miss was the biggest swing of the night: +23.1 points to Argentina.

Chapter 3.1 · MCMC

A chain that breaks ciphers

AHOVCJQXELSZGNUBIPWDKRYFMTAHOVCJQXELSZGNUBIPWD

step 0

Guess a key. Swap two letters. Keep the guess if the text looks more like English.

“After 100 steps, a mess. After two thousand steps, it makes sense.”

The unknown normalizing constant cancels in the acceptance ratio. That is exactly why MCMC works where direct sampling fails.

Chapter 3.3 & 4 · The limit

Fluent word by word, lost overall

The scientist opened the box and found a folded map that pointed home glass tides humming corridors of salt birds forgetting the letters entirely

order n = 1
|V|1
≈ 105 parameters

With memory of only the last word or two, the model cannot keep a sentence, let alone a paragraph, coherent.

Just remember more? The parameters explode.

Each extra word of context multiplies the model size. This is the curse of dimensionality that pushed the field toward neural models.

Chapter 5 · The answer

Not a winner, a map

Markov chain
0.60.30.10.20.50.30.10.30.6

Every parameter has a name. Every prediction traces back to elementary probability.

Fully interpretable
vs
LSTM · Transformer
?????????
?

Billions of weights capture long-range meaning no single number can explain.

More powerful, opaque

Choose Markov when the present holds all that matters, or when a decision must be auditable.

Choose the black box when reach beats explanation.

More than a century later

A poem became a tool that still proves its worth.

The same idea runs through every chapter of the paper. A system moves between states, the next step depends only on the present one, and the whole model is a matrix you can read. That is also its limit: no long-term memory. Modern language models keep the state idea but drop the strict Markov property to gain that memory. The trade is interpretability for power.