The St. Petersburg paradox describes a game of chance for a single player in which a fair coin is tossed at each stage. The initial stake starts at 2 dollars and is doubled every time heads appears. The first time tails appears, the game ends and the player wins whatever is in the pot.

Let $X_n$ denote the final winning amount after the $n$th toss. We know that $X_0 = 2$ and $P(X_n = 2X_{n-1})=1/2$ and $P(X_n = X_{n-1})=1/2$. We can see that $X_{n}$ is a sub-martingale as $\mathbb{E}[X_{n}|\mathcal{F}_{n-1}] \geq X_{n-1}$.

Let $T$ denote the minimum number of toss that shows a tail toss $T := min\{t: X_t=X_{t-1}\}$. $T$ is a stopping time.

The variance:

Considering nothing but the expected value of the net change in one’s monetary wealth, one should therefore play the game at any price if offered the opportunity. Yet the paradox exists between what people seem willing to pay to enter the game and the infinite expected value.

# The Martingale

With slight modifications from above, the St. Petersburg martingale is the sequence of random variable $X_n$, where $X_0=2$ and $P(X_n=2X_{n-1}) = 1/2$ and $P(X_n=0) = 1/2$. It is now a martingale because $\mathbb{E}(X_n|\mathcal{F}_{n-1}) = X_{n-1}$.

Note that now the expected payoff at inception is equal to initial stake based on Doob’s Idenfity, given stopping time T defined above: $\mathbb{E}X_{T} = X_{0}$

# Expected Utility Theory

The classic way to resolve the paradox involves the introduction of utility function and the presumption of diminishing marginal utility.

Let x denote a person’s total wealth, then the logrithmic utility function states that:

Where the marginal utility is a decreasing function of x:

Now we calculate the maximum cost c that a person with logrithmic utility function and wealth w would pay to enter the game. The maximum cost will make the expected utility change from playing the game be 0.

# Simulation

Given w, c can be calculated numerically. In python, we first check the maximum power of two allowed in our simulation. It turns out to be 63:

Returns:

## Logrithmic Utility Function

Now we use fsolve to calculate the maximum c to break even:

When w = 1000:

When w = 1000000:

## Square-Root Utility Function

When w = 1000:

When w = 1000000:

Note that under the square-root utility function, the maximum cost to enter is higher, as utility diminished slower.

Reference: