# Thread: Probability of having one of two unknown bags

1. ## Probability of having one of two unknown bags

Bag #1
900 red eggs
100 blue eggs

Bag #2
100 red eggs
900 blue eggs

You are given one of these two bags (50/50 chance) randomly.

You perform a set of trials where you take out one egg randomly from your bag, note the color, then put it back in, and repeat.

You drew 8 red eggs and 2 blue eggs from your bag during this trial. What is the probabilty (%) that you have Bag #1?

I thought it was 50% because you could have drawn 8 red and 2 blue from bag #2 as well, since drawing eggs and putting them back does not change the bag's contents...

2. Suppose that $A$ is the event of drawing eight red and two blue eggs.
First we must calculate $P(A)$.
$P(A)=P(A\cap B_1)+ P(A\cap B_2)= P(A| B_1)P(B_1)+ P(A| B_2)P(B_2)$.

This problem is asking you to find $P(B_1|A)$.
$P(B_1|A)=\frac{P(B_1\cap A)}{P(A)}$.

Can you finish?

3. Hello, daigo!

$\text{Bag \#1:}\;\; \begin{array}{c}\text{900 red eggs} \\ \text{100 blue eggs} \end{array} \qquad\text{Bag \#2:}\;\;\begin{array}{c}\text{ 100 red eggs} \\ \text{900 blue eggs} \end{array}
$

You are given one of these two bags randomly (50/50 chance).

You perform a set of trials where you take out one egg randomly from your bag,
note the color, then put it back in, and repeat.

You drew 8 red eggs and 2 blue eggs from your bag during this trial.
What is the probabilty (%) that you have Bag #1?
This is a Conditional Probability problem:
. . Given that 8R, 2B are drawn,
. . what is the probability that they were drawn from Bag #1?

Bayes' Theorem: . $P\bigg(\text{Bag 1 }|\text{ 8R,2B}\bigg) \;=\;\frac{P\bigg(\text{[Bag 1] }\wedge\text{[8R,2B]}\bigg)}{P\bigg(\text{8R, 2B}\bigg)}$ .[1]

Numerator: . $P(\text{Bag \#1}) \,=\,\frac{1}{2}$

. . From Bag #1: . $P(R) = \frac{9}{10},\;\;\;P(B) = \frac{1}{10}$

. . Then: . $P(\text{8R,2B}) \:=\:{10\choose8}\left(\frac{9}{10}\right)^8\left( \frac{1}{10}\right)^2 \;=\;(45)\,\frac{9^8}{10^{10}}$

. . Hence: . $P\bigg(\text{Bag 1 }\wedge \text{ 8R,2B}\bigg) \;=\;\frac{45}{2}\cdot\frac{9^8}{10^{10}}$ .[2]

Denominator: . $P(\text{Bag 2}) \,=\,\frac{1}{2}$

. . From Bag #2: . $P(R) =\frac{1}{10},\;\;P(B) =\frac{9}{10}$

. . Then: . $P(\text{8R,2B}) \:=\:{10\choose8}\left(\frac{1}{10}\right)^8\left( \frac{9}{10}\right)^2 \;=\;(45)\cdot \frac{9^2}{10^{10}}$

. . Hence: . $P(\text{Bag 2 }\wedge\text{ 8R,2B}) \:=\: \frac{45}{2}\cdot\frac{9^2}{10^{10}}$ .(A)

And we have: . $P\bigg(\text{8R,2B}\bigg) \;=\;\frac{45}{2}\cdot\frac{9^8}{10^{10}} + \frac{45}{2}\cdot\frac{9^2}{10^{10}} \;=\;\frac{45}{2}\cdot\frac{9^2}{10^{10}}\cdot\lef t(9^6 + 1\right)$ .[3]

Substitute [2] and [3] into [1]:

. . $P(\text{Bag 1 }|\text{ 8R,2B}) \;=\;\frac{\dfrac{45}{2}\cdot\dfrac{9^8}{10^{10}} } {\dfrac{45}{2}\cdot\dfrac{9^2}{10^{10}}\cdot(9^6 + 1)}\;=\;\frac{9^6}{9^6 + 1}$

Therefore: . $P(\text{Bag 1 }|\text{ 8R,2B}) \;=\;0.999998118$

If we draw 8 Reds and 2 Blues from a bag,
. . the probability that they came from Bag #1 is virtually 100%.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

The answer is reasonable when we consider (A).

$P(\text{Bag 2 }\wedge\text{ 8R,2B}) \;=\;\frac{45}{2}\cdot\frac{9^2}{10^{10}} \;=\;0.000000182$

So if we have Bag #2, it is virtually impossible to draw 8 Reds and 2 Blues.

4. Thanks. I was shown another method where I do 100 - ([1^8 * 100] / [9^8]) but I did not understand why that was the answer. Your solution clarified it better.