# Probability of a box containing a combination of color

Let's say, we have a box containing 3 balls in it, they can be either red or blue.

Someone draw a ball 5 times with replacement and get 4 red and 1 blue (not necessarily in order). Do you know how to calculate the probability of the box containing 2 blue balls and 1 red ball?

I never got into this kind of question and a bit confused of how to get the number. It would be in max. of 50% probability, because the box won't contain all red nor all blue balls. Thank you

• It depends on how you initially choose the balls for the box (the prior distribution). Then use Bayes' theorem to get the posterior distribution – Henry Aug 14 '19 at 7:22

Let $$X$$ be the number of red balls in the box
and $$Y$$ be the number of drawn red balls if we draw 5 balls from the box.
The answer depends on the distribution of $$X$$. so, i assume $$P(X=i)=1/4$$; $$i=0,\dots,3$$.
We have $$Y|X \sim binomial\left(5,\frac{X}{3}\right)$$ i.e. $$P(Y=j|X=i)=\begin{cases} \binom 5j \left(\frac{i}{3}\right)^j \left(1-\frac{i}{3}\right)^{5-j} & (i,j)\in \{0,1,2,3\}\times \{0,1,\dots,5\}-\{(0,0),(3,5)\}, \\ 1 & (i,j)\in \{(0,0),(3,5)\}. \end{cases}$$ Now, giving that you get 4 red balls (and 1 blue), the probability of the box containing 1 red ball (and 2 blue balls) is
\begin{align*} P(X=1|Y=4) & = \frac{P(X=1,Y=4)}{P(Y=4)}\\ & = \frac{P(X=1)P(Y=4|X=1)}{\sum_{i=0}^{3}P(X=i) P(Y=4|X=i)}\\ & = \frac{\frac{1}{4} \times \frac{10}{243}}{\frac{1}{4} \times0+\frac{1}{4} \times \frac{10}{243} + \frac{1}{4} \times\frac{80}{243} +\frac{1}{4} \times0}\\ & = \frac{1}{9} \end{align*} If we assume that the distribution of $$X$$ is any symmetrical discrete distribution, then that gives us the same final results $$1/9$$.