(Follow-up to *Expected value*.)

This problem is known as the St. Petersburg paradox, and it was studied in the 18th century by Daniel Bernoulli and other mathematicians. In this post we will do a simple expected value analysis, but any kind of realistic analysis must consider the phenomenon of risk aversion.

#### Expected value

Let’s call *H _{i}* the event where a head appears at the

*i*-th toss, and

*H*the event where a tail appears at the same toss number. If we call P

_{i}_{n}the probability that

*n*tosses are required to get a head, we have:

and, generalizing,

As the bettor receives $ 2^{n} from the house if *n* tosses are required, the expected balance is

.

So it would seem a perfect bet to make: what can be better than a bet with “infinite expected value”? š

#### Simulation

Let’s make a simulation to check if this result is reasonable:

import random N = 10000 def get_tosses_until_head(): tosses = 0 while True: coin = random.randint(0, 1) tosses += 1 if coin == 0: break return tosses def get_balance(): balance = -100 tosses = get_tosses_until_head() balance += 2 ** tosses return balance def main(): random.seed(0) min_balance = max_balance = accum_balance = get_balance() for i in xrange(1, N): balance = get_balance() if balance < min_balance: min_balance = balance if balance > max_balance: max_balance = balance accum_balance += balance print 'Statistics after %d tries:' % N print ' Minimum balance: %d' % min_balance print ' Average balance: %d' % (float(accum_balance) / N) print ' Maximum balance: %d' % max_balance if __name__ == '__main__': main()

Running the simulation we get:

Statistics after 10000 tries: Minimum balance: -98 Average balance: -75 Maximum balance: 32668

The average seems quite negative, how can we reconcile this with an “infinite expected value”? The answer is the same as in the case of the martingale: low probability events with huge returns skew the expected balance.

Let’s see how the normal expected value estimator works with a random variable , with finite expected value and finite variance :

(linearity of expectation)

( are identically distributed)

(the estimator is unbiased)

( is an unbiased estimator)

(linearity of expectation; is a number)

Replacing by its definition and focusing in :

(linearity of expectation)

(square of a multinomial)

(linearity of expectation)

( is independent of if )

( are identically distributed)

Integrating this result in the expression:

This guarantees the convergence of the estimator to the expected value. But in our case there is no expected value (“it’s infinite”) and, consequently, we cannot even define the variance. Then the simulation is not very useful to get the expected value, as the estimator doesn’t need to converge to the expected value.

#### House without unbounded wealth

One (very realistic) situation where even the expected balance is negative is when the house has reasonably bounded wealth. For example, if we are betting against an agent whose possessions are merely equal to the entire world (!), the amounts we can be paid are bounded by ~$ 200·10^{12}, giving a very different expected value: