# Conditional Probability and Bayes' theorem exercise

first question here, i hope someone can help me. So, I'm studying for the Probability Calculus and Mathematical Statistics course and I came across this exercise that I'm having trouble solving:

*Consider two urns; the first urn contains 4 white marbles and 8 red marbles, the second urn contains 3 white marbles and 3 blue marbles. A fair coin is tossed, if it comes up heads, a marble is extracted from the first urn, otherwise a marble is extracted from the second urn. Calculate:

1. the probability that the drawn marble is white
2. knowing that the drawn marble is white, calculate the probability that the coin toss has come up with heads
3. knowing that the ball drawn is red, calculate the probability that the coin toss has come up with heads.*

For the first point I have thought to consider the event: $$B_i=\{extracted\ white\ marble\ from\ the\ i-th\ urn\}\ (i=1,2)$$

The probability are:

$$P(B_1)=\frac{4}{12} = \frac{1}{3};$$

$$P(B_2)=\frac{3}{6} = \frac{1}{2};$$

Now, I thought that since these are incompatible events, i can apply axiom 3 of probability:

$$P(B)=P\left(\bigcup_{i=0}^n B_i\right) = \sum_{i=0}^n P(B_i);$$

So: $$P(B)=P(B_1\cup B_2)= P(B_1) + P(B_2) =\frac{1}{3} + \frac{1}{2} =\frac{5}{6};$$

For the second and the third point i applied the Bayes' theorem. First of all i calculated all that i need for the formula:

$$A_i=\{Extraction\ from\ the\ i-th\ urn\}\ (i=1,2);$$

We have a fair coin so: $$P(A_1)=P(A_2)=\frac{1}{2};$$

$$P(B|A_1)=\frac{P(B \cap A_1)}{P(A_1)}=\frac{P(B)P(A_1)}{P(A_1)}=\frac{1}{3};$$

I have thought that because $$P(B)$$ and $$P(A_1)$$ are two differents events, they are indipendent so: $$P(B|A_1)=P(B);$$

$$P(B|A_2)=\frac{P(B \cap A_2)}{P(A_2)}=\frac{P(B)P(A_1)}{P(A_1)}=\frac{1}{2};$$

Now i'm ready to use the Bayes' theorem:

$$P(A_1|B)=\frac{P(A_1)P(B|A_1)}{P(A_1)P(B|A_1)+P(A_2)P(B|A_2)}=\frac{2}{5};$$

For the third point:

$$C = \{Red\ marble\ extract\};$$

$$P(C)=\frac{2}{3};$$

$$P(C|A_1)=\frac{P(C \cap A_1)}{P(A_1)}=\frac{P(C)P(A_1)}{P(A_1)}=\frac{2}{3};$$

In the second urn we don't have red marbles, so: $$P(C|A_2)=0;$$

$$P(A_1|C)=\frac{P(A_1)P(C|A_1)}{P(A_1)P(C|A_1)+P(A_2)P(C|A_2)}=1;$$

I think that the third point is correct because the red marbles are only in the first urn, if we extracted a red marble we have extracted that from the first urn, so the probability that the coin toss has come up with heads is 1.

The most critical point is the first I can't tell if it's done right.

Thank you very much in advance and apologize for some grammatical errors and for any MathJax errors.

Your have evaluated the probabilities for $$B_i$$ as that of "drawing a white ball when drawing from urn $$i$$". Thus the probabilities you've assigned are conditional.

Rather, you want to evaluate the probability as that of "choosing urn $$i$$ and drawing a white ball from it." The choice of urn is the result of a fair coin toss, so:

$$\qquad{\mathsf P(B_1)= \tfrac 12\cdot\tfrac 4{12}=\tfrac 16\\\mathsf P(B_2)=\tfrac 12\cdot\tfrac{3}{6}=\tfrac 14}$$

Thus $$\mathsf P(B)=\tfrac 16+\tfrac 14=\tfrac{5}{12}$$

The event of drawing a blue ball is not independent of the urn selected. So $$\mathsf P(B\cap A_1)\neq\mathsf P(B)\mathsf P(A_1)$$

Rather $$\mathsf P(B\cap A_1)=\mathsf P(B_1)$$ as above, and so $$\mathsf P(B\mid A_1)=\mathsf P(B_1)/\mathsf P(A_1)=1/3$$

Then: $$\mathsf P(A_1\mid B)=\dfrac{\mathsf P(A_1\cap B)}{\mathsf P(B)}=\dfrac{1/6}{5/12}=\dfrac{2}{5}$$

Knowing that a red ball was drawn, then the first urn was certainly selected. So immediately we have:

$$\mathsf P(A_1\mid C)=1$$