absorbing chains and the fundamental matrix
Some states are traps: once the chain lands there, it never leaves. An absorbing state i has P(i, i) = 1 — a self-loop with all the probability, so it swallows the chain forever. An absorbing chain is one where every state can eventually reach some absorbing state. Think of a game that must eventually end (you win or you lose), or a queue that eventually empties for good. The interesting questions become: which trap do we fall into, and how long do we wander first?
Organise the states into transient ones (those you eventually leave) and absorbing ones. Written in blocks, the transition matrix has a Q block giving transient-to-transient moves. The central object is the fundamental matrix N = (I - Q)^(-1), the inverse of identity minus Q. Its entry N(i, j) is the expected number of visits to transient state j before absorption, starting from transient state i. From N everything flows: the expected number of steps before absorption from state i is the i-th row sum of N; and the probabilities of being absorbed into each absorbing state are given by N times R, where R is the transient-to-absorbing block.
Why the inverse? N = I + Q + Q^2 + Q^3 + ... is a geometric series of matrices counting visits at step 0, 1, 2, ... and it sums to (I - Q)^(-1) exactly because, the chain being transient, Q's powers shrink to zero. This single matrix turns hard questions — expected game length, the chance each contestant wins, expected time to extinction — into one matrix inversion. Absorbing-chain analysis is everywhere: gambler's ruin, branching-process extinction, drunkard's walk to a wall, and the 'how many turns will this take?' of countless games.
Gambler with states 0, 1, 2, 3, where 0 and 3 absorb. Transient states are {1, 2} with Q having rows (0, 1/2) and (1/2, 0). Then I - Q has rows (1, -1/2) and (-1/2, 1), and N = (I - Q)^(-1) has rows (4/3, 2/3) and (2/3, 4/3). Expected steps to absorption from state 1 is the row sum 4/3 + 2/3 = 2 — matching the first-step answer.
The fundamental matrix N = (I - Q)^(-1) counts expected visits; its row sums give expected time to absorption.
The inverse (I - Q)^(-1) exists precisely because the transient block Q has spectral radius below 1 (Q^n goes to 0). If a 'transient' class were actually closed, Q would not shrink and the method would break — make sure every transient state can truly reach an absorbing one.