Math paradoxes

The St. Petersburg paradox The pot doubles until the first tails. What is the game worth?The average win is infinite.

A fair coin is flipped until it lands tails. The pot starts at $2 and doubles with every heads. When tails comes, you take the pot. What do you win on average? In other words, what is a fair price for one game? Lock in your answer, then play, run millions of games and see how the Bernoullis dealt with it.

A fair coin is flipped until the first tails; the pot starts at $2 and doubles with every heads. The expected win is infinite: every possible outcome adds exactly $1 to the average, and there are infinitely many outcomes. Yet nobody would pay even $100 to play, and half the games pay just $2. Here you play yourself, run millions of games and see how Bernoulli, Cramer and Feller tackled the paradox.

Make a guess
∞expected value
$2the win in half the games
The puzzle

A casino offers a coin game

The rules fit in one line, and you never leave empty-handed: you get at least $2. The only question is how much it is worth paying to get in.

  1. 1

    The coin

    The coin is fair: heads and tails each come up with chance 1/2, and flips are independent. It is flipped again and again until tails comes up for the first time. Then the game ends.

  2. 2

    The pot

    Before the first flip the pot holds $2. Every heads doubles it: $4, $8, $16 and so on. Tails stops the game and you take whatever is in the pot.

  3. 3

    The win

    If the first tails comes on flip number k, you win 2k dollars:

  4. 4

    The question

    What is the average win if you play very many times? Mathematicians call this number the expected value. It is taken as the fair price of the game: pay exactly that, and on average neither you nor the casino comes out ahead.

Intuition says

"A few dollars, ten at most"

In fact the average win is infinite. Every row of the table on the left adds exactly $1 to it: half the chance, but twice the pot. There are infinitely many rows, so the sum grows without bound. And at the same time half the games end on the very first flip with a win of $2.

Model assumptions

  • The coin is fair and flips are independent.
  • The casino pays any amount, even a billion or a trillion.
  • The fair price of the game equals the average win over very many games.

The second assumption is unrealistic, and that is one of the keys to the paradox. Rounds 4 and 5 take it apart.

Round 1 · Guess

What does the game pay on average?

Pick an option before reading on. We mean the average win per game if you play millions of times.

Average win per game

Reminder: tails on flip 1 pays $2, on flip 2 $4, on flip 3 $8, and so on.

A breakdown of your answer will appear here.

Round 2 · Game

Pay the entry fee and play

You have already played 100 games at a $20 fee each. Keep playing one at a time to see the coins, or 100 or 10,000 at once to see the balance. Change the fee and compare: at what price does the game start paying off?

Entry fee per game
Games0
Balance0
Biggest win–

Your balance after each game

Mean win–
Median win–

Round 3 · Simulation

Six players, a million games each

If the mean were finite, a player's average win would settle near it after many games. Here it never settles: it creeps upwards, and big wins kick it up now and then. The games axis is logarithmic.

average win of each of the 6 players log₂ n (dashed)
Average over 1,000,000 games, per player
Biggest win in 6,000,000 games
–
Games paying $4 or less
–
exactly 3/4 = 75%

The dashed log₂ n is an approximation, not an exact curve: William Feller showed that the total win over n games divided by n · log₂ n tends to 1. A typical player in the simulations runs a little above it, by about 2 to 3 dollars.

How often each win comes up

Bars: the exact chance 1/2k. Dots: the share in the 6,000,000 simulated games. The vertical scale is logarithmic, each step is 10 times smaller.

exact chance simulation

How much each win adds to the average

A row's contribution is its chance times its win. In exact terms it is $1 for every k. In the simulation the rare wins either did not happen at all (0) or happened once and added too much.

exact: $1 per row simulation
Round 4 · Five explanations

An infinite average nobody will buy

The calculation is simple and correct. The paradox is that it disagrees with how sensible people behave. Here are five ways to see where the gap comes from.

Row by row

