# Bayes's rule and unfair coin | Solution Explanation

There are three coins in a bag. Two of them are fair. One has heads on both sides. A coin selected at random shows heads in two successive tosses.

What is the conditional probability of obtaining another head in the third trial given the fact that the first two trials showed heads.

I think this problem should be solved in the following way

$$P(one\ more\ head) = \frac{1}{3}\cdot 1 +\frac{1}{3}\cdot \frac{1}{2}+ \frac{1}{3}\cdot \frac{1}{2} = \frac{2}{3}$$

but my book says the right solution is

$$P(HHH|HH) = \frac{5}{6}$$

But the first two trials do not affect the third trial, so I should only have to calculate the probability of getting one more head, since I already have two.

Can anyone explain me what is going on?

Bayes' Rule says $$P(A|B) = \frac{P(B|A)\cdot P(A)}{P(B)}$$ so in your question, it is $$P(HHH|HH) = \frac{P(HH|HHH)\cdot P(HHH)}{P(HH)}$$ Now, notice that

$$P(HH|HHH) = 1$$

because it simply says "if we know that three successive tosses are resulted in $HHH$, what is the probability that first two of them are resulted in $2H$".

For $P(HHH)$, we have $$P(HHH) = \frac{1}{3}\cdot1+\frac{2}{3}\cdot \frac{1}{8} = \frac{5}{12}$$

because if we choose unfair coin with $\frac{1}{3}$ probability, we have $HHH$ with probability $1$ and if we don't choose it with $\frac{2}{3}$, we have $\frac{1}{2} \cdot\frac{1}{2} \cdot\frac{1}{2} = \frac{1}{8}$ probability to have $HHH$.

For $P(HH)$, by similar argument to $P(HHH)$, we have $$P(HH) = \frac{1}{3}\cdot 1+\frac{2}{3} \cdot\frac{1}{4} = \frac{1}{2}$$

So the answer is $$P(HHH|HH) = \frac{1\cdot \frac{5}{12}}{\frac{1}{2}} = \frac{5}{6}$$

Now, when it comes to your argument "the first two trials do not affect the third trial", it is wrong in some manner. Because although it seems third trial is not affected by the first two trials, notice that whether we have fair or unfair coin affects probability of having $HH$ in the first two tosses. In other words, since $P(HH)$ differs from fair coin to unfair coins, probability of having a third $H$ is also affected by $P(HH)$, hence the first two tosses.

• I agree that $P(HH)$ differs from fair coin to unfair coins. However, I still do not get how $P(HH)$ affects the third trial. I am assuming that I already have 2 heads, meaning it does not matter how difficult it was to get those two heads, I already got them. Now, I only care about getting one more head. – user532588 Feb 18 '18 at 9:34
• hold on a second. I am using the same coin for all trials, which means that the more heads I get, the higher is the probability that the coin is biased. Hence, it should be easier to get heads for subsequent trials. Is this reasoning correct? – user532588 Feb 18 '18 at 9:40
• Yes, that's even better explanation than I did in the solution :) – ArsenBerk Feb 18 '18 at 9:41

Let $H_n$ be the event of obtaining a head on toss $n$, $B$ the event of selecting the biased coin, $F$ the event of selecting one of the fair coins.

But the first two trials do not affect the third trial, so I should only have to calculate the probability of getting one more head, since I already have two.

Yes, given that you are using the same coin, the results of the coin tosses are conditionally independent and indentically distributed. $$\mathsf P(H_1,H_2,H_3\mid B)=\mathsf P(H_1\mid B)~\mathsf P(H_2\mid B)~\mathsf P(H_3\mid B)\\\mathsf P(H_1,H_2,H_3\mid F)=\mathsf P(H_1\mid F)~\mathsf P(H_2\mid F)~\mathsf P(H_3\mid F)$$

So the probability of getting a head in the next trial is... wait, which coin you are using? The same coin is selected once, and then used for all tosses.   There is a dependency.

Rather, what is the probability that it is biased when given that you have two heads in he first two tosses.   Well, use Bayes' Rule to update the probability given the evidence.

$$\begin{split}\mathsf P(B\mid H_1,H_2) &= \dfrac{\mathsf P(B)~\mathsf P(H_1,H_2\mid B)}{\mathsf P(B)~\mathsf P(H_1,H_2\mid B)+\mathsf P(F)~\mathsf P(H_1\mid F)~\mathsf P(H_2\mid F)}\\[1ex]&= \dfrac{\mathsf P(B)~\mathsf P(H_1\mid B)~\mathsf P(H_2\mid B)}{\mathsf P(B)~\mathsf P(H_1\mid B)~\mathsf P(H_2\mid B)+\mathsf P(F)~\mathsf P(H_1\mid F)~\mathsf P(H_2\mid F)}\\[1ex]&=\dfrac{\tfrac 13\cdot 1\cdot 1}{\tfrac 13\cdot 1\cdot 1+\tfrac 23\cdot \tfrac 12\cdot \tfrac 12}\\[1ex]&=\dfrac{2}{3}\end{split}$$

So $\mathsf P(H_3\mid H_1,H_2)~{ = \mathsf P(H_3\mid B)~\mathsf P(B\mid H_1,H_2)+\mathsf P(H_3\mid F)~\mathsf P(F\mid H_1,H_2)\\=1\cdot\tfrac 23+\tfrac 12\cdot\tfrac 13\\=\tfrac 56}$

Of course we may combine these steps :$$\begin{split}\mathsf P(H_3\mid H_1,H_2)&= \dfrac{\mathsf P(H_1,H_2,H_3)}{\mathsf P(H_1,H_2)}\\ &=\dfrac{\mathsf P(B)~\mathsf P(H_1,H_2,H_3\mid B)+\mathsf P(F)~\mathsf P(H_1,H_2,H_3\mid F)}{\mathsf P(B)~\mathsf P(H_1,H_2\mid B)+\mathsf P(F)~\mathsf P(H_1,H_2\mid F)}\\&~~\vdots\\&=\dfrac 56\end{split}$$