Lenny Domnitser’s

⇙ Jump to content


This is a static archive of the domnit.org blog,
which Lenny Domnitser wrote between 2006 and 2009.

The St. Petersburg Paradox and Abstraction

Imagine this game: Flip a coin as many times as it takes to come up tails; call this n flips. You get paid $2n. How much would you pay to play this game?

Before you answer, consider another game. Roll a die, and get dollars equal to the value that appears. This game is worth its expected value—value times probability, summed for every possible outcome. This equals ⅙(1) + ⅙(2) + ⅙(3) + ⅙(4) + ⅙(5) + ⅙(6) = 3.5. A rational player would not pay more than $3.50 to play.

Let’s go back to the first game, and apply our technique of determining expected value. If the first toss is tails (half the time), you win $2, so that term in the expected value equation is (½)(2). If the first toss is heads (half the time) and the second toss is tails (half the time), you win $4. This adds to the expected value (½)(½)(4), or (½)2(2)2. In general, each possible outcome can be written as (½)n(2)n, and this always simplifies to 1. The expected value of every outcome is 1, and there are infinite outcomes, so expected value is: 1 + 1 + 1 + … = ∞.

Infinity? Is this supposed to mean that the average player of this game wins infinity dollars? That seems wrong. Also, if you were offered this game, the expected value tells you that you should be willing to pay any finite amount of money, such as your life savings, to then win infinite money. But you would be a fool to do so. This is called the St. Petersburg Paradox.

Realistic analyses of the paradox could try to circumvent that prickly infinity with the idea of limited resources and other economic arguments. An interesting result occurs when infinity is replaced with a large number, since nobody can really provide infinite money. The expected value of the game is changed dramatically if your winnings are capped at whatever can actually be paid to you. This table is shamelessly lifted from Wikipedia:

Backer Bankroll Expected value of lottery
Friendly game $64 $3.50
Millionaire $1,050,000 $10.50
Billionaire $1,075,000,000 $15.50
Bill Gates $51,000,000,000 (2005) $18.00
U.S. GDP $11.7 trillion (2004) $22.00
World GDP $40.9 trillion (2004) $23.00
Googolnaire $10100 $166.50


This gives some insight into why one would feel like the game isn’t worth a high bet, but it still does not resolve the problem theoretically, if any payout can be awarded.

In an article on the St. Petersburg Paradox in the Stanford Encyclopedia of Philosophy, Robert Martin dispels several other “realistic” explanations, and answers the question: in a purely theoretical version of the game, do statistical methods really break? According to the article, the rub is that our intuition about the game is tied to reality. There is a limit to the amount of money in the world, the amount of matter in the Universe with which to print money, the time we can spend flipping a coin, so we tell ourselves that under any realistic constraints, we could never gain infinite money. If we could sever ourselves from the real world, says Martin, infinite expected value is no paradox at all: “What it’s reasonable for real agents, limited in time, patience, bankroll, and imaginative capacity to do, given the constraints of the real casino, the real economy, and the real earth, is another matter, one that the theoretical core of decision theory can be forgiven for not specifying.”

What if, instead of money, unlimited and completely imagined points were used, and players just derived satisfaction from doing well in the game. Would they pay more to play? If instead of flipping a coin, a simple computer program determined and distributed points to the player? While this would not make the player’s time resource go to infinity, it will make it less limiting. Would this cause willingness to pay more? Would players pay more as the hardware running this program became faster? Actually, yes.

If, on average, a player can expect to win infinitely many dollars, or points, then if they play enough games, they will eventually get an arbitrarily large amount of money. If they can play enough times, and are not limited by the economy in the amount of debt they can enter before winning the big prize, then they can pay more. Consider this bit of Python code:

import random, sys

def play_once():
    n = 1
    while random.random() < 0.5:
        n += 1
    return 2 ** n

def achieve(fee, goal):
    games = 0
    total = 0
    while total < goal:
        total += play_once() - fee
        games += 1
    return games

Don’t worry; you don’t actually need to know any Python. The important bit is achieve(fee, goal), and all it does is play the game with a certain fee, until you make a certain amount of money: your goal. For example achieve(fee=20, goal=1000) will tell you how many games the computer played, paying 20 each time, until it won at least 1,000. This program does not reset you to zero every game, but stores your total, winnings or debts. Just running achieve(fee=20, goal=1000) a few times produces these game counts: 7,85; 3,659; 5; 1,575; 4,720; 1,67673; 1,742; 36,868. Each of these were completed in less than a second. Under such conditions, $20 seems like a pittance to pay, even if the goal is just $1,000.

What if the fee were a heftier $250, aiming for the same $1,000 total? The first run took 8 games, and an insignificant amount of time. The second attempt shot my CPU to 100% and ran hot and loud. After around twenty minutes, my limited time resource gave out and I left the casino. (I stopped the program.) Would I do the same thing ten years from now? Probably not, since my hardware will be a whole lot faster.

The program does one important thing: abstract away infinity. We can see that we can easily make a higher fee worth it, without changing the circumstances of the decision. My computer tried to hide reality from me, and I was able to achieve my $1,000 goal. Even with a $1,000,000 goal, the program never took more than a few seconds.

When I tried to increase the fee, the abstraction leaked, and I quit the simulator. But with faster hardware, paying $250 to eventually win $1,000 is not irrational. In fact, you can ask for as much as you want, which will presumably be infinity. (No? Commie!) Then, any finite fee is worth it. Paying less than “anything finite” is not the result of rational decision making, as it is classically defined, but of nasty but theoretically ignorable factors of mortality and thermodynamics. When God runs my code on his ∞-Hz ∞-bit 80∞86, there is no paradox.

Just try leaving reality.

1 comment on The St. Petersburg Paradox and Abstraction

1. Alex says:

I found paradox description in Wikipedia easier to digest. It explicitly says about fixed entry fee and that play stops at first “tail”. From your description I got that you play until you have seen tails N times. But my brain is exhausted by parental labor of past two decades…

—Alex, 6 December 2006, 16:14

Comments on this entry are now closed. Thanks to those who participated. You can still email me.