Jun 19, 2020
As a self-professed Bayesian enthusiast, this week's Riddler Express is right up my alley! We want to calculate the odds that a coin is magical after flipping it a given number of times. Specifically, we want to calculate the number of flips before we're 99% certain the coin is actually magical. We'll use Bayes's formula to find an exact solution.
I have a coin with a sun on the front and a moon on the back. I claim that on most days, it’s a fair coin, with a 50 percent chance of landing on either the sun or the moon.
But once a year, on the summer solstice, the coin absorbs the sun’s rays and exhibits a strange power: It always comes up the opposite side as the previous flip.
Of course, you are skeptical of my claim. You figure there’s a 1 percent chance that the coin is magical and a 99 percent chance that it’s just an ordinary fair coin. You then ask me to “prove” the coin is magical by flipping it some number of times.
How many successfully alternating coin flips will it take for you to think there’s a 99 percent chance the coin is magical (or, more likely, that I’ve rigged it in some way so it always alternates)?
It will take 14 consecutive alternating flips before we are at least 99% sure the coin is magical. This problem is a classic fit for Bayesian methods. (We've seen another great example in a prior Riddler based on "Who wants to be a millionaire") Let's start by reviewing Bayes's formula, then we'll parse the problem text to identify the information we need to solve it.
Typically, a problem like this will give us three of the four variables, and we'll need to solve for the fourth. As we go, we'll identify what we mean when we say and in the context of this problem. Let's write down the information we have:
Now we've identified all four variables required for Bayes's formula above. Written out, we have:
When we plug in our values, we get:
Rearranging so we have on one side, we get:
Conveniently, the fraction on the right equals . So we have:
We take the log of both sides to solve for , which gives us . Because we can't have fractions of coin flips, and we want to be at least 99% sure before stopping, we should err on the side of caution and flip 14 times. This means that after 14 consecutive, alternating flips we can be 99.4% certain the coin is magical.