The St. Petersburg Paradox, Explained

After reading this you will know why a coin game with infinite expected value almost always pays 2 or 4 coins, why its running average grows like the logarithm of the number of plays, and how to price it sensibly anyway.

What the game is

Toss a fair coin until it comes up heads. Count the tosses. If the first head appears on toss k, you win 2^k coins. So heads on the first toss pays 2. Tails then heads pays 4. Tails, tails, heads pays 8, and so on.

Here is the hook. The expected prize is infinite, yet you would not pay 100 coins to play a single round. Most rounds end after one or two tosses and pay 2 or 4. The paradox is the gap between the average, which is infinite, and the typical outcome, which is tiny.

Daniel Bernoulli wrote about this in St. Petersburg in 1738, and the name stuck. It is one of the oldest known cases where expected value fails as a guide to what a gamble is worth.

Where the infinity comes from

The probability that the first head lands on toss k is the chance of k-1 tails followed by one head:

P(k) = \left(\tfrac{1}{2}\right)^{k-1} \cdot \tfrac{1}{2} = \tfrac{1}{2^k}

Here k is the toss number of the first head, and P(k) is its probability. So P(1) = 1/2, P(2) = 1/4, P(3) = 1/8. These add to 1, as they must.

The expected prize multiplies each payout by its probability and sums:

E = \sum_{k=1}^{\infty} \tfrac{1}{2^k} \cdot 2^k = \sum_{k=1}^{\infty} 1 = \tfrac{1}{2}\cdot 2 + \tfrac{1}{4}\cdot 4 + \tfrac{1}{8}\cdot 8 + \cdots

Every term is exactly 1. The prize doubles at each step, and the probability halves, so the two cancel. An infinite sum of ones diverges. The mean prize is \infty.

Why the typical payout is tiny

Infinite mean does not mean infinite winnings. It means a small number of enormous jackpots drag the average up without limit. Look at how the probability mass sits.

Payout, probability and share of games, first six outcomes
First head on toss kPayout 2^kP(k)Share of games
120.550%
240.2525%
380.12512.5%
4160.06256.25%
5320.031253.125%
6640.015631.563%

Add the first four rows: 50 + 25 + 12.5 + 6.25 = 93.75% of games pay 16 or less. The median payout is 2, since half of all games end on the first toss. A payout of 1024 needs the first head on toss 10, which happens once in 1024 games on average. The infinity lives entirely in the far tail.

Mean and median can live in different worlds. Here the median is 2 and the mean is infinite. Any single number you call "the value" of this game is a choice, not a fact.

What the running average actually does

Play N games and average the payouts. The average does not settle. It creeps upward roughly in step with \log_2 N. The reason is that in N games you expect to see a first head as late as toss \log_2 N, and that rare game contributes a payout near N, which alone adds about 1 to the average.

A useful rule of thumb: the running average after N games sits near

\bar{X}_N \approx \log_2 N

where \bar{X}_N is the mean payout over N games. This is an approximation with large swings, not a tight law. Each time a fresh record jackpot arrives, the average jumps, then drifts down slowly until the next record.

The trend line \log_2 N. At one million games the average is only around 11 coins, and it will keep rising forever.

A worked run reproducing the demo

Run the simulator with the default settings. It plays the game many times and plots the running average. Here is a concrete synthetic run so you can check the arithmetic against what you see on screen.

Ten games by hand

Suppose the first-head toss counts for ten games come out as: 1, 2, 1, 3, 1, 1, 2, 5, 1, 4. That distribution is plausible: six ones, two twos, one three, one four, one five is close to the expected mix for ten games.

  1. Convert each to a payout 2^k: 2, 4, 2, 8, 2, 2, 4, 32, 2, 16.
  2. Sum the payouts: 2 + 4 + 2 + 8 + 2 + 2 + 4 + 32 + 2 + 16 = 74.
  3. Divide by 10 games: \bar{X}_{10} = 7.4 coins.
  4. Compare to the rule of thumb: \log_2 10 \approx 3.32.

