## Problem

I have a coin with a sun on the front and the mooon 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 that 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” that the coin is magical by flipping it some number of times.

How many successfully alternating coin flips it will 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 ways so it always alternates)?

## Solution

This is a classic application of **Bayes Theorem**.

Let \(M\) be the even that the coin is magical. The probability that the coin is magical is given by \(\mathbb{P}[M]= 0.01\).

The probability that the coin is not magical is given by \(\mathbb{P}[M^{c}]= 0.99\).

Let \(n\) be the number of alternating flips required for you to think that the coin is magical with a probability of \(99\) percent.

Let \(A_n\) be the event of getting \(n\) alternating flips on tossing the coin \(n\) times.

This means that the conditional probability of the coin being considered by you as magical given \(n\) alternating flips is given \(\mathbb{P}[M \vert A_n] \geq 0.99\).

For a magical coin the probability of alternate flips is always \(1\), so we have \(\mathbb{P}[A_n \vert M] = 1\).

For a normal coin, the probability of alternate flips is given by \(\mathbb{P}[A_n \vert M^c] = \frac{2}{2^n}\) because the \(n\) alternate flips can start with a head or a tail.

Therefore, from Bayes theorem, we have

\[ \begin{align*} 0.99 \leq \mathbb{P}[M \vert A_n]=& \frac{\mathbb{P}[A_n \vert M]\cdot \mathbb{P}[M]}{\mathbb{P}[A_n \vert M] \cdot \mathbb{P}[M]+ \mathbb{P}[A_n \vert M^c] \cdot \mathbb{P}[M^c]} \\ =& \frac{1 \cdot 0.01}{1 \cdot 0.01 + \frac{2}{2^n} \cdot 0.99} \end{align*} \]

We see that we need \(n \geq 15\) alternating flips so that we can be \(99\) percent confident that the coin is magical.