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*}$$