the gambler's ruin problem
A gambler walks into a casino with some money and bets one dollar at a time on a game, winning or losing a dollar on each play. They stop only when they either go broke or reach a target fortune. The questions are timeless: what is the chance they hit the jackpot before going bust, and how long will the game last? This is the gambler's ruin problem, and it is the simple random walk dressed up with two walls.
Set it up cleanly. The gambler starts with i dollars and plays until reaching either 0 (ruin) or N (the goal). Each round they win 1 with probability p and lose 1 with probability q = 1 - p. The position is a random walk on {0, 1, ..., N} with absorbing barriers at the two ends — once you hit 0 or N you stop. For a FAIR game (p = q = 1/2), the probability of reaching the goal N before ruin is simply i/N — beautifully proportional to how much of the way there you already are. For an unfair game, the formula becomes a ratio of powers of (q/p), and even a tiny house edge makes ruin nearly certain when N is large. The expected duration of a fair game is i(N - i), which can be surprisingly long.
The lesson is sobering and exact. Against a slightly unfavourable game (the casino's edge), the probability of ruin is overwhelming if you keep playing toward a fixed goal — the house edge compounds relentlessly over many bets. Even in a perfectly fair game, if you play against an opponent with vastly more money (think the casino as N - i being huge), your chance of taking it all is tiny, because you are likely to hit your own zero first. The problem is a cornerstone of the theory of processes: it is the prototype of hitting probabilities, absorbing barriers, and first-passage analysis, and it connects directly to martingales and optional stopping.
You have 10 dollars and want to reach 100 in a fair coin-flip game (win or lose 1 each round). Your chance of reaching 100 before going broke is 10/100 = 0.1 — only one in ten. The expected number of rounds the game lasts is 10 times (100 - 10) = 900. Switch to a casino game where you lose slightly more often, and that 0.1 chance collapses toward essentially zero.
Fair game: reach-goal chance is i/N; expected length i(N-i). A small house edge makes ruin nearly certain for large N.
Even a perfectly fair game punishes a goal-seeking player who is heavily outgunned in capital: against an effectively infinite bankroll, your probability of taking it all goes to 0. And against any house edge, ruin is essentially certain in the long run — the gambler's fallacy that a losing streak is 'due' to reverse offers no rescue.