# Biased coin probability example: Bayes' rule and the law of total probability

My textbook gives the following example:

You have one fair coin, and one biased coin which lands Heads with probability $$3/4$$. You pick one of the coins at random and flip it three times. It lands Heads all three times. Given this information, what is the probability that the coin you picked is the fair one?

Solution:

Let $$A$$ be the event that the chosen coin lands Heads three times and $$F$$ be the event that we picked the fair coin. We are interested in $$P(F \mid A)$$, but it is easier to find $$P(A \mid F)$$ and $$P(A \mid F^c)$$ since it helps to know which coin we have; this suggests using Bayes' rule and the law of total probability. Doing so, we have

\begin{align} P(F \mid A) &= \dfrac{P(A \mid F)P(F)}{P(A)} \\ &= \dfrac{P(A \mid F) P(F)}{P(A \mid F) P(F) + P(A \mid F^c) P(F^c)} \\ &= \dfrac{(1/2)^3 \cdot 1/2}{(1/2)^3 \cdot 1/2 + (3/4)^3 \cdot 1/2} \\ &\approx 0.23 \end{align}

Bayes' rule is as follows:

$$P(A \mid B) = \dfrac{P(B \mid A) P(A)}{P(B)}$$

And the law of total probability is as follows:

Let $$A_1, \dots, A_n$$ be a partition of the sample space $$S$$, with $$P(A_i) > 0$$ for all $$i$$. Then

$$P(B) = \sum_{i}^n P(B \mid A_i) P(A_i)$$

What I don't see is how the authors got $$P(A) = P(A \mid F) P(F) + P(A \mid F^c) P(F^c)$$?

I would appreciate it if people could please take he time to clarify this.

• That's just the Law of Total Probability.
– lulu
Commented Aug 5, 2019 at 19:58
• @lulu hmm, how? Commented Aug 5, 2019 at 20:00
• Well, $P(A\,|\,\,B)\times P(B)=P(A\cap B)$ and $F,F^c$ are mutually exclusive and exhaustive so...
– lulu
Commented Aug 5, 2019 at 20:05
• @lulu But I don't see where the complements are coming from? Commented Aug 5, 2019 at 20:07
• What do you mean? For any event $F$ the two events $F, F^c$ are mutually exclusive and exhaustive, hence the law of total probability can be applied.
– lulu
Commented Aug 5, 2019 at 20:08

lulu is right: In your formula for the law of total probability take $$A_1 = F$$ and $$A_2 = F^c$$. Then $$A_1,A_2$$ is a partition of the sample space and $$P(A) = \sum_{i=1}^2 P(A \mid A_i) P(A_i) = P(A \mid F) P(F) + P(A \mid F^c) P(F^c)$$ is exactly that formula with the sum written out.