Definition · A finite Markov chainA finite set of states 1, …, n together with a transition matrix P, where P[i][j] is the probability that the chain is at j at the next step given that it is at i now. Every entry satisfies 0 ≤ P[i][j] ≤ 1 and every row satisfies Σⱼ P[i][j] = 1.
A distribution on the states is a row vector v with vᵢ ≥ 0 and Σᵢ vᵢ = 1. The chain is memoryless: the row used at each step depends on the current state and on nothing earlier.
The lab takes the matrix as text, rows separated by a semicolon and entries by spaces: 1/2 1/2; 1/4 3/4 is a two-state chain whose first row is an even split. Entries may be fractions, and they stay fractions — 7/10 is seven tenths exactly, not 0.7. The state names are yours, and they are labels: nothing below depends on them.
Before it draws anything the page adds each row up and prints the sum beside the row. This looks like fussiness for about as long as it takes to mistype one entry. A matrix with a bad row still has powers, still has an invariant vector, still yields expected times to absorption; all of those numbers are answers about an object that is not a chain, and no later check on this course would catch it.
the two-state example the row sums, checked
fine wet fine 1/2 + 1/2 = 1 ok
fine 1/2 1/2 wet 1/4 + 3/4 = 1 ok
wet 1/4 3/4
start (1, 0) — certainly fine today
step 0 (1, 0)
step 1 (1/2, 1/2)
step 2 (3/8, 5/8)
step 3 (11/32, 21/32)
step 4 (43/128, 85/128)
step 5 (171/512, 341/512)
step 6 (683/2048, 1365/2048)
The distribution moves on the left, and that is not a convention
A distribution is a row vector and it is multiplied on the left: (vP)ⱼ = Σᵢ vᵢ P[i][j]. Read the sum out loud and the reason is immediate — the chance of being at j next is the chance of being at each i now, times the chance of the step from i to j, added over every i. That is why the stationary vector solves πP = π rather than Pπ = π, and why it is a left eigenvector; a reader who has met eigenvectors as columns meets the transpose here and should notice.
Theorem · Powers composeP^(m+n) = Pᵐ Pⁿ for all m, n ≥ 0, with P⁰ the identity. Hence Pⁿ[i][j] is the probability of being at j after exactly n steps from i, and vPⁿ is the distribution after n steps from v.
To get from i to j in m + n steps the chain is somewhere at step m — at exactly one state k, and those events are disjoint and exhaust the possibilities.
So the probability is Σₖ P(i to k in m) · P(k to j in n), which by memorylessness is Σₖ Pᵐ[i][k] · Pⁿ[k][j], and that sum is the (i, j) entry of the matrix product. Nothing about the numbers was used, only that the intermediate state is exactly one of the n.
□
So there is no separate machinery for “n steps”. The lab computes Pⁿ by repeated multiplication and prints it whole, and the distribution bars beneath the digraph are that same walk shown one step at a time. Push the step count up on the two-state example and the bars stop moving long before the fractions stop growing, which is worth watching: those are two different facts and only one of them is about probability.
Where the decimals would have gone
The five-state example has every entry over a denominator of 20, which looks harmless. Multiplying the matrix by itself multiplies denominators, and by the twelfth power the entries are fifteen-digit numerators over sixteen-digit denominators; by the twenty-fourth they are thirty-one over thirty-two. The lab prints the widest numerator and the largest denominator as figures, and warns when the denominator passes what a double can hold.
five states, every entry over 20 widest numerator largest denominator
P 1 digit 2 digits
P⁶ 8 digits 8 digits
P¹² 15 digits 16 digits
P²⁴ 31 digits 32 digits
one entry of P¹², exactly:
203244268876273 / 1024000000000000
a double carries about 15 to 17 significant figures in total,
so from P¹² onward a decimal is storing a nearby number, not this one
This is not a point about arithmetic hygiene for its own sake. The claim the whole of this course rests on is that certain quantities are exactly equal — πP is exactly π, two routes to a queue's distribution give exactly the same fractions — and an equality between two decimals that look alike is not evidence of anything.
Example · A matrix that is refused, and why refusing is the right answerType 1/2 1/4; 1/4 3/4. The first row sums to 3/4, and the lab stops with the row named and nothing drawn.
Every quantity on this page would have computed. The powers exist, the digraph can be drawn, a distribution can be pushed through it. What they would describe is a process that disappears with probability 1/4 per step from state one, which is a fine object and is not a Markov chain. The page refuses rather than painting, because a number produced from bad data is worse than a blank panel.
Example · A starting distribution the lab will not rescaleType 1 1 as the starting distribution on the two-state chain. It is refused: the entries have to be non-negative and sum to exactly 1.
Rescaling it silently to (1/2, 1/2) would answer a question nobody asked. A distribution that does not sum to one is a typo far more often than it is an unnormalised weight, and the two cases want opposite treatment.