Thought Toys · Chance & inference · Exhibit 119
A casino flips a fair coin until it comes up heads. If that happens on the first flip it pays you $2; on the second, $4; on the third, $8, and so on, doubling. What is a ticket worth? Add it up and the answer is a half times two, plus a quarter times four, plus an eighth times eight — one, plus one, plus one, forever. The fair price is infinite. Nobody will pay twenty dollars for it, and nobody is being irrational.
What you have won per game, as the games pile up ● your running average ● what the house can pay
—
—
Press Play. Each game is a coin flipped until it lands heads, paying two dollars doubled once for every tail that came first. The amber line is the average you have won so far, and the horizontal scale doubles at every step, so a million games fits beside ten.
The line does not settle. It steps up, roughly by a constant amount, every time the number of games doubles — which is what it means for an average to grow like a logarithm. Run it for a million games and a typical run leaves you near twenty dollars a game. Run it for a million million and a typical run would be near forty. Typical, not expected — one enormous win can put any particular run far above the line, and that is exactly why the expected value is infinite while the thing on screen is merely large. There is no number it is heading for. That is the whole of the paradox: the average of this game has no limit, so no price is too high.
Now look at the strip underneath, which shows the last sixty games. Almost every bar is at the floor. Exactly half of all games pay two dollars; three quarters pay two or four. The enormous average is not describing any game you are likely to play. It is being carried entirely by the tall spikes, and each spike is twice as rare and twice as large as the last, so their contributions never shrink.
Then find the resolution, which is the first slider. A real casino cannot pay an unbounded prize; it has a bankroll. Cap what the house can pay at two to the L, and the fair price of the ticket is not merely finite — it is exactly L + 1 dollars. A house good for a million pays $21 a ticket. A house good for a billion — a thousand times richer — pays $31. Ten more dollars for a thousandfold more money.
Read that number carefully, though, because “worth $21” is an average and not a promise. The capped game has a perfectly good expected value and a colossal variance: a player buying tickets at exactly the fair price loses money steadily for a very long time and is bailed out by one rare enormous win. The proof behind this page had to widen its own test band to allow for that — two million plays of the capped game still land several dollars away from the closed form. A price can be exactly right and still be a bad thing to pay this week.
So the infinity was never in the coin. It was in the tail of the sum, made entirely of payouts no counterparty on earth could honour. Cross that out and the paradox goes with it, leaving a number about the size of what people actually offer. Press Make the house infinitely rich to put the infinity back and watch the fair price stop being a number while the typical game does not change at all.
One more thing worth doing. Set your ticket price above the line and run it: you lose steadily, then a spike arrives and hands it all back, then you lose steadily again. A game with an unbounded mean does not make you rich. It makes your fortune a staircase you cannot plan around.
The rule, exactly. A fair coin is flipped until the first heads. If that is flip k, the payout is 2k, capped at the house's bankroll.
E[payout] = Σk≥1 2−k · 2k = 1 + 1 + 1 + … capped at 2L: E[payout] = L + 1Every term of the uncapped sum is exactly one. Each doubling of the prize is cancelled precisely by the halving of its chance, so the series has no tail small enough to ignore and no last term. Nicolaus Bernoulli posed the problem in 1713; his cousin Daniel published the best-known answer in the St Petersburg Academy's proceedings in 1738, which is how a problem from Basel got a Russian name.
The coin is flipped at most 1000 times — a run that long has probability about 10−301, and 21000 is the largest payout that is still a real number in a browser — so what you are watching is technically a capped game with a cap nobody will ever reach. The page never claims to have measured an infinite average; it only ever shows you one that is still going up.
Verified in node before this page existed
(improve/verify/119-st-petersburg.js, 28 checks):
Also in Chance & inference: Buffon's needle →