It's known that out of 1000000 coins there is one coin that has a head on both of its sides. If one coin is randomly selected out of those 1000000 coins and you observe 20 heads in 20 throws, what is the probability that the coin was fair?

My attempt:

Let F=coin is fair and N=20 heads were observed, we are looking for:

$$P(F | N)= \frac{P(N|F)P(F)}{P(N)}$$

with $P(F)=\frac{9999999}{1000000}$ and $P(N|F)=0.5^{20}, P(N|F^C)=1$

$$P(F|N) = \frac{0.5^{20}\frac{9999999}{1000000}}{0.5^{20}+1}$$

The result is extremly small, but then again the probability should be pretty small, can anybody please check my solution?

  • 2
    $\begingroup$ If the denominator $P(N)$ is a probability, then how is it greater than $1$? $\endgroup$ – Thomas Andrews Feb 18 '15 at 14:32
  • $\begingroup$ Consider if you only saw 2 heads in a row. How big do you think the probability should be in that case? $\endgroup$ – Joffan Feb 18 '15 at 14:33
  • $\begingroup$ @ThomasAndrews Good point. I used P(20x heads) = P(20x|fair coin)+P(20x|not fair),where P(head|not fair)=1. So the result is obviously nonsense, but I don't see whats wrong with the approach. $\endgroup$ – eager2learn Feb 18 '15 at 14:36
  • 2
    $\begingroup$ It seems you're getting confused with computing $P(N)$, as Thomas Andrews observed. Perhaps it would be easier to see how to proceed if you wrote $N$ as the disjoint union of the events $N = (N\cap F)\cup(N\cap F^{C})$, so that $P(N) = P(N|F)P(F)+P(N|F^{C})P(F^{C})$. $\endgroup$ – Alex Wertheim Feb 18 '15 at 14:36
  • $\begingroup$ $P(N)\neq P(N\mid F)+P(N\mid F^c)$. $\endgroup$ – Thomas Andrews Feb 18 '15 at 14:37

Let A denote the event of picking a fair coin.

Let B denote the event of tossing $20$ consecutive heads.


  • 1
    $\begingroup$ As $2^{20}\doteq10^6$ it is about equally likely to throw $20$ heads in a row with a fair coin as it is picking the single unfair coin. That's why the result comes up to roughly ${1\over2}$. $\endgroup$ – Christian Blatter Feb 18 '15 at 15:02
  • $\begingroup$ @ChristianBlatter: Yep, didn't think of it that way though (i.e., I would not have intuitively guessed that the probability is approximately $50\%$ because $2^{20}\approx1000000$). Thanks for pointing that out. $\endgroup$ – barak manos Feb 18 '15 at 15:07
  • $\begingroup$ Right, if you simplify the above, with $n=1000000$ and $k=20$, you get $\frac{n-1}{n-1+2^k}$, which works with $n$ coins and $k$ tosses. $\endgroup$ – Thomas Andrews Feb 18 '15 at 15:37

$P(F) = (N-1) / N$

$P(H\mid F) = 2^{-20} = p$

$P(H) = P(H \mid F)P(F) + 1 \cdot P(F^*) = p (N-1) / N + 1 / N$

$$ P(F \mid H) = \frac{P(F, H)}{P(H)} = \frac{P(H\mid F)P(F)}{P(H)} $$


$$ P(F \mid H) = \frac{p (N-1) / N}{p (N-1) / N + 1 / N} = \frac{p (N-1)}{p (N-1) + 1} = 1 - \frac{1}{p (N-1) + 1} \approx 0.488. $$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.