On this page
The game is fair, but can you choose *when to stop* so the odds tip your way? No. The martingale and the optional stopping theorem show why.
What is a martingale?
A martingale is a sequence of random values where the expected next value, given everything seen so far, equals the current value (Wikipedia: Martingale (probability theory))). Paul Lévy introduced the idea in 1934, Jean Ville named it in 1939, and Joseph Doob did much of the early development.
Two martingales do all the work below. Let S_n be your money after n fair ±₹1 tosses; S_n is a martingale. So is S_n² − n: after one more toss the square becomes (S + 1)² or (S − 1)², which average to S² + 1, and subtracting 1 for the extra toss keeps it level. The conditional-expectation step behind this is built in our post on the law of total expectation and the tower rule.
What does the optional stopping theorem say?
A stopping time τ is a rule for when to stop that uses only what has happened so far, such as "stop when I hit ₹0 or ₹10". It cannot peek at future tosses.
The theorem says the expected value of a martingale at a stopping time equals its starting value, E[X_τ] = E[X_0], provided one of three conditions holds (Wikipedia: Optional stopping theorem):
τ is bounded: you always stop by some fixed round.
E[τ] is finite and each step is bounded in size.
The stopped process is bounded: your value stays in a fixed range until you stop.
How do you derive gambler's ruin with optional stopping?
The problem is old: its earliest known mention is a 1656 letter from Blaise Pascal to Pierre de Fermat (Wikipedia: Gambler's ruin).
You start with ₹k and win or lose ₹1 on each fair toss, stopping at ₹0 (ruin) or ₹N (target). Let p be the probability of reaching N first.
Step 1: the win probability. Your money stays between 0 and N until you stop, so condition 3 holds. Apply the theorem to S_n:
E[S_τ] = S_0, so p · N + (1 − p) · 0 = k.
Therefore p = k/N.
Step 2: the expected number of tosses. Apply the theorem to S_n² − n (strictly, to the bounded time min(τ, n), then let n grow):
E[S_τ² − τ] = k², so E[τ] = E[S_τ²] − k².
S_τ² is N² with probability k/N and 0 otherwise, so E[S_τ²] = kN.
Therefore E[τ] = kN − k² = k(N − k).
Both results match the gambler's ruin theorem in MIT's 18.445 lecture notes (MIT OpenCourseWare, Lecture 16).
Worked example. Asha has ₹30, her cousin has ₹70, and they toss a fair coin for ₹10 a toss until one is broke. In units of ₹10, k = 3 and N = 10, so Asha wins everything with probability 3/10, and the game lasts 3 × 7 = 21 tosses on average. Fair odds, yet the poorer player is more likely to be ruined.
Why does the doubling strategy not beat a fair game?
The doubling system, a betting strategy also called a martingale, goes like this: bet ₹1; after every loss, double the bet; stop at the first win (Wikipedia: Martingale (betting system))). Lose n times and then win, and you have lost 2^n − 1 and won 2^n: a net ₹1, every time. So E[X_τ] = X_0 + 1. Which condition fails?
Bounded time: no. A losing streak can be any length.
Bounded steps: no. E[τ] is finite (2 tosses on average), but the bets 1, 2, 4, 8, … grow without limit.
Bounded stopped process: no. Before the win, your running loss has no floor.
Now give yourself ₹63, enough for six straight losses (1 + 2 + 4 + 8 + 16 + 32 = 63); the sixth loss ends the game. Your money stays in a fixed range, condition 3 holds, and the theorem forces the expected gain to zero. Check: you win ₹1 with probability 63/64 and lose ₹63 with probability 1/64, and 63/64 − 63/64 = 0. Doubling trades many small wins for one rare, large loss. On American double-zero roulette, where an even-money bet loses with probability 10/19, the same 63-unit plan loses about 0.36 units on average each time it is played through (Wikipedia: Martingale (betting system))).
How do you check a stopping argument?
Before writing E[X_τ] = E[X_0] in an answer, ask:
Is X a martingale? Check E[next | past] = current for one step.
Is τ a stopping time? Stopping at n may use only rounds 1 to n.
Which of the three conditions holds? Name it. If none does, as in doubling, the theorem cannot be used.
The same one-step test shows why the red share in the Pólya urn model is a martingale. For a different stopping question, see the secretary problem and its 1/e rule.
If stopping times feel shaky, the Fermi Concept Library gives every mathematics concept its own lesson, and the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning.



