edgekit

Gambler’s ruin & fair games

A gambler with a finite bankroll bets one unit at a time against a target: what is the chance of reaching it before going broke, and how long does the game last? This is the oldest problem in probability with a modern pulse — the exact mathematics of drawdown limits, prop-firm rules, and bet sizing. This chapter solves it three independent ways — first-step analysis, martingales, pure symmetry — because each method generalises in a different direction, then extracts the consequences: a fair game against a deep pocket is a losing game, ruin probability is exponentially sensitive to edge, and when the odds are against you the correct play is to bet big, not small.

Intuition — a linear resource against an exponential penalty

Hold two pictures. In a fair game, expected bankroll is conserved, so the probabilities of the two endings split in proportion to the distances: starting at out of , you reach the target with probability exactly — a straight line in . In a biased game, every unit of distance gets taxed by the same factor , and taxes on distance compound: the relevant quantity is , an exponentialin the bankroll. Linear resource, exponential penalty — that mismatch is why a 1–2% edge deficit, invisible in any single round, is catastrophic over a campaign, and why everything in this chapter reduces to controlling the exponent.

The setup and the two questions#

You start with a bankroll of units and play repeated one-unit bets: each round you win with probability and lose with probability , rounds independent. The game stops when the bankroll first hits (ruin) or a target (success). In the language of Markov chains this is a birth–death chain on with two absorbing states, and absorption is certain. Two questions carry everything:

  • Where does it end? .
  • How long does it take? , the expected number of rounds until absorption.

The problem made a cameo in martingales & optional stopping; here it gets the dedicated treatment, solved three ways on purpose — the same answer from a difference equation, a stopped martingale, and a conservation law is how you know the answer.

Method 1 — first-step analysis#

Condition on the first bet, exactly as in the first-step analysis of Markov chains. From state you move to with probability or with probability , and the memoryless structure restarts the problem from the new state:

Proof — solving the difference equation by telescoping

Since , rewrite the left side as and regroup:

The successive differences form a geometric sequence, with (equivalently: the characteristic equation has roots and , so the general solution is ). Telescope from :

The other boundary fixes , giving the biased-game answer; when (fair game) the differences are all equal, so and forces .

Sanity checks: as the biased formula collapses to (all differences become equal) — the fair case is the limit, not a separate universe — and your opponent’s success probability (start , win-probability ) plus yours sums to 1: absorption is certain, nobody plays forever.

Method 2 — martingales: two-line answers#

With the optional stopping theorem in hand from martingales & optional stopping, both cases collapse to one substitution each. Let be the bankroll and the absorption time; the stopped process is bounded in with , so stopping is legal throughout.

  • Fair case. is itself a martingale, so . But , so , i.e. .
  • Biased case. is the exponential martingale (the MGF-killing choice ), so with : , which rearranges to .

Same answers, a tenth of the work. First-step analysis needs no theory and survives state-dependent transition probabilities; the martingale route needs machinery but transfers verbatim to continuous time, pricing barrier-hitting for Brownian motion in the same two lines (random walks & Brownian motion).

Method 3 — symmetry: no free lunch in a fair game#

The fair case needs no computation at all. A fair bet conserves expected wealth; a sequence of fair bets, stopped by any rule that cannot see the future, still conserves it. Your expected final bankroll therefore equals your starting bankroll. But the final bankroll is either or — nothing in between survives — so

Read it as a no-free-lunch statement: in a fair game, the probability of multiplying your stake by is exactly — probability times payoff multiple equals one, always. No bet-sizing pattern, stopping rule, or streak-reading system moves it, because any adapted scheme keeps wealth a martingale. Every claimed system for beating a fair game hides an assumption of infinite credit somewhere — dissected as the doubling-system counterexample in the martingale chapter.

How long does the game last?#

First-step analysis answers the duration question with the same move: condition on round one, which costs one round and restarts the clock from the new state.

Proof — the fair-case duration is k(N − k)

With the recursion says the second difference of is constant: . A particular solution is ; the homogeneous solutions are ; so . The boundaries and force , :

The martingale route lands the same place in one line — stop ; Wald’s second identity is the same fact under another name. For the biased game, stop the drift-compensated walk instead: .

The size of the fair-case answer is the striking part. Trying to double 50 into 100 by unit bets: rounds. The product form says games starting near a barrier end fast while centred games last quadratically long — diffusion covers distance like , so distance costs time of order . A fair game is not just unprofitable in expectation; it is a spectacular waste of time.

The infinitely rich opponent#

