# Probability of balls drawn with replacement

We have two bags, Bag A has 40 red balls and 15 blue balls, Bag B has 40 blue balls and 10 red balls. One of these bags is selected at random and from it five balls are drawn at random, replacing each ball back into the bag after it has been drawn. The result is that we find 4 red balls and 1 blue. What is the probability that the selected bag was Bag A?

How to solve this problem? It is supposed to be solved using Bayes’ theorem and binomial distribution, but I failed to get the logic! Thank you very much for help!

Let $A, B$ be the events of picking bag $A$ and $B$ respectively, and let $X$ be the event of picking $4$ red balls and $1$ blue ball. We will assume that $\mathbb{P}(A)=\mathbb{P}(B)=\frac{1}{2}$.

We want to find $\mathbb{P}(A|X)$.

Now by Bayes' theorem we have that: $$\mathbb{P}(A|X)=\frac{\mathbb{P}(X|A)\mathbb{P}(A)}{\mathbb{P}(X)}$$ But we also have (since $B$ is the complement of $A$): $$\mathbb{P}(X)=\mathbb{P}(X|A)\mathbb{P}(A)+\mathbb{P}(X|B)\mathbb{P}(B)$$ Now let's calculate these probabilities.

We have a total of $55$ balls in bag $A$, of which $40$ are red and $15$ are blue, so when we pick one ball the probability that it is red or blue is $\frac{40}{55}$ or $\frac{15}{55}$ respectively. When picking $5$ balls of which $4$ are red and $1$ is blue, the blue ball can appear in five places, so we have: $$\mathbb{P}(X|A)=\left(\frac{40}{55}\right)^4\cdot \frac{15}{55}\cdot 5$$ Similarly we get: $$\mathbb{P}(X|B)=\left(\frac{10}{50}\right)^4\cdot \frac{40}{50}\cdot 5$$ So we find, filling in our results: $$\mathbb{P}(A|X)=\frac{\mathbb{P}(X|A)\cdot\frac{1}{2}}{\mathbb{P}(X|A)\cdot\frac{1}{2}+\mathbb{P}(X|B)\cdot\frac{1}{2}}=\frac{\mathbb{P}(X|A)}{\mathbb{P}(X|A)+\mathbb{P}(X|B)}=\frac{9600000}{9761051}\approx 0.9835$$

Bayes' theorem relates the conditional probability of event A given B to that of event B given A (and their respective individual probabilities). The probability that you want to find is the probability that the selected bag was bag A given that you found 4 red balls and 1 blue. So event A is selecting bag A, event B is finding 4 red and 1 blue balls. Now applying Bayes' theorem is simple; you can find the probability of event B given A easily (the probability that you would take 4 red and 1 blue balls from bag A), the probability of picking bag A is $\frac 12$, and the probability of picking 4 red and 1 blue balls from either bag A or bag B is relatively easy to find (draw the probability tree).

Let $S$ represent the event in which 4 red balls and one blue ball are selected $A$ the event in which bag A is chosen and $B$ the event that bag B is chosen.

you need to calculate the conditional probability $P(A|S)$

easily accessible probabilities are ...

$P(S|A) = \binom 51 (\frac{8}{11})^4 (\frac{3}{11})$

and

$P(S|B) = \binom 51 (\frac14)^4 (\frac34)$

since the bags are chosen randomly we can also assume that $P(A) = P(B) = 0.5$

Bayes' theorem gives

$P(A|S) = \frac {P(A \cap S)}{P(S)}$

also

$P(S|A) = \frac {P(A \cap S)}{P(A)}$ and $P(S|B) = \frac {P(B \cap S)}{P(B)}$

so that $P(A \cap S) = P(A)P(S|A)$

and $P(S) = P(A \cap S)+P(B\cap S) = P(A)P(A|S)+P(B)P(B|S)$

finally ...

$P(A|S) = \frac {P(A)P(S|A)}{P(A)P(S|A)+P(B)P(S|B)}= \frac {P(S|A)}{P(S|A)+P(S|B)}$ .