Introduction

Imagine you sit down to play a game of coin flips against a casino. Each flip is perfectly fair — heads you win £1, tails you lose £1. No tricks, no house edge. You have £10 in your pocket; the casino has £990. You agree to play until one of you is broke.

Intuitively, a fair game should give you a fair chance. But the math says otherwise. Your probability of winning the entire £1,000 and bankrupting the casino is exactly 1%. Your probability of going broke first is 99%.

This is the Gambler's Ruin theorem, first studied rigorously by Christiaan Huygens in 1657 and later formalized by Jacob Bernoulli and Pierre-Simon Laplace. It describes what happens when a random walk — a path that steps left or right with equal probability — is trapped between two walls. The smaller your starting share of the total wealth, the more certainly you hit the floor first.

The ruin is proven (not just likely). It is a theorem about Markov chains, and its conclusion is exact.

Try It

Set your starting bankroll and the casino's bankroll, then hit Run simulation. Each step is a fair coin flip — +1+1 or 1-1 with equal probability. The walk stops when either player hits zero.

<div class="controls">
  <label>{{lbl_your_bankroll}} <input id="k" type="number" value="10" min="1" max="99"></label>
  <label>{{lbl_casino_bankroll}} <input id="opp" type="number" value="90" min="1" max="999"></label>
</div>
<canvas id="chart" width="520" height="220"></canvas>
<div class="stats" id="stats"></div>
<div class="btns">
  <button id="run" type="button">{{btn_run}}</button>
  <button id="run10" type="button">{{btn_run100}}</button>
  <button id="reset" type="button" class="ghost">{{btn_reset}}</button>
</div>
<div class="results" id="results"></div>
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; }
.controls { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .7rem; }
label { font-size: .9rem; display: flex; align-items: center; gap: .4rem; }
input[type=number] { width: 70px; padding: .3rem .4rem; border: 1px solid #adb1b8;
                     border-radius: 6px; font-size: .95rem; }
canvas { display: block; width: 100%; max-width: 520px; border: 1px solid #cdd9e3;
         border-radius: 8px; background: #f7f9fb; margin-bottom: .5rem; }
.stats { font-size: .9rem; color: #444; min-height: 1.4em; margin-bottom: .5rem; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
button { font: 600 14px system-ui, sans-serif; padding: .45rem .9rem;
         border: 1px solid #1d3557; background: #1d3557; color: #fff;
         border-radius: 8px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
.results { font-size: .9rem; line-height: 1.6; color: #333; }
.ruin { color: #c92f3c; font-weight: 600; }
.win  { color: #0a7d33; font-weight: 600; }
// Code not found

Notice how the path wanders, sometimes climbing hopefully, before eventually crashing to zero. Run it many times: the fraction of runs that end in your ruin converges to the exact formula k / N, where k is your starting bankroll and N is the total wealth. With $10 vs $990 that is just 1 %.

The Real Math

The Gambler's Ruin is a solved result. The proofs are exact, not approximate.

Setup. Player A starts with kk coins; Player B starts with NkN - k coins. Each round A wins $1 with probability pp and loses $1 with probability q=1pq = 1 - p.

Ruin probability (fair game, p=q=1/2p = q = 1/2). The probability that A is ruined before B is:

P(ruin)=1kNP(\text{ruin}) = 1 - \frac{k}{N}

So if you have 10 % of the total wealth, you have a 90 % chance of ruin — regardless of how many rounds you play. The key insight: this is a martingale (the expected bankroll never changes), yet ruin is almost certain. Fairness of each step does not protect you from the absorbing boundary.

Expected time to ruin or victory. In the fair game the expected number of rounds before the game ends is exactly:

E[T]=k(Nk)E[T] = k(N - k)

With k=10k = 10 and N=100N = 100 that is 10×90=90010 \times 90 = 900 rounds on average. With k=10k = 10 and N=1000N = 1000 it is 9,9009{,}900 rounds. The game can last a very long time — but it always ends.

Biased game (p1/2p \neq 1/2). If the casino has any edge at all (p<1/2p < 1/2), the ruin probability becomes:

P(ruin)=(q/p)N(q/p)k(q/p)N1P(\text{ruin}) = \frac{(q/p)^N - (q/p)^k}{(q/p)^N - 1}

which approaches 1 exponentially fast as NN grows. Even a tiny house edge makes long-run survival essentially impossible.

Connection to random walks and Markov chains. The bankroll at time tt is a Markov chain on {0,1,,N}\{0, 1, \ldots, N\} with absorbing barriers at 00 and NN. The ruin theorem is the solution to the corresponding system of linear equations, and the expected hitting time follows from the optional stopping theorem — a cornerstone of modern probability.

Where It Matters

The Gambler's Ruin is not just a cautionary tale — it is a mathematical model that appears across science and engineering:

  • Finance and trading. Every trading strategy has a "risk of ruin": the probability of losing enough capital that recovery is impossible. The Kelly criterion (the optimal bet-sizing rule) is derived precisely to minimize ruin probability while maximizing long-run growth. Even profitable strategies go bust if position sizes are too large.
  • Sequential hypothesis testing. The Wald sequential probability ratio test maps directly onto the gambler's ruin model: an evidence score walks up or down with each data point, and the test stops when it hits an upper (accept) or lower (reject) boundary.
  • Evolutionary biology. In a finite population, a new gene variant (allele) with a selective advantage can still be lost by genetic drift — a form of gambler's ruin. The fixation probability of a single mutant in a population of NN is 1/N1/N under neutral drift, exactly the ruin formula with k=1k = 1.
  • Betting systems and the Martingale strategy. The famous Martingale system (double your bet after every loss) cannot escape gambler's ruin. With any finite bankroll and any table limit, ruin is still certain eventually.
  • Queueing and storage. Buffer overflow in network routers and queues is analyzed using the same absorbing random walk: the buffer level walks up and down until it either empties or overflows.

Learn the Gambler's Ruin and you've met a model that links probability theory, finance, biology and statistics in one elegant theorem. See also the related ideas in central limit theorem and percolation.

Conclusion

The Gambler's Ruin theorem delivers a sharp message: fairness in each step is not the same as fairness in the long run. When two players with unequal wealth play a fair game, the richer one wins with near certainty — not because of skill, not because of any bias in the coin, but purely because of the asymmetry in bankroll size.

The result is exact, closed-form, and centuries old. Yet it still catches people off guard. No betting system can escape it; no run of luck can permanently reverse it. The only winning move, mathematically, is to avoid the game — or to be the casino.

The same random walk underlies financial ruin, genetic drift, and network stability. Simple rules, fixed boundaries, and a touch of randomness are enough to make the outcome nearly inevitable. That is the quiet power of the Gambler's Ruin.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/gamblers-ruin/Content licensed under CC BY-NC 4.0.