# How am I misusing the Bayes' rule?

I just started studying probability. I am trying to solve this exercise:

When coin A is flipped it comes up heads with probability 1/4, whereas when coin B is flipped it comes up heads with probability 3/4. Suppose that one of these coins is randomly chosen and is flipped twice. If both flips land heads, what is the probability that coin B was the one flipped?

First I have that $A$ is the event in which the coin A is chosen. $B = A'$ is the event in which coin B is chosen.

So I have that $P(A) = P(B) = 1/2$

I also have that $H$ is the event in which the coin lands heads.

I compute $P(H)$ using Bayes' Rule.

$P(H) = P(H|A)P(A) + P(H|B)P(B) = (\frac14) (\frac12) + (\frac34) (\frac12) = \frac12$

As these are independent events, I can say that $P(HH) = P(H)P(H) = \frac14$ is the probability of having 2 tails.

Then I need to compute $P(B|HH)$ to solve the exercise.

I have this:

$P(B|HH) = \frac{P(BHH)}{P(HH)} = \frac{P(B)P(H|B)P(H|BH)}{P(HH)}$

I got that last part using the multiplication rule. Intuitively I would say that $P(H|BH) = P(H|B)$, so using that I can substitute everything and compute the actual probability.

$P(B|HH) = \frac{P(B)P(H|B)P(H|BH)}{P(HH)} = \frac{ \frac12 \frac34 \frac34 }{\frac14} = \frac{\frac9{32}}{\frac14} = \frac{9}{8} \gt 1$

Obviously I am doing something wrong, but I can't see what :(

The probability of getting two heads is

$$\frac34\cdot\frac34=\frac9{16}$$

if you chose coin $B$ and

$$\frac14\cdot\frac14=\frac1{16}$$ if you chose coin $A$. Thus,

\begin{align*} P(HH)&=\frac12\cdot\frac9{16}+\frac12\cdot\frac1{16}=\frac5{16}\;,\\\\ P(B\text{ and }HH)&=\frac12\cdot\frac9{16}=\frac9{32}\;,\text{ and}\\\\ P(B\mid HH)&=\frac{P(B\text{ and }HH)}{P(HH)}=\frac{9/32}{5/16}=\frac9{10}\;. \end{align*}

• Thanks! I should pay more attention with independent events. – Sofia Ontiveros Jun 2 '15 at 1:19
• @Sofia: You’re welcome! – Brian M. Scott Jun 2 '15 at 1:20

Because the same coin is flipped twice, the events are only conditionally independent.

This is true: $P(H_1, H_2\mid A) = P(H_1\mid A)P(H_2\mid A) = (\frac 1 4)^2$

As is this: $P(H_1, H_2\mid B) = P(H_1\mid B)P(H_2\mid B) = (\frac 3 4)^2$

However: $P(H_1, H_2) \neq P(H_1)P(H_2)$

So we use the law of total probability:

\begin{align} \mathsf P(H_1,H_2) & = \mathsf P(A)\mathsf P(H_1,H_2\mid A)+\mathsf P(B)\mathsf P(H_1,H_2\mid B) \\[4ex] \mathsf P(B\mid H_1,H_2) & = \frac{\mathsf P(B)\mathsf P(H_1,H_2\mid B)}{\mathsf P(A)\mathsf P(H_1,H_2\mid A)+\mathsf P(B)\mathsf P(H_1,H_2\mid B)} \\ & = \frac{9/16}{1/16+9/16} \\ &= \frac 9 {10} \end{align}