Definition · Stationary distributionA distribution π is stationary for P when πP = π, that is Σᵢ πᵢ P[i][j] = πⱼ for every j, together with πᵢ ≥ 0 and Σᵢ πᵢ = 1.
Equivalently π(P − I) = 0 with the normalisation attached. Nothing in this definition mentions a starting distribution, a number of steps, or a limit.
Theorem · The balance equations are dependentFor any transition matrix P, the columns of P − I sum to zero: Σⱼ (P[i][j] − I[i][j]) = 1 − 1 = 0 for every row i. Hence the n equations π(P − I) = 0 have rank at most n − 1, and one of them is implied by the rest.
Row i of P − I has entries P[i][j] for j ≠ i and P[i][i] − 1 at j = i. Its entries add to Σⱼ P[i][j] − 1, which is 1 − 1 = 0 because every row of P is a distribution.
So the all-ones column vector is in the null space of P − I acting on the right, which is exactly the statement that the columns — the equations of the system π(P − I) = 0 — sum to the zero functional. Adding all n equations together therefore gives 0 = 0, and any one of them can be recovered from the other n − 1.
□
That dependency is the reason the system as written cannot be solved: it determines π only up to a multiple, and π = 0 satisfies all of it. The repair is not a trick. One equation carries no information the others lack, so it is removed by name; and Σπ = 1, which πP = π never contained, takes its place. The lab prints the resulting system with the dropped equation named in the caption and the augmented column ruled off, and lets you choose which equation to drop. The answer does not move, and watching it not move is the point of the control.
The solve, and the check the page performs on its own answer
three brands, P = 7/10 2/10 1/10
3/10 5/10 2/10
1/10 3/10 6/10
balance at state 1: 7/10 π₁ + 3/10 π₂ + 1/10 π₃ = π₁
balance at state 2: 2/10 π₁ + 5/10 π₂ + 3/10 π₃ = π₂
balance at state 3: 1/10 π₁ + 2/10 π₂ + 6/10 π₃ = π₃ ← dropped
in its place: π₁ + π₂ + π₃ = 1
Gauss-Jordan over the rationals, 9 operations:
π = (7/17, 11/34, 9/34) exactly, rank 3 of 3
the page then recomputes πP from that π:
πP = (7/17, 11/34, 9/34) every entry EXACTLY equal
πP − π = 0 Σπ = 1
The verification is not decoration. π is claimed to satisfy two things, and both are recomputed from the vector that came out of the elimination: πP is formed again and compared entry by entry with exact equality of fractions — not a tolerance — and the entries are added up. A page that asserted this instead of computing it would be a page you have to trust, and the whole reason the arithmetic here is rational is that claims of exact equality can be made and checked.
The iteration, which is a different thing
Beside the solve the page runs repeated multiplication in floating point from a corner of the simplex, for as many steps as you like, and prints the worst entrywise disagreement with the exact answer. On the three-brand matrix the disagreement is 2.882e-1 after one step, 2.255e-6 after twenty, and 2.776e-16 after sixty. After four hundred steps it is 3.331e-16, which is not better. The iteration has run out of double, not out of steps, and the exact column did not iterate at all.
three brands: how far the floating-point iteration is from the exact answer
steps worst entry error decimal places agreed
1 2.882e-1 0
4 4.184e-2 1
10 1.042e-3 2
20 2.255e-6 5
40 1.056e-11 10
60 2.776e-16 15
100 3.331e-16 15
400 3.331e-16 15
the exact solve reached (7/17, 11/34, 9/34) at step zero, and stayed there
The matrix where there is no limit at all
Now switch to the three-cycle, 0 1 0; 0 0 1; 1 0 0. It is irreducible, so the balance system has exactly one solution and the page prints π = (1/3, 1/3, 1/3) with πP − π exactly zero. It has period 3, so the powers do something the word “slowly” does not describe: the lab finds that P³ is exactly P⁰, so the sequence of powers repeats with period 3 for ever. The largest entry of Pⁿ − π is exactly 2/3 at every single n, and the floating-point iteration sits at 6.667e-1 at one step, at four hundred steps, and at every step in between.
Example · A unique answer where no limit existsOn the three-cycle the linear system is rank 3 against 3 unknowns and returns (1/3, 1/3, 1/3); powerCycles reports P³ exactly equal to P⁰; and the exact distance from Pⁿ to π is 2/3 for n = 1, 2, 3, 4, 5, 6 and onwards.
The sequence does not fail to converge slowly. It does not converge. And the steady state is not the limit of anything — it is the solution of three equations in three unknowns, which exists and is unique whether or not any limit does. That is what “a steady state is a linear system, not a limit” means, and this one matrix is where the two come apart.
And the matrix where there is no answer
The two-closed-group example is rank deficient: the reduced matrix has rank 3 against 4 unknowns, and the page says so and prints nothing. That is the right behaviour, because there is no shortage of solutions to print — there are infinitely many, and choosing one would be choosing. (1/2, 1/2, 0, 0) is stationary. (0, 0, 3/11, 8/11) is stationary. So is every mixture of the two, and each of those three vectors satisfies πP − π = 0 exactly when it is checked.
two closed groups 1/2 1/2 0 0
1/2 1/2 0 0
0 0 1/3 2/3
0 0 1/4 3/4
three stationary distributions, each verified by recomputing πP:
(1/2, 1/2, 0, 0) πP − π = 0 Σπ = 1
(0, 0, 3/11, 8/11) πP − π = 0 Σπ = 1
(1/4, 1/4, 3/22, 4/11) πP − π = 0 Σπ = 1
and any weighting of the first two is another one
the page reports rank 3 against 4 unknowns, and prints no π
Note what the lab does and does not do there. It reports the rank and refuses; it does not exhibit the family. Exhibiting three members, as above, is a stronger demonstration of non-uniqueness than a rank is, because a rank is a claim about an elimination and three checked vectors are three checked vectors. Both are worth having, and they answer slightly different doubts.