Hey everyone,

Work has kept me busy, as I've spent the last three weeks catching up on the tasks I pushed back while studying for my exam. I didn't have any time to work on anything creative, so I decided to pull up an old project I had done a year ago on the St. Petersburg Paradox. The St. Petersburg Paradox is a famous problem in mathematics, proposed in 1713 by Nicolas Bernoulli in a letter to fellow mathematician Pierre Raymond de Montmort. The problem consists of a game where the player continuously flips a fair coin until it lands tails. The payout is equal to 2 raised to the number of consecutive heads obtained. For example, if the player gets 1 head, he receives a payout of 2. If he gets 2 heads in a row, he receives a payout of 4. If he gets 3 heads in a row, he receives a payout of 8, and so on and so forth. More formally, we can express the expected payout as:

$latex displaystyle mathrm{E}[mbox{payout}] = sum_{i=1}^infty (mbox{payout for }imbox{ consecutive heads})timesmathrm{Pr}(imbox{ consecutive heads}) $

$latex displaystyle mathrm{E}[mbox{payout}] = sum_i^infty 2^i (.5)^i $

$latex displaystyle = 2timesfrac{1}{2} + 4timesfrac{1}{4} + 8timesfrac{1}{8}cdots $

$latex displaystyle mathrm{E}[mbox{payout}] = 1+1+1cdots = infty$

As you can see, the expected payout is infinite. So, how much would the typical person pay to play this game? It turns out that you might be able to get a person to pay $1 or $5 to play, but once the fee gets into the double-digits, people start getting reluctant. Why is this so? Shouldn't a rational person be willing to put down any finite amount of money to play the game? That's why the problem is called the St. Petersburg Paradox. Even though the expected payout is infinite, most people aren't willing to gamble a large sum of money to play the game.

Intuitively, this makes sense. If you've ever tried flipping a penny over and over again, you'll notice that getting just 5 heads in a row is a rare event. Even then, the payout is just 32. The odds of getting a payout of 1024 is just under one out of a thousand. So, unless you have something better to do than to flip coins all day (and flip them really fast), you're better off flipping burgers if you want to make a living wage (keep in mind you have to pay each time you play).

I wrote a couple of VBA subroutines to simulate the problem and posted a video of the execution on YouTube, a little more than a year ago (I believe I used a payout of 2^(i-1) instead of 2^i for this simulation):

[youtube=http://www.youtube.com/watch?v=QAizn9gqhO8]

Here, I allow the user to set some values for the simulation, like the game price, starting balance, and number of games. In addition, I added a progress bar, data bars, and sparklines to test out some new features in Excel 2010. The subroutine runs much faster without these features (like a thousand times faster), since the computer gets interrupted each time it has to update the progress bar and spreadsheet features. The columns to the right compare the theoretical distribution to the empirical distribution obtained through the simulation. As you can see, large payouts are very rare, and the player spends most of the time with a negative balance. The important lesson to glean out of this is that it would take a ridiculously large number of games to get a large payout, and relying on expected payouts alone would be a foolish choice to make in a business situation (especially in insurance).