Now let the opponent be a casino, a market, or anyone whose bankroll you cannot exhaust: send and ask for the probability of escaping ruin forever.

  • Fair game (): . Ruin is certain.
  • Unfavourable game (): , so . Ruin is certain, and faster.
  • Favourable game (): , so and . Ruin probability , exponentially small in the bankroll.

The first bullet deserves a pause, because it violates most people’s intuition about the word “fair.” Round by round you are not being cheated; yet against a deep enough pocket you lose everything with probability 1. The mechanism: the fair walk is recurrent — it will visit 0 eventually — and once your target is removed, the only absorbing state left is your ruin. A fair game against an infinitely rich adversary is a losing game; the casino does not even need its house edge to beat a patron who keeps playing — the edge just collects the inevitable sooner. On the favourable side: with gives ruin probability — a genuine 10-point edge still loses everything 13.4% of the time when the bankroll is only ten bets deep.

Sensitivity to edge: why 1% is catastrophic#

Fix , — a campaign to double a bankroll — and dial the win probability down by steps a single session could never detect:

A one-point deficit nearly doubles the ruin probability; two points make success a 1-in-56 shot; five points, 1-in-23,000. The mechanism is the exponent: for near , , so

At the per-round tax is 2 cents on the dollar, but over units of distance the exponent is , and already dominates the arithmetic. Edges do not add across a campaign; they compound.

Ruin probability as a function of starting bankroll k for win probabilities 0.50, 0.49, 0.48 and 0.45 with target 100, showing the fair-game straight line against biased curves collapsing toward certain ruin
Ruin probability against starting bankroll k for a target of N = 100. The fair game is the straight line 1 − k/N; every biased curve bows toward certain ruin, and by p = 0.45 the curve hugs 100% until k is nearly the whole target. The gap between curves is governed by (q/p)^k ≈ e^{2(q−p)k} — ruin probability responds exponentially, not linearly, to the per-round edge.
ruin_check.py
import numpy as np

rng = np.random.default_rng(21)

def theory(p, k, N):
    """Closed-form (ruin probability, expected duration)."""
    if p == 0.5:
        return 1 - k / N, k * (N - k)
    r = (1 - p) / p
    win = (1 - r**k) / (1 - r**N)
    return 1 - win, (N * win - k) / (2 * p - 1)

def simulate(p, k, N, reps=20_000):
    """Vectorised gambler's ruin: (ruin frequency, mean duration)."""
    s = np.full(reps, k)
    active = (s > 0) & (s < N)
    steps = 0
    while active.any():
        n = active.sum()
        s[active] += np.where(rng.random(n) < p, 1, -1)
        steps += n
        active = (s > 0) & (s < N)
    return (s == 0).mean(), steps / reps

k, N = 50, 100
print(f"{'p':>5} | {'ruin sim':>9} {'ruin theory':>12} | {'E[T] sim':>9} {'E[T] theory':>12}")
for p in (0.50, 0.49, 0.48, 0.45):
    r_sim, t_sim = simulate(p, k, N)
    r_th, t_th = theory(p, k, N)
    print(f"{p:>5.2f} | {r_sim:>9.4f} {r_th:>12.4f} | {t_sim:>9.1f} {t_th:>12.1f}")
# Expected: ruin 0.5000 / 0.8808 / 0.9821 / ~1.0000; fair-case duration 2,500.

Bold play vs timid play#

Bet size is a free parameter the formulas price exactly: betting units per round is the unit-bet problem with and — rescaling shrinks the exponent. The consequence is a rule most people find backwards: when the game is unfavourable, bet big; when it is favourable, bet small. Each round of a negative-edge game is another chance for the house to collect its tax; subdividing a campaign into many small bets maximises the number of collections, and bold play minimises them.

Worked example — turning 50 into 100 at p = 0.47

Target: double a 50-unit bankroll at win probability ().

  • Timid — unit bets (): — a 0.25% chance.
  • Medium — 10-unit bets (): — 35.4%.
  • Bold — one double-or-nothing bet (): — 47%.

Same game, same goal, and the win probability spans a factor of nearly 190 purely through stake size: the single maximal bet exposes the edge deficit exactly once, while grinding is maximally ruinous. Flip the edge and everything reverses — at , unit bets succeed of the time while the bold bet wins only 53%: with an edge you want the LLN grinding for you, in many small installments (LLN & CLT). In the exactly fair game size does not matter: at every stake — bet size buys duration, never probability.

Quant lens — risk of ruin for traders#

