# Coin flipping and Bayes' theorem… but where does binomial theorem come in?

Consider the following question:

You are face with two identical coins. One is fair, and the other comes up Heads 90% of the time. You flip coins, which results in THHHTHHHTH (seven heads, three tails). What is the probability that the coin you’ve been flipping is the unfair one?

Is it safe to assume order is irrelevant and to look for probability of seven heads and three tails with binomial distribution:

Let F be event that coin is fair, B be event that coin is biased, T be the observed toss. Then, using Bayes': $$P(B|T)=\frac{P(T|B)\times P(B)} {P(T)}$$

$$P(T|B)=\binom{10}{7} \times 0.9^7\times 0.1^3 =0.0574$$

$$P(B)=0.5$$

$$P(T)=P(T|F)\cdot P(F) + P(T|B)\cdot P(B) = 0.1172$$

Thus the probability that the coin flipped is biased is 24.5%

Is this reasoning correct?

• I get $P(T) = 0.087$. Are you certain that you remembered to multiply by both $P(F) = 0.5$ and $P(B) = 0.5$? – Arthur Mar 12 '19 at 14:13

Let's see: With the binomial distribution, the final formula you get is $$\frac{\binom{10}3\cdot 0.9^7\cdot 0.1^3\cdot\frac12}{\frac12\cdot\binom{10}3\cdot 0.9^7\cdot 0.1^3 + \frac12\cdot\binom{10}3\cdot0.5^{10}}$$ What happens if we don't use the binomial distribution and instead care about order? We get $$\frac{ 0.9^7\cdot 0.1^3\cdot\frac12}{\frac12\cdot 0.9^7\cdot 0.1^3 + \frac12\cdot0.5^{10}}$$ which, you may notice, has exactly the same value because algebraically we have only simplified the fraction by $$\binom{10}3$$. So not only is it safe to assume; it doesn't matter one way or the other.
One final notational nitpick: Is there a specific reason you use both $$B$$ and $$L$$ rather than, say, $$B$$ and $$\overline B$$?
• @Lawrence The only real harm is the mental overhead of remembering one extra letter. On the other hand, applying $\overline{\phantom B}$ isn't completely without mental overhead either. So it's not really that important. However, once you start having more events that need to be negated, the difference becomes clearer. If you have a coin and a die, both of which can be either fair or biased, and you also wonder whether it's raining outside, having three letters with overlines starts becoming a lot easier than having six letters. – Arthur Mar 13 '19 at 9:59
Although it does not matter in calculation as demonstrated by Arthur, yet the condition indicates the specific order of the $$10$$ tosses. So ($$F-$$ fair, $$U-$$ unfair): $$P(F\cap HHHHTTHHTH)=\frac12\cdot \frac{1}{2^{10}};\\ P(U\cap HHHHTTHHTH)=\\ \frac12\cdot \left(\frac{9}{10}\right)^7\cdot \left(\frac1{10}\right)^3;\\ P(U|HHHHTTHHTH)=\frac{P(U\cap HHHHTTHHTH)}{P(F\cap HHHHTTHHTH)+P(U\cap HHHHTTHHTH)}=\\ \frac{\frac{9^7}{2\cdot 10^{10}}}{\frac{9^7}{2\cdot 10^{10}}+\frac{1}{2^{11}}}\approx 0.3288.$$