# 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 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$$.

• What justifies your assertion after "note that"?
– whuber
Aug 15 '19 at 16:11
• @whuber: I have assumed X has uniform distribution because the box contains 3 balls (either red or blue) and no further information about the distribution of its colors, as we have four cases for the content of the box with uniformly probabilities. Aug 15 '19 at 18:18
• Right: that's a novel assumption (not inherent in the question), not a fact one should "note."
– whuber
Aug 15 '19 at 18:35
• I would suggest only making a slight change to your characterization by pointing out this is an assumption you have introduced in order to obtain an answer, in keeping with the OP's implicit belief in some kind of prior distribution. Then the logic and scope of validity of your answer would be clear to all readers.
– whuber
Aug 15 '19 at 18:42
• @whuber: I have changed it.. i think so is better. many thanks. Aug 15 '19 at 19:17