Definition · Absorbing states and the canonical blocksState i is absorbing when P[i][i] = 1. Order the states with the transient ones first and the matrix splits into Q (transient to transient), R (transient to absorbing), a zero block and an identity block.
The fundamental matrix is N = (I − Q)⁻¹, when the inverse exists. t = N·1 is the vector of expected numbers of steps before absorption, and B = N·R is the matrix of probabilities of finishing in each absorbing state.
The lab extracts those blocks from the matrix you typed, given the positions of the absorbing states, and computes N by exact Gauss-Jordan on [I − Q | I] over the rationals. So the inverse of a matrix of halves and thirds is a matrix of halves and thirds, and the expected times come out as fractions you can check by hand.
Theorem · N is the sum of the powers of QIf (I − Q) is invertible and Qᵏ → 0 then I + Q + Q² + ⋯ = (I − Q)⁻¹, and the (i, j) entry of that sum is the expected number of visits to transient state j starting from transient state i, counting the start.
Let Sₖ = I + Q + ⋯ + Qᵏ. Then (I − Q)Sₖ = I − Q^(k+1), because everything in between cancels — the same telescoping as the scalar geometric series, and matrix multiplication is all that was used.
As k grows, Q^(k+1) → 0 whenever every transient state can reach an absorbing one, so (I − Q)Sₖ → I and Sₖ → (I − Q)⁻¹. For the interpretation, note that the expected number of visits to j is the sum over k of the probability of being at j at step k, which is Σₖ Qᵏ[i][j] — the same sum, entry by entry.
□
That is why the slider matters. What is left over from the partial sum after k steps is exactly the probability mass still sitting in transient states after k steps, and the page prints it beside every entry. On the gambler's-ruin example the worst shortfall is 1 at k = 0, 1/2 at k = 2, 1/8 at k = 6, 1/32 at k = 10 and 1/1024 at k = 20: halving every two steps, which is the chain's own structure showing up in the remainder.
The gambler with four units
P = 1 0 0 0 0 states 0 1 2 3 4, absorbing 0 and 4
1/2 0 1/2 0 0 transient 1, 2, 3
0 1/2 0 1/2 0
0 0 1/2 0 1/2
0 0 0 0 1
Q = 0 1/2 0 R = 1/2 0
1/2 0 1/2 0 0
0 1/2 0 0 1/2
N = (I − Q)⁻¹ = 3/2 1 1/2
1 2 1
1/2 1 3/2
t = N·1 = (3, 4, 3) and i(n − i) gives 1·3, 2·2, 3·1
B = N·R = 3/4 1/4 from 1: ruined 3 times in 4
1/2 1/2 from 2: even, as the symmetry says
1/4 3/4 from 3: ruined 1 time in 4
every row of B sums to 1, checked on the page
The diagonal of N is worth a second look. N[2][2] = 2 says the walk started at 2 is at 2 twice on average, counting the start; N[1][1] = 3/2 says the walk started at 1 is at 1 one and a half times. Those are counts of visits, and they are what makes the row sums 3, 4, 3 mean “total steps” rather than anything more mysterious.
Example · The biased walk, where the symmetry goesChange the step probabilities to two-thirds up and one-third down. The expected times become (17/5, 18/5, 11/5) and the absorption probabilities (7/15, 8/15), (1/5, 4/5), (1/15, 14/15).
From the top transient state the walk now finishes at the far end fourteen times in fifteen, and the expected wait from there has dropped from 3 to 11/5. Notice that the middle row is no longer even and that the longest wait is still from the middle, but by a narrower margin: the drift shortens every journey and skews every destination, and both effects come out of the same N.
When there is no inverse
I − Q is singular exactly when some transient state cannot reach an absorbing one — there is a closed set of states you have not declared absorbing, the chain can enter it and never leave, and there is no expected number of steps to absorption because absorption does not happen. The lab reports this rather than producing a number, and the diagnosis it gives is the actionable one: every state you have not listed as absorbing has to be able to reach one that you have.
Example · A chain that never stopsTake 1 0 0; 0 1/2 1/2; 0 1/2 1/2 and declare the first state absorbing. States two and three communicate with each other and with nothing else.
I − Q is singular, and the lab says so. The right reading is not “the arithmetic failed” but “the model has a second closed class in it”, which the material on communicating classes finds directly and which is very often an unintended consequence of a transition that was left out.