# Law of Total Probability with extra conditioning

With reference to this question: Coin Flip Probability Independent or Not?

I give you a hat which has 10 coins inside of it. 1 out of the 10 have two heads on it, and the rest of them are fair. You draw a coin at random from the jar and flip it 5 times. If you flip heads 5 times in a row, what is the probability that you get heads on your next flip?

I attempted this question using LoTP with extra conditioning, let $$H$$ be the event that the next flip is heads, $$R$$ be the event that 5 heads are flipped in a row, $$F$$ be the event that a fair coin was drawn and $$U$$ be the event that an unfair coin was drawn.

The Law of Total Probability with extra conditioning states that $$P(B|E) = \sum_i^nP(B|A_i, E)P(A_i)$$

Following this rationale, I produced the following working: \begin{align*} P(H|R) &= P(H|R, F)P(F) + P(H|R, U)P(U) \\ &= \frac{1}{2} * \frac{9}{10} + \frac{1}{10} \\ &= \frac{11}{20} \end{align*}

While this was mentioned in the question I have referenced, I still fail to see the problem with stating that $$P(H|R, F) = \frac{1}{2}$$, since if it is given that it is a fair coin and there were 5 heads in a row, wouldn't the next row still be heads with probability $$\frac{1}{2}$$? Or is there some other part in the working that is wrong?

• Why do you say $P(B\mid E) = \sum\limits_i^nP(B\mid A_i, E)P(A_i)$ rather than $P(B\mid E) = \sum\limits_i^nP(B\mid A_i, E)P(A_i \mid E)$? Commented Aug 27, 2023 at 8:21

You're right, that P(H|R,F)=1/2. The problem lies within the LoTP formula: $$P(B|E)=\sum\limits_i^nP(B|A_i,E)P(A_i).$$ As you're conditioning on $$E$$, all your events should be within $$E$$. So, the right formula would be: $$P(B|E)=\sum\limits_i^nP(B|A_i,E)P(A_i|E).$$

As a rule of thumb you can think of $$E$$ as your new sample space $$S$$. Withing your sample space LoTP would be simple:

$$P(B)=\sum\limits_i^nP(B|A_i)P(A_i),$$

but you assume that your envets $$A_i$$ and $$B$$ are within your sample space $$S$$. So you can also see it as:

$$P(B|S)=\sum\limits_i^nP(B|A_i,S)P(A_i|S).$$

So when you're conditioning on $$E$$ it's really almost the same as you're just changing your old sample space $$S$$ to a new one $$E$$.

In the case of your problem LoTP's formula would be $$P(H|R) = P(H|R,F)P(F|R) + P(H|R,U)P(U|R).$$

Where $$P(H|R,F)=1/2$$ and $$P(H|R,U)=1$$. The main challenge is to calculate $$P(F|R)$$ and $$P(U|R)$$. To do this you shoul use Bayes’ theorem and LoTP:

$$P(F|R) = \frac{P(R|F)P(F)}{P(R)} = \frac{P(R|F)P(F)}{P(R|F)P(F) + P(R|U)P(U)}$$

$$P(U|R) = \frac{P(R|U)P(U)}{P(R)} = \frac{P(R|U)P(U)}{P(R|F)P(F) + P(R|U)P(U)}$$

All that remains is to insert the values and get the answer.

• I strongly recommend to check out "Probability and Statistics" by Morris H. DeGroot and Mark J. Schervish link to get more familiar with all this stuff. Commented Aug 27, 2023 at 9:50

Oh, indeed it is true that, $$\def\P{\operatorname{\sf P}} \P(H\mid R, F)=1/2$$ . That is not your issue.

When the set of events $$\{A_i\cap E: i\in[[1,n]]\}$$ partitions the event $$E$$, then the Law of Total Probability is:

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

$$\P(B\mid E) = \sum_{i=1}^n\P(B\mid A_i, E)\P(A_i)$$ holds only when all $$A_i$$ are independent from $$E$$.

In this case $$F$$ and $$U$$ are not independent from $$R$$. Rather, because $$H, F$$ are conditionally independent given $$R$$ (as are $$H, U$$), you require:

$$\begin{split}\P(H\mid R)&=\P(H\mid R,F)\P(F\mid R)+\P(H\mid R,U)\P(U\mid R)\\&= \P(H\mid F)\P(F\mid R)+\P(H\mid U)~\P(U\mid R)\\&= \tfrac 12\P(F\mid R)+\P(U\mid R)\end{split}$$

Use Bayes' Rule to determine the probability for using a fair coin given the result of five heads in five tosses.

$$\P(F\mid R) =\dfrac{\P(R\mid F)\P(F)}{\P(R\mid F)\P(F)+\P(R\mid U)\P(U)}$$

Why do you say $$P(B\mid E) = \sum\limits_i^nP(B\mid A_i, E)P(A_i)$$ rather than $$P(B\mid E) = \sum\limits_i^nP(B\mid A_i, E)P(A_i \mid E) \quad ?$$

The correct version would make this answer

\begin{align*} P(H\mid R) &= P(H\mid R, F)P(F\mid R) + P(H\mid R, U)P(U\mid R) \\ &= P(H\mid R, F)\tfrac{P(F, R)}{P(R)} + P(H\mid R, U)\tfrac{P(U, R)}{P(R)} \\ &= P(H\mid R, F)\tfrac{P(R\mid F)P(F)}{P(R\mid F)P(F)+P(R\mid U)P(U)} + P(H\mid R, U)\tfrac{P(R\mid U)P(U)}{{P(R\mid F)P(F)+P(R\mid U)P(U)}} \\ &= \frac12\tfrac{\frac1{2^5}\frac9{10}}{\frac1{2^5}\frac9{10}+1\frac1{10}} + 1\tfrac{1\frac1{10}}{{\frac1{2^5}\frac9{10}+1\frac1{10}}} \\ &= \frac{73}{82} \end{align*} as in the linked answer