Every row adds exactly $1

The chance that the first tails comes on flip k is 1/2k, and the win is 2k. The product is always $1. Row one gives $2 · 1/2, row two $4 · 1/4, row ten $1024 · 1/1024. The mean is the sum of all rows: 1 + 1 + 1 + … The more rows, the bigger the sum, with no limit.

A typical game

Tiny chances drag the mean up

A win of $4 or less75%three games in four
A win of $1024 or more1/512about 0.2% of games

Half the games pay $2, and the median win is $2 too. 15 games in 16 pay $16 or less. The infinity of the mean lives in rows that almost never happen: the chance of winning a million dollars or more is 1/524,288, about 2 in a million. A person who plays once is right to think in medians, not means.

A limited bank

A real casino cannot pay a trillion

The casino hasMean win

If the pot exceeds what the casino owns, the player gets only what the casino has. Then the rows are cut off past a certain point and the mean becomes finite. Even a trillion-dollar bank gives only about $41: every thousandfold increase in wealth adds roughly $10. Back in 1777 Buffon calculated that after 29 heads in a row there would not be enough money in the whole Kingdom of France to pay out.

The utility of money

The second million pleases less than the first

Daniel Bernoulli, logarithm$4the game feels like a sure $4
Gabriel Cramer, square root$5,83(√2 + 1)² = 3 + 2√2

Daniel Bernoulli proposed counting not dollars but their usefulness: doubling your wealth always brings the same joy, so utility is proportional to the logarithm. Measured that way, the game's mean utility is finite and equals the utility of a sure $4. Taking the player's wealth into account, a person with $1,000 should sensibly pay up to $10.95, and a millionaire up to $20.87. Cramer reached a similar conclusion with the square root as early as 1728.

Many games

The average grows, but very slowly

1,000 games≈ $12–13a typical player; log₂ 1000 ≈ 10
1,000,000 games≈ $22–23a typical player; log₂ 10⁶ ≈ 20

Play n games and you will typically see one win of about n dollars, two of about n/2, and so on. Each level gives roughly $1 per game, and about log₂ n levels have time to show up. So the average win per game grows like log₂ n (a typical player runs 2 to 3 dollars above it): to raise it by $1 you need twice as many games. Infinity is reached only after infinitely many games.

A similar trap with expected values sits in the two envelopes paradox: there too the "on average it pays to switch" argument breaks down on infinite means.

For formula lovers

The expectation, the truncated series and utility

P(first tails on flip k) = 1/2k,   win X = 2k
E[X] = Σk≥1 2k · 2−k = 1 + 1 + 1 + … = ∞
Bank capped at B, L = ⌊log₂ B⌋:   EB = Σk≤L 1 + B · Σk>L 2−k = L + B / 2L  →  B = 10⁶: 19 + 1.91 = 20.91
Log utility: E[log₂ X] = Σ k / 2k = 2  →  CE = 2² = $4
Square root: E[√X] = Σ 2−k/2 = 1 / (√2 − 1)  →  CE = (√2 + 1)² = 3 + 2√2 ≈ $5.83
Feller: (X1 + … + Xn) / (n · log₂ n) → 1 in probability

CE stands for "certainty equivalent": the guaranteed amount the player finds exactly as attractive as the game. For plain dollars (linear utility) it is infinite; for the logarithm and the square root it is finite, because big wins count for less and less. The bank formula explains the table above: the first L rows give $1 each, and all longer games together bring B times the chance of getting that far, 1/2L.

Round 5 · Going further

The bank, utility and a fair price for a series

Three ways to make infinity finite: limit the casino, count utility instead of dollars, or ask about a series instead of one game. A simulation checks every result here.

How much does the casino have?

Mean win
Simulation, 1,000,000 games–

A logarithm in the price

A casino ten times richer, +$3.3

