Recurrences and Difference Equations
2 min read
Half the expected-value classics end at a system of equations like . This lesson is the general theory of such equations, so instead of solving each puzzle from scratch you recognize the pattern and write the answer.
Homogeneous linear recurrences
For , guess . Substituting gives the characteristic equation ; with roots the general solution is
with pinned by boundary conditions. Repeated root : use .
The showcase: Fibonacci, , roots and , giving Binet's formula . Practical corollary: — growth rate questions ("roughly how big is ?") need only the dominant root. That principle — the largest root controls the asymptotics — is the entire long-run theory of linear systems in one sentence.
Ruin problems: the two-root machine
Biased gambler's ruin: win \pq = 1-ph_kh_k = p,h_{k+1} + q,h_{k-1}p r^2 - r + q = 01q/p$, so
and boundaries , give the standard formula . The fair case has a double root at 1, so — linear, which is exactly the "" answer from the ruin question. What looked like two separate tricks is one method with different root structures.
Inhomogeneous equations: expected times
Expected-duration equations carry a "+1" forcing term: . Recipe: general solution = homogeneous solution + any particular solution. For a constant forcing term, try a particular solution (or when the homogeneous part already contains linear terms — the fair case, which is how arises). This "guess the right polynomial" step is mechanical once named, and it converts every expected-hitting-time interview question into four lines.
First-step analysis, formalized
The pattern-waiting problems (flips until HH, dice until two sixes) generate small systems rather than one recurrence: one unknown per state, one linear equation per state, solve. Two practical habits: order the unknowns so substitution cascades (solve the closest-to-done state first), and sanity-check monotonicity — being closer to the target must not increase the expected time. If it does, an equation is wrong, and finding it beats resolving everything.
The interview version
"A frog climbs stairs, hopping +1 with probability 2/3 and slipping −1 with probability 1/3. Expected hops from stair 0 to stair 10?" — Drift is per hop, so the crude answer is ; the recurrence machinery confirms the linear particular solution satisfies boundary and equation, so exactly 30 (edge behavior at 0 permitting). Recognizing when drift alone answers the question — and when boundaries force the full two-root treatment — is the judgment this topic builds.