Recursion & Recurrences
Gambler's Ruin
Overview
Gambler's ruin is the archetypal first-passage problem. It arises in quant interviews any time someone asks about 'probability of reaching target X before going broke' or 'which player is favored in a repeated-bet scenario.' The key insight is that pₖ satisfies a linear recurrence that's easy to solve. The fair-game case (p=½) gives the beautiful result that probability of winning equals starting fraction of the total pot. The biased case shows exponential decay in your favor — even a tiny house edge makes ruin almost certain over the long run.
How to Recognize
- →'Player has $k, plays until bankrupt or reaches $N'
- →'What is the probability of reaching level a before level b?'
- →'Two players bet repeatedly — who wins?'
- →Any absorbing-barrier random walk problem
Step-by-Step Approach
- 1.Define pₖ = P(reaching N | current wealth = k)
- 2.Write recurrence: pₖ = p·pₖ₊₁ + (1-p)·pₖ₋₁ with p₀=0, p_N=1
- 3.For fair game (p=½): solution is linear pₖ = k/N
- 4.For biased game (p≠½): solution is pₖ = (1 - (q/p)^k) / (1 - (q/p)^N) where q=1-p
- 5.Expected duration: for fair game E[T | start at k] = k(N-k)
Key Formulas
Worked Examples
Problem
Alice has 7. They bet 10)?
Solution
Total pot N=10, Alice starts at k=3.
Fair game (p=½), so pₖ = k/N.
P(Alice wins) = 3/10 = 30%.
Sanity check: P(Bob wins) = 7/10 = 70% (proportional to starting wealth). Makes sense!
Answer
. In a fair game, your probability of winning equals your share of the total pot.
Common Mistakes
- !
Confusing q/p > 1 (house edge, bad for you) vs q/p < 1 (your edge). When p > ½, q/p < 1 and the formula gives you high probability of winning.
- !
Applying the fair-game formula to biased games. pₖ = k/N ONLY when p=½.
- !
Forgetting boundary conditions: p₀ = 0 (ruined) and p_N = 1 (won).
Practice Problems
Click "Show Answer" to revealIn a game, you win 1 with probability 1/3. Starting with 5 before going broke)?
You play a fair game (p=½). You start with N. What is the expected number of bets until the game ends?