The measured 7.4 sits well above the trend of 3.32 because the single payout of 32 (the toss-5 game) dominates this short run. That is exactly the point. One tail-heavy game distorts the average, and with only ten games the distortion is large.

Now watch what a long run does. If you extend to 100 games, that lone jackpot's influence shrinks toward its expected share, and the average tends back toward roughly \log_2 100 \approx 6.6 until the next big hit arrives.

Without JavaScript, picture this: a line chart of the running average payout as games accumulate from 1 to your chosen N. The line jumps sharply upward at rare jackpots, then sags gently, tracking the reference curve log2(N) on average but never converging to any flat level.

How to price the game with utility

Bernoulli's own fix was to say people value coins by usefulness, not face amount, and that usefulness grows slower than money. Use the logarithm of wealth as utility. The expected utility of the prize then converges even though the expected prize does not.

E[\log_2 X] = \sum_{k=1}^{\infty} \tfrac{1}{2^k} \cdot \log_2(2^k) = \sum_{k=1}^{\infty} \tfrac{k}{2^k} = 2

Here X = 2^k is the prize and \log_2 X = k. The sum \sum k/2^k equals exactly 2. So the expected log-payout is 2 log-coins, which corresponds to a prize of 2^2 = 4 coins. A person valuing money on a log scale would pay about 4 coins to play, not infinity. That matches intuition far better.

Utility is one repair. Another is a bankroll cap: no casino can pay 2^k without limit. Cap the payout at 2^{40} (about a trillion), and the fair price drops to 40 coins, since the sum now has 40 terms of 1. Finite banks force finite prices.

Common mistakes

Trusting the mean. Expected value assumes you can average over many independent plays and that no single play can bankrupt you. Neither holds here. The mean is the wrong summary.

Expecting the average to converge. The Law of Large Numbers needs a finite mean. This distribution has none, so the ordinary law does not apply and the running average keeps climbing.

Do not read a single simulation run as "the answer". Reseed a few times. You will get 6 coins one run and 40 the next, purely from whether a giant jackpot happened to land. That variance is the lesson, not noise to be smoothed away.

Confusing infinite with large-but-typical. Infinite mean coexists with a median of 2. The game is cheap almost always and astronomically rich almost never.

Related tools

To see averages that actually settle, watch the Law of Large Numbers pull a die's running mean onto 3.5. To understand why sums of many small independent draws smooth into a bell shape (and why this game breaks that), try the Central Limit Theorem Demo. For a hands-on tour of estimating quantities by random sampling, the Monte Carlo Playground shows the method working when the mean is finite. And for another probability puzzle where intuition and arithmetic disagree, play the Monty Hall Simulator.

Frequently asked questions

Why is the expected value infinite if I always win only a little?

Each doubling of the prize is matched by a halving of its probability, so every possible outcome adds the same fixed contribution of 1 to the expected value. There are infinitely many outcomes, so the sum of ones diverges. The infinity comes from rare huge jackpots, not from typical play.

What should I actually pay to play?

There is no single correct number. Under log utility the fair price is about 4 coins. Under a payout cap of a trillion coins it is 40 coins. Both are finite and far below infinity, which is why nobody bets a fortune on this game.

Does the running average ever stop rising?

No. It tracks \log_2 N on average, so at a million games it is near 11 and at a trillion games near 40. It rises without bound, just very slowly, because record jackpots keep arriving on a logarithmic schedule.

Why does the Law of Large Numbers not apply here?

That law requires a finite mean for the average to converge to it. This distribution has an infinite mean, so the theorem's condition fails and the average does not converge to any value.

Is this just a math curiosity or does it matter?

It is a clean warning that expected value alone can mislead when outcomes are heavy-tailed. The same idea shows up in insurance, finance and any decision where a rare extreme event dominates the arithmetic mean.