I have a spreadsheet where I track bets against myself. The goal isn’t really to win or lose but to validate my understanding of the world on an ongoing basis. Since that’s the goal, I don’t just pick an outcome, I assign probabilities to the possible outcomes.

Here is a bet I made in March of 2023:

QuestionOption 1OddsOption 2Odds
Will SVB depositors get full money back?Yes95%No5%

To make it more fun, I treat each bet as if I am betting $100 and the winning option gives me 2x returns. Here since “Yes” was the final result, the bet gets me 2*$95=$190 (but since I put in $100, my final theoretical winnings are $90).

I have made a dozen of these bets and sometimes my bets made money and sometimes they lost money. But that’s expected even if I was assigning the probabilities perfectly. So the question is, how far am I from the ideal? What would be the expected winnings of someone who was assigning probabilities perfectly?

Expected Returns

How would we calculate the expected returns of such a perfect player? Well, let’s say the odds for option 1 are $P(\text{Option 1}) = x$. Then if option 1 turns out to be right, the winnings are

$$W(\text{Option 1}) = 2 \cdot 100x $$

Now, we can figure out the expected value of this bet. We know how much we could win from each option and we know the assigned probabilities of the two bets. If we assume that we have assigned probabilities perfectly, the expected value of the net returns are:

$$ \begin{aligned} E &= \Bigl[P(\text{Option 1}) \cdot W(\text{Option 1})\Bigr] \newline &+ \Bigl[P(\text{Option 2}) \cdot W(\text{Option 2})\Bigr] - 100 \end{aligned} $$

This is the probability of each option multiplied by the payout of that option (and 100 is subtracted because that’s the money we put into the bet).

This lets us calculate the expected value of any bet in our system. We can quickly calculate it for different odds using a spreadsheet:

Odd 1Odd 2Expected
0.050.95$81
0.10.9$64
0.150.85$49
0.20.8$36
0.250.75$25
0.30.7$16
0.350.65$9
0.40.6$4
0.450.55$1
0.50.5$0

…the expected values are perfect squares! How are perfect squares showing up?!

Solving the Mystery

I was very surprised by this calculation so I wrote out the formula I was calculating to figure out where a perfect square could have crept in.

Let’s start by expanding our formula for expected value. We start by noting that if the odds for option 1 are $x$ then the odds for option 2 are automatically fixed to $1 - x$ since the odds have to add up to 1.

$$ \begin{aligned} E &= x \cdot (2 \cdot 100x) + (1-x) \cdot (2 \cdot 100(1-x)) - 100 \newline E &= 200x^2 + (1-x) \cdot (200(1-x)) - 100 \newline \end{aligned} $$

Okay maybe I can see where a square is popping up but there is no way the rest of the crap will cancel out perfectly, right?

$$ \begin{aligned} E &= 200x^2 + 1(200-200x) - x(200-200x) - 100 \newline E &= 200x^2 + 200-200x - 200x + 200x^2 - 100 \newline \end{aligned} $$ All the 200s in a row are kinda neat! It doesn’t help with things canceling though.

$$ E = 400x^2 - 400x + 100 $$

Welp, we reached the end. There is a square in the result but there are other terms too so the final result shouldn’t be a perfect square! What are we missing?

Well, our table doesn’t enumerate all possible odds. It only lists the odds at every 5% increments. We can account for this by replacing $x$ with $n/20$ where $n \in \lbrace 1..10\rbrace$

$$ \begin{aligned} E &= 400x^2 - 400x + 100 \newline E &= 400(n/20)^2 - 400(n/20) + 100 \newline E &= n^2 - 20n + 100 \newline \end{aligned} $$

Alright, the 400 getting canceled by $20^2$ was cool…but that’s still a square term with extra terms! How is this going to be a perfect square?

Backwards

Let’s take a quick detour to see if the table of values shows us a pattern. When $x = 0.05$, $n = 1$ and from our table $E = 81 = 9^2 = (10 - 1)^2$ Does this pattern continue? When $n = 2$ we have $E = 64 = 8^2 = (10 - 2)^2$. And with each row, $n$ goes up by 1 and the pattern continues.

So looks like the pattern in our table is $E = (10 - n)^2$.

Ah ha! I wonder what that looks like when it is expanded!

$$\begin{aligned} (10 - n)^2 &= (10 -n )(10 - n) \newline &= 100 - 20n + n^2 \newline &= n^2 - 20n + 100 \newline \end {aligned}$$

Our calculation was the expanded out version of $(10 - n)^2$! That’s why every value in our table was a perfect square.

Other Odds

Now we know that the perfect squares were showing up only because we were listing odds at increments of 0.05. We can see that more explicitly if we take the above equation and replace $x$ back into it (using the fact that $x = n/20$1).

$$ \begin{aligned} E &= (10-n)^2 \newline E &= (10 - 20x)^2 \end{aligned}$$

As long as $20x$ is an integer (which happens when $x$ is a multiple of 0.05), $E$ will be a square of an integer (i.e. a perfect square)! Choosing to list the table at 0.05 increments was the reason I ended up with perfect squares.

But that wasn’t the only reason. The bet amount was also a factor. Our original bet was $100 which acts like a scaling factor. We can pull that out to make our equation more clear.

$$ \begin{aligned} E &= (10 - 20x)^2 \newline E &= 100(1 - 2x)^2 \newline E &= \text{Bet}\cdot(1 - 2x)^2 \end{aligned}$$

This is what the expected returns look like without the bet factor:

Graph of $(1-2x)^2$. The x-axis is the odds of the bet and the y-axis is the expected returns. The blue dots are the perfect squares from our table. Without the factor of 100, the “perfect” squares seem less perfect.

If we had bet $1000, we would not have been lucky enough to see the perfect squares.

$$ \begin{aligned} E &= 1000(1-2x)^2 \newline E &= (31.62.. - 31.62..\cdot 2x)^2 \end{aligned}$$

Since $1000 is not a perfect square, when we pull it inside of the squared term, we end up with an irrational number. There is still an $x$ such that the expected returns are a perfect square but such an $x$ will not be a simple number. For example, we can solve the equation for $E = 49$

$$ \begin{aligned} E = (31.62.. - 31.62..\cdot 2x)^2 &= 49 \newline (31.62.. - 31.62..\cdot 2x) &= 7 \newline -31.62..\cdot 2x &= -24.62 \newline x &= 0.389.. \end{aligned}$$

To get the expected returns to be a perfect square, we have to choose our odds ($x$) to be an irrational number. So, if our original bet was $1000, then our table of expected returns was never going to end up with perfect squares because I was always going to pick nice rational numbers to populate the table of odds!

The perfect squares still exist with a $1000 bet, we just were unlikely to stumble onto it.

Even if our bet was $1024, which is a perfect square, our situation wouldn’t have been that much better:

$$ \begin{aligned} E &= 1000(1-2x)^2 \newline E &= (32 - 64x)^2 \end{aligned}$$

When our bet is $1024, our bets would have yielded a perfect square when $x$ is increased in increments of $\frac 1 {64}$. It’s certainly more possible than me picking random irrational numbers, but still unlikely that I would have created my table in increments of $\frac 1 {64}$.

So, if you get a chance to play the game above, consider betting $100 and picking odds in increments of 0.05, you might enjoy your winnings even more when they are perfectly squared.


  1. We can do this replacement because our calculations to expand the different terms never actually used the fact that $n$ was an integer. ↩︎