The cut-off works like a logarithm: the mean win is log₂ B plus about one dollar. Making the bank ten times bigger adds only log₂ 10 ≈ 3.3 dollars. For the fair price to reach $100, the casino would need about 299 dollars, a number with 30 digits.

A simulation of a million games matches the exact answer well for small banks. For a billion and up it usually shows less: wins above 10 million come up less than once per 8 million games, and their dollars simply do not make it into the sample. It is the same effect as in round 3.

How do you value money?

Utility
Your wealth before the game
Simulation, 1,000,000 games–

Bernoulli, 1738

The price depends on who pays

For Bernoulli the utility of an extra dollar is inversely proportional to how much a person already has. Hence the logarithm. Then "how much to pay" has an answer that depends on wealth: for a poor player even a $5 entry is too risky, while a millionaire can easily pay $20.

The weak spot of this answer: for any unbounded utility function you can design a game with even faster-growing wins, and the paradox comes back. Karl Menger pointed this out in 1934. For the logarithm, for example, it is enough to pay out 2 to the power 2k dollars.

How many games to come out ahead?

share of players ahead after n games (simulation)

A series instead of one game

Any fee pays off, but not soon

An infinite mean means this: for any fixed fee, the share of players who are ahead tends to 100% as the number of games grows. But the higher the fee, the more patience you need. At $10 per game, about 4 players in 5 are ahead after 1,000 games. At $20, even after a million games about one in five is still behind.

William Feller proposed looking at exactly that, the series: a fair total fee for n games is about n · log₂ n dollars, that is log₂ n per game. Each point here comes from several hundred independent series, and for each number of games the simulation counts what share of them ended ahead.

Bonus · Fun facts

Things to tell your friends

1713

Nicolaus Bernoulli's letter

Nicolaus Bernoulli first posed the problem in a letter to the French mathematician Pierre Rémond de Montmort dated 9 September 1713. Nicolaus himself suggested that people simply ignore very unlikely events.

1738

Where the name comes from

Nicolaus's cousin Daniel Bernoulli published a solution based on the utility of money in the Commentarii of the St. Petersburg Academy of Sciences (Commentarii Academiae Scientiarum Imperialis Petropolitanae). Hence the paradox's name. Bernoulli wrote that any fairly reasonable man would gladly sell his chance for twenty ducats. In his version the pot started at one ducat.

1728

Cramer got there first

Ten years before Daniel Bernoulli, the Geneva mathematician Gabriel Cramer suggested in a letter to Nicolaus Bernoulli that the value of money be measured by a square root. He remarked that mathematicians value money in proportion to its quantity, while sensible people value it by what they can do with it.

2048

Buffon's experiment

In 1777 Georges-Louis Leclerc de Buffon described 2,048 real games. The longest lasted 9 flips (there were 6 of those), and 1,061 games ended on the first flip. In our dollars that is $20,114, about $9.82 per game. Buffon's first prize was 1 rather than 2, so he got 10,057 units, about 4.9 per game. It is one of the first statistical experiments in history.

n · log₂ n

Feller's price for a series

William Feller proved a law of large numbers for this game in an unusual form: the total win over n games divided by n · log₂ n tends to 1. So a fair fee for a series of n games is about n · log₂ n. Curiously, at that fee the player in simulations wins the series about 4 times in 5, so a casino would hardly accept that price.

$4

Bernoulli's certainty equivalent

If the utility of money is a logarithm, the game's mean utility is log₂ 4 = 2. So, ignoring other wealth, the game is worth a guaranteed $4. A person with $2 should borrow $1.35 and pay up to $3.35, and one with $1,000 up to $10.95.

Discussion

What do you think?

Share your own explanation, an objection or a variant of the puzzle. You need a GitHub account to comment.

Newsletter

New puzzles, explanations and discussions

I keep adding new puzzles, new ways to explain them and write-ups of the discussions they start. Leave your email and I'll write when something new is out. No spam, one-click unsubscribe.

The sign-up form will appear here soon.