Translate the board game into a trading account. Measure everything in R-multiples — one R is the amount risked per trade — with each trade winning with probability or losing with probability . A drawdown limit — yours, or one imposed by a prop firm — sits percent below starting equity. The distance to ruin is then units, where is the fraction risked per trade, and the probability of ever breaching the limit while trading toward an open-ended upside is exactly the infinite-opponent formula:

Every term is a lever. Risking against a limit gives — a prop trader is a gambler five bets from the rail, whatever the account’s notional size. Halving the risk per trade doubles and therefore squares the ruin probability: a 36.7% breach risk becomes 13.4% (Problem 5). That squaring law is the practical content of this chapter for position sizing: size is not a linear dial on risk of ruin, it is an exponent. The growth-optimal resolution of the trade-off is the Kelly criterion, developed there too — full Kelly maximises expected log growth, and any fixed fraction of it buys exponentially better ruin protection at a linear cost in growth rate. And note which side of the table an edge puts you on: you are the house — small bets, long games, let the exponent work for you.

!The formulas assume i.i.d. bets of fixed size

Everything above is exact for independent, identically distributed bets with a constant stake — and real trading violates all three clauses. Serial correlation makes losing streaks longer than the i.i.d. arithmetic allows, effectively shrinking ; volatility clustering means “1R” is not constant precisely when it matters; fat-tailed fills can lose several R in one step, jumping over the barrier arithmetic entirely. Treat as an optimistic floor on ruin risk, not an estimate — and test the dependence structure before trusting it, with the tools of time-series statistics.

Practice problems#

Five problems to test understanding — one workout per method or consequence, numbers carried to the end.

Problem 1 — unequal stakes, fair game

You have 10 units, your opponent has 15; you bet one unit per round on a fair coin until someone is broke. Find your probability of winning everything and the expected length of the game.

Solution. Here , . By the conservation argument (Method 3), your win probability is your share of the total capital: ; ruin probability ; duration rounds. Takeaway: in a fair game the capital split isthe probability split — the richer player wins more often only because the poorer player’s barrier is closer — and the duration is the product of the two distances, not their sum.

Problem 2 — the same game with a 1% edge deficit

Same stakes — , — but now . Compute your success probability and compare it to the fair answer.

Solution. , so , , and

The fair game gave 40%; a one-point edge deficit strips more than a quarter of the winning chances (28.6%), while the expected duration barely moves: rounds against the fair 150. Takeaway: small bias barely changes how long you play but dramatically changes where you end up — drift acts on the destination, variance on the clock.

Problem 3 — deriving the fair-game clock

Derive for the fair game directly from the difference equation, and verify it at , .

Solution. The recursion rearranges to a constant second difference — the discrete analogue of . Integrate twice: plus the linear homogeneous family ; the boundaries give , hence ; at , rounds. Cross-check by stopping : — same answer, two roads. Takeaway: absorbing-barrier durations solve a discrete Poisson equation; recognising the shape turns these from memorised formulas into thirty-second derivations.

Problem 4 — escaping an infinitely rich opponent

You play an infinitely rich adversary with a real edge: , starting bankroll . What is the probability you are never ruined? What does the answer become at , and at ?

Solution. Escape probability with : , so you survive forever with probability — a 2-point edge still carries a 1-in-5 lifetime ruin risk at 20 units of depth. At the escape probability is : ruin is certain whatever — the deep pocket wins fair games by attrition. Doubling the bankroll to squares the ruin term: , survival . Takeaway: with an edge, depth buys safety exponentially; without one, no depth buys any.

Problem 5 — a trader's risk of ruin

A trader risks 2% of equity per trade with 1R payoffs; the win probability is 55% (45% of trades lose 1R). The account dies at a 10% drawdown. Find the probability of eventually breaching the limit; then for the same trader risking 1% per trade; then for a strategy whose win rate is actually 45%.

Solution. The barrier is R-units away and the upside open-ended, so the infinite-opponent formula applies with :

A strategy with a genuine 10-point edge per trade still breaches a 10% drawdown limit 36.7% of the time at 2% risk. Halving the size to 1% doubles to 10 and squares the answer: — 13.4%. And if the win rate is actually 45% — the edge was a backtest artefact — then and the breach is certain, arriving after trades on average. Takeaway: drawdown rules turn trading into gambler’s ruin with a nearby barrier; sizing is an exponent on survival, and a negative-edge strategy does not risk ruin — it schedules it.

Next: from bankrolls absorbing at barriers to events arriving in continuous time — memorylessness, superposition and thinning: Poisson processes.