Martingales and Optional Stopping: The Fair-Game Machine
3 min read
A handful of interview questions — gambler's ruin, "can I quit while ahead?", first-passage times — all dissolve under one tool. This article is that tool.
The definition that matters
A process is a martingale if its expected future value, given everything known now, is its current value:
A fair game: no information available today predicts drift. Your bankroll in fair coin-flipping is a martingale; in roulette it's a supermartingale (drifts down). Two non-obvious examples worth carrying:
- If is a fair ±1 walk, then is a martingale (the walk's square grows exactly like on average — variance accumulation made literal).
- For a biased walk with up-probability , the process is a martingale — the exponential trick that unlocks biased-ruin problems.
Optional stopping: no system beats a fair game
The optional stopping theorem (OST): for a martingale and a "reasonable" stopping rule (bounded, or bounded increments with finite expected time — conditions that hold in every interview setting),
No strategy for deciding when to quit — however clever, however adapted to the history — changes the expected outcome of a fair game. This is the mathematically precise version of "there is no betting system."
The machine in action
Gambler's ruin, one line. Start with \20, opponent \80, fair \E[\text{final}] = 20. The final bankroll is \100 (probability ) or \100p = 20 \Rightarrow p = 1/5$. No difference equations needed.
Expected duration, two lines. Using the second martingale: where measures your fortune around... concretely, with absorbing barriers at and starting from , . For 20/80: expected bets. The quadratic — leaving from the middle takes longest — is the law again from the other side.
"Quit while I'm ahead." "I'll flip fair coins and stop the moment I'm +1. I always end positive — free money?" OST says ... yet you do reach +1 with probability 1. The resolution: the strategy needs an unbounded bankroll and unbounded time — the rare, arbitrarily long excursions deep into the red exactly cancel the certain small win. With any finite bankroll , you sometimes bust, and eats precisely your expected gain. The theorem's "reasonable stopping rule" conditions aren't legal fine print; they're where the economics lives — and explaining that is what separates a real answer from a memorized one.
Why traders should care beyond puzzles
- Prices as martingales. Efficient-market logic says properly discounted prices should be (approximately) martingales under the right measure — if tomorrow's price were predictably above today's, buying today would already have moved it. The risk-neutral measure of options theory is exactly the measure making discounted prices martingales; "pricing = expectation" is martingale theory in production.
- Stopped strategies aren't magic. Stop-losses and take-profits reshape the distribution of P&L (clip a tail here, fatten one there) but cannot manufacture expectation from a zero-edge process. Any backtest whose profitability comes purely from exit rules on a driftless underlying is a bug hunt.
- Fair-value bookkeeping. In market-making games, "my expected P&L from here is my current mark" is the martingale property; deviations from it are either edge or error.
The interview version
The biased follow-up completes the pattern: with win probability , apply OST to the exponential martingale , , to get . Sanity check it: at starting with 20 versus 80, ruin is already overwhelming — small edges compound viciously over many bets. Casinos are not lucky; they own a supermartingale and the OST guarantees the rest.