When to stop tossing a coin
Worth reading first: When to stop looking · Add the odds from the end.
When to stop looking solved the secretary problem — choose the best of a sequence of candidates, seen one at a time, with no going back — and found that the best rule waits through the first of the sequence and then takes the first candidate better than all before. The essays that followed it changed the information, the payoff and the memory allowed, and the rank that remembers every value ended on a problem whose answer is still unknown.
This essay takes a problem with no candidates at all. A fair coin is tossed repeatedly. After each toss the player may stop, and is then paid the proportion of tosses so far that came up heads. Yuan Shih Chow and Herbert Robbins posed it in 1965, and it is the cleanest example of optimal stopping with an infinite horizon: the player can always wait, the coin never runs out, and the question is entirely when.
The first toss, and why the game is not trivial
If the first toss is a head, stop: the proportion is one, the most possible. The whole game is about what to do after a tail, or after a run that leaves heads only slightly ahead.
Waiting can never hurt in one sense. A fair coin’s lead — heads minus tails — performs a symmetric random walk, and a walk that comes home showed that such a walk returns to every level infinitely often. A player who waits will see heads lead again, and again, with certainty. So the player can always guarantee a proportion above a half, and the game is worth at least a half. But waiting also dilutes: a lead of one after three tosses is a proportion of , a lead of one after a hundred tosses is . The longer the wait, the less a given lead is worth, and the trade-off between waiting for a bigger lead and keeping the lead already in hand is the content of the problem.
Solving it backwards
The standard tool is backward induction: the value of a position is the larger of the payoff for stopping now and the average of the values of the two positions the next toss leads to. That needs a last toss to start from, and the game has none. The figures supply an artificial horizon : at tosses the value of a position with heads is replaced by , which the player can certainly secure from there by waiting for the lead to become positive. Working back from the horizon then gives, for every earlier position, a value that is a guaranteed lower bound on the true one — achieved by a rule that plays optimally until the horizon and then simply waits for a lead.
The lower bounds rise with the horizon — at 500 tosses, at 4,000, at 8,000 — and approach the true value from below, slowly, because the positions close to the horizon are undervalued and that undervaluation seeps back. The true value is about . Olle Häggström and Johan Wästlund established it to six decimal places in 2013 by combining a lower bound of this kind, pushed to horizons of millions of tosses, with an upper bound obtained by replacing the far future with the Brownian motion that a long coin-tossing walk resembles. Before their work the value was known only roughly, although the game had been studied for almost fifty years.
Where the boundary lies
The hero figure shows the rule that the induction produces. After one toss it stops on a lead of one — a single head. After two tosses it stops on a lead of two, both heads. After three, on a lead of three, all heads: is not enough. After four, a lead of two — three heads in four — is enough. The thresholds then grow, irregularly at first.
The tree shows the small-case structure. The least lead at which the rule stops after one to six tosses is : stop at , , , , and , but toss on from and . The zigzag comes from the lead changing by two at a time, so that an even number of tosses allows only even leads; the rule has to weigh a lead of two against a lead of four, with nothing between. Only after many tosses does the threshold settle into a smooth law.
That law is a square root. Chow and Robbins proved that the optimal rule stops as soon as the lead reaches some threshold , and Aryeh Dvoretzky showed that tends to a constant. The constant had been computed by Larry Shepp in 1969 for the continuous version of the game, in which a Brownian motion replaces the coin and the payoff is : the optimal rule stops when with , the root of an equation built from the normal distribution’s tail.
The ratio zigzags, because the lead moves in steps of two, and averages for between 1,000 and 3,000 — below Shepp’s and creeping towards it. The approach is slow, and the finite horizon pulls the computed thresholds down a little, since the induction undervalues waiting near the horizon. The square root itself is the scale of a random walk: after tosses the lead is typically about in size, so the rule stops when the coin is about standard deviations ahead.
Simple rules, and two exact numbers
The best rule is complicated, and simpler rules are close to it. Two of them pay numbers that can be computed exactly.
Stop the first time heads lead. The lead first reaches at some toss , necessarily odd, and the proportion then is . The average payoff is , and the distribution of is classical: the chance that the first lead comes at toss is a Catalan number over , the count that the path folded at its first touch obtained by reflection. Its generating function is , and integrating it against from nought to one gives . So the rule pays exactly
which the figure confirms by summing the series to two hundred thousand terms.
Stop the first time heads lead by two. Now the first passage is to , the proportion is , and the generating function is the square of the previous one. The same integral gives , so the rule pays exactly — far worse than stopping at a lead of one, because demanding two from the start throws away every game that would have stopped on a first head. The backward induction, evaluating the rule over 4,000 tosses, gives , the small deficit being the horizon.
Stop when the lead reaches . Shepp’s rule, copied directly from the Brownian solution with a minimum lead of one, pays , within a thousandth of the best rule’s on the same horizon. Its threshold is fractional while the lead is a whole number, so in practice it stops on the first whole-number lead at or above the curve, which early in the game means waiting for leads the best rule would not wait for. The best rule’s extra comes from the small-case corrections — stopping on rather than waiting, tossing on from — that a smooth curve cannot make.
That and appear as the payoffs of the two simplest rules, while the optimal payoff has no known closed form, is the same pattern as in much of this subject: the natural rules are exactly computable, and the best rule is a numerical object.
Where π comes from
The appearance of in the payoff of the first-lead rule deserves a second look, because nothing in the game mentions a circle. The integral that produces it,
is an integral of a square root of , which is the height of a unit circle above the point ; substituting turns it into an integral over an angle, and the is a quarter-turn. The square root, in turn, comes from the Catalan numbers: their generating function solves a quadratic equation, because a path that first reaches either does so at once or first dips and then makes two independent first passages, and solving the quadratic produces the square root. So the chain runs from a recursive decomposition of coin-tossing paths, through the Catalan numbers, to a quadratic, a square root, a circle and .
The for a lead of two comes from the same square root, squared, because a first passage to is two first passages to in succession. The integral of the squared generating function has no circle in it: the square of contains a term that integrates to a logarithm. The two simplest stopping rules therefore pay the two most familiar transcendental constants, and for a structural reason. The pattern continues: waiting for a first lead of three pays , back to because an odd power of the square root survives, and every longer wait pays less.
The game as a race between two scales
The game can also be read as a contest between two quantities that grow at different rates with the number of tosses. The lead grows like — that is the size of a random walk’s typical excursion — while the number of tosses grows like . The proportion of heads exceeds a half by the lead divided by , which shrinks like . So every lead the player could hope for is worth less the longer the game runs, but the walk also produces larger leads given time. The optimal rule balances the two, and the balance is struck at a lead proportional to , where both effects scale the same way.
That is why the Brownian version of the game, which keeps only the scales and forgets the coin, captures the rule for large exactly. It is also why the rule’s small-case behaviour is irregular: for the first few tosses the lead can only take a few values, the square-root scale is not yet meaningful, and the rule is decided by the arithmetic of particular fractions — against waiting, against waiting — rather than by any smooth law. Add the odds from the end found the same contrast in the secretary problem, where an exact rule for small numbers of candidates gives way to a limiting rule, the threshold, as the number grows.
Two hundred thousand games
The rule computed above can be played.
Half of all games end on the first toss, with a head. Three-quarters end within 46 tosses. One in ten lasts beyond 1,870 tosses, and one in a hundred beyond a hundred thousand — the games in which an early run of tails puts the player far behind, and the rule waits for the walk to come back, which it always does, but on a timescale with no finite average. The average payoff over the two hundred thousand games is , matching the computed value within sampling error. Fewer than seven per cent of games outlast the 4,000 tosses the rule was computed for, and those are finished by waiting for heads to lead.
The long tail is the price of the guarantee. A player who could not afford to wait — who had to stop by some fixed number of tosses — would face a different and less valuable game, and the secretary problem and its relatives are all games of that bounded kind. The Chow–Robbins game is worth because waiting is free, and the rule uses that freedom heavily in a few games to gain a little in many.
What an oracle would add
A player who could see the whole sequence of tosses in advance would stop at the moment the proportion of heads is highest. Over twenty thousand seeded sequences of twenty thousand tosses, that highest proportion averages about — so an oracle, playing the same game with perfect foresight, earns only about two points more than the best honest rule’s . Half of what an oracle takes found a guaranteed ratio of one half between an honest player and an oracle when the values are independent and arbitrary; here the honest player gets more than ninety-seven per cent of what the oracle gets. The difference is the structure of the coin: the proportion of heads changes slowly and predictably once many tosses have been made, so there is little for foresight to exploit, and much of the oracle’s advantage must come from the first few tosses, where a single head or tail moves the proportion a long way.
Waiting is a fair game
The game sits on top of a fact that two barriers and a fair game proved: a fair game stays fair under any stopping rule that cannot see the future, provided the game cannot run too long. The lead of heads over tails is a fair game, and no rule can make its expected value at stopping positive if stopping times are bounded. Yet the Chow–Robbins player stops with a positive lead almost every time.
There is no contradiction, because the payoff is the proportion of heads, not the lead, and because the stopping times here are not bounded — some games last a hundred thousand tosses. The proportion is the lead divided by the number of tosses, and a rule that stops on small leads early and waits long when behind turns a fair walk into a positive expected proportion. Peeking until the answer is yes met the same mechanism in statistics, where an experimenter who stops a trial as soon as the data look significant manufactures significance from noise; the coin player is doing the same thing deliberately and is paid for it.
Lower bounds from a game cut short
Every value in the figures is a lower bound on the true game, exact for the truncated game it solves. The thresholds are exact for the truncated game and very close to the true ones for positions far from the horizon; near the horizon they are biased towards stopping, which is why the square-root ratio sits a little low. The simulated games use the computed thresholds and a seeded generator, and agree with the computed value. The exact payoffs and are derived from first-passage generating functions, and the series and the induction confirm them numerically.
The computations do not give an upper bound, so by themselves they cannot fix the value’s sixth decimal; that took Häggström and Wästlund’s comparison with Brownian motion, which bounds what the far future can add.
Still open: the value’s closed form, and the exact boundary
The value of the Chow–Robbins game is known numerically and has no known closed form; nobody knows whether it is expressible through familiar constants, as the simple rules’ payoffs are. The exact stopping boundary is also not fully known: Häggström and Wästlund determined the optimal decision in every position up to a very large number of tosses except for a handful of positions where the computed lower and upper bounds overlapped, and a few such positions — leads at which it is not known whether to stop — remained undecided. The question for each is whether the value of continuing exceeds the current proportion, and the margins are smaller than the methods could resolve. Whether a finer computation or an exact argument decides them all, and whether the boundary is eventually exactly the integer nearest to some smooth function of , are open questions about a game a child could play.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A polynomial that counts — both name catalan numbers, generating function
- A walk that follows its own footsteps — both name martingale, random walk
- Counting the paths that go wrong — both name catalan numbers, random walk
- Every third coefficient — both name generating function, random walk
- Evidence measured in decibans — both name martingale, random walk
- Giving up on the best — both name backward induction, optimal stopping
Named objects
A dashed tag is an object no other essay names yet.
Backward inductionCatalan numbersGenerating functionMartingaleOptimal stoppingRandom walk