# Balls and bins - picking drawing one ball from each bin and calculating probability that all balls are black

Assume we have $$3$$ bins: bins $$L_1, L_2, L_3$$, in each bin, there are $$3$$ balls. Alice is picking one ball from each bin at random. The balls can be either white or black. Alice does not know how many black or white balls are in each bin. She only knows the total number of black balls (denoted as $$B$$) and white (denoted as $$W$$) in the bins. Let's assume that the total number of black balls is $$6$$. We want to compute the probability that all selected balls are black (let's denote it $$p$$).

Intuitively, the distribution of white and black balls can end up as follows:

Case 1:

• $$L_1$$ has $$B = 1$$,
• $$L_2$$ has $$B = 2$$,
• $$L_3$$ has $$B = 3$$

or, Case 2:

• $$L_1$$ has $$B = 2$$
• $$L_2$$ has $$B = 2$$
• $$L_3$$ has $$B = 2$$

Case 3:

• $$L_1$$ has $$B = 3$$
• $$L_2$$ has $$B = 3$$
• $$L_3$$ has $$B = 0$$

Thus, the total probability of picking only black balls is $$p = (\frac{1}{3} \cdot \frac{2}{3} \cdot 1) + (\frac{2}{3} \cdot \frac{2}{3} \cdot \frac{2}{3}) + 0 = 0.5185$$ Is the above correct?

Q2: In the second case (when each box has an equal number of black balls) Alice has the highest chances to pick only black balls (which is $$0.2962$$), so this is her "best-case scenario", while the $$p = 0.5185$$ is the total probability given that Alice cannot predict a-priori how the black balls will be distributed among the bins. Is the total probability considered an "average case" or should the average-case be computed differently?

EDIT:

Following the guidance in the comments, here is an updated version:

Assume we have $$n$$ balls and $$k$$ bins. $$B$$ balls are black, $$W = n - B$$ balls are white. We assigned the balls uniformly at random into the bins in such a way that each bin has $$x = \frac{n}{k}$$ elements ($$k|n$$). Once the balls are in the bins we pick from each bin one ball uniformly at random. What is the probability that all $$k$$ selected balls will be black? Let $$F$$ be an event that all balls are black, and let $$B_i$$ denote the number of black balls in the $$i'th$$ bin. From the total probability we can define it as follows:

$$Pr(F) = \sum_{b_1 + b_2 + \ldots b_k = B} Pr(F | B_1 = b_1, \ldots B_k = b_k)\cdot Pr(B_1 = b_1, \ldots B_k = b_k)$$

The first probability component is $$Pr(F | B_1 = b_1, \ldots B_k = b_k) = \prod_{i=1}^k \frac{b_i}{x}$$

The second is $$Pr(B_1 = b_1, \ldots B_k = b_k) = \frac{B!W!}{b_1!\cdot b_2! \cdot \ldots \cdot b_k! w_1! \cdot w_2! \cdot \ldots \cdot w_k!} \cdot \frac{(x!)^k}{n!} \\ = \frac{B!(n-B)!}{\prod_{i=1}^k b_i!\cdot(x-b_i)!}\cdot \frac{(x!)^k}{n!}$$

Combining the two together we get $$(*) \quad Pr(F) = \sum_{b_1 + b_2 + \ldots b_k = B} \left( \prod_{i=1}^k \frac{b_i}{x} \cdot \frac{B!(n-B)!}{\prod_{i=1}^k b_i!\cdot(x-b_i)!}\cdot \frac{(x!)^k}{n!}\right)$$

Is that correct?

Also, there was a lot of discussion in the comments that the problem which I described is equal to asking: given $$n$$ balls, where $$B$$ are black and $$W$$ are white if I pick $$k$$ balls what is the probability that all of them are black. This probability would be defined as $$(**)\quad Pr(F) = \frac{{B \choose k}}{{n \choose k}}$$ I totally agree with the given examples, that it is the same value. However, this means the formulas $$(*)$$ and $$(**)$$ should be equal. I tried to simplify the formula (*) but I couldn't get what is in $$(**)$$. Is there something wrong with $$(*)$$?

• Not every case you listed is equally likely. But it shouldn't matter. All that matters is that Alice selects 3 random balls. Feb 24, 2021 at 13:08
• @nicola Can you please clarify a bit? Feb 24, 2021 at 13:13
• That the bin thing is a red herring. Imagine that she select the 3 balls from just one bin with 6 black and 3 white balls. How is that different from the scenario you described? Feb 24, 2021 at 13:27
• To make things more explicit: imagine Alice has 6 black balls and 3 white balls. First scenario: she selects straight up 3 balls. Second scenario: she randomly puts 3 balls in each of 3 labeled bins; than she randomly extracts one ball from each bin. Do you think that the probability of extracting 3 black balls is different between the two scenarios? Feb 24, 2021 at 13:39
• Yes, your probability in the last comment is correct. Now you, knowing the right answer, have to figure out what was wrong in your first attempt (Hint: black balls distributing 3/2/1, or 2/2/2 or 3/3/0 are not equally likely). Feb 24, 2021 at 13:56

The probability of getting exactly three black balls is given by:

$$P(\text{3 B}) = \frac{6\choose 3}{9\choose 3} \simeq 0.2380952$$

and it's the same of course of what Alice had if she extracts the 3 balls directly from a unique bin of 9 balls.

The bin subdivision doesn't affect the probability and it is obvious if you look at the following way. Imagine that Alice extracts one ball at the time, without looking, and "rank" the balls as the order of extraction. The "free" extraction corresponds in selecting balls 1,2,3; the "bins" extraction corresponds in selecting balls 1,4,7 after putting 1,2,3 on the first bin, 4,5,6 on the second and 7,8,9 on the third. It's obvious that the probability of having 3 blacks does not change.

However, if you really insist in starting with bins, things get unnecessarily complicated and tedious, because you have to calculate the probability of each bin composition. So, let's start assuming balls are numbered 1 to 9, and, as above, 1-2-3 belong to the first bin and so on. Next, we think at the "positions" of the white balls (easier to visualize, being less); there are $${9\choose 3} = 84$$ different combinations they might assume. Now, we see how many of this combinations belong to the 1/2/3, 2/2/2 or 3/3/0 bin distribution.

Let's start with 2/2/2, which is easier. A white ball must stay in position 1,2 or 3; another in 4,5 or 6 and the last in 7,8 or 9. In total, you have $$3\cdot 3\cdot 3 = 27$$ combinations and so:

$$P(2/2/2) = \frac{27}{84} \; .$$

Now, we consider the 3/3/3 distribution. Now there are just 3 combinations of white balls that allow it, and namely 1-2-3, 4-5-6 and 7-8-9. So we have:

$$P(3/3/0) = \frac{3}{84} \; .$$

For the 3/2/1, we see that there are 6 of them, by permuting 1,2 and 3. For the specific 1/2/3 distribution we have that the first white ball must stay either in position 1,2 or 3; the other two must stay between ball 4 and 6, leaving a black ball that can be stay in any three of the remaining spot. So it means that you have $$6\cdot 3 \cdot 3 = 54$$ combinations for 3/2/1 and so:

$$P(3/2/1) = \frac{54}{84} \; .$$

$$P(\text{3 B}) = P(2/2/2) \cdot \left(\frac{2}{3}\right)^3 + P(3/2/1)\cdot\frac{1}{3}\cdot\frac{2}{3}$$

• Thanks for such a detailed explanation! I've read it and I think I understand it. If I may ask the last thing: I found here: brilliant.org/wiki/multinomial-coefficients that the multinomial coefficient describes the number of ways to put $n$ objects into $k$ bins, such that bin $i$ has $b_i$ objects. So $n=6$, $k=3$ and the number of ways to put the black balls into the bins such that I have distribution $3/2/1$ would be $6! / (1! \cdot 2! \cdot 3!) = 60$. Hence, it is different than the number of combinations that you mentioned. From where does this difference come? Mar 2, 2021 at 12:48
• Why do you think that those multinomial coefficients are relevant here? (Hint: for a multinomial every bin is always available and so you could end up with a 5/1/1, or 4/2/0 or even 6/0/0 distributions; here your bins are constrained to have 3 balls.) Mar 3, 2021 at 8:28
• Oh, yes, you're right! So just getting back to your post - if I understand correctly even in a general case, when I have $n$ balls ($b$ black and $w = n-b$ white) and $k$ bins, and each bin has $x = \frac{n}{k}$ elements, when I choose $1$ ball from each bin, the probability that all $k$ balls will be black is the same as just picking $k$ balls out of $n$ balls? Mar 3, 2021 at 11:46
• I updated my post and tried to define the probability of an event that all balls are black in a more general case, both if I take bins into account and not. Can you please check it? Mar 3, 2021 at 18:01

Assume the bins are filled randomly. Then the probability of the cases are the following:

1. $$(3,2,1):\quad 6\times \frac{\binom63\binom30}{\binom93}\frac{\binom32\binom31}{\binom63}=\frac9{14}$$
2. $$(2,2,2):\quad 1\times\frac{\binom62\binom31}{\binom93}\frac{\binom42\binom21}{\binom63}=\frac9{28}$$
3. $$(3,3,0):\quad 3\times\frac{\binom63\binom30}{\binom93}\frac{\binom33\binom30}{\binom63}=\frac1{28}$$

Correspondingly the probability to pick only the black balls is: $$\frac9{14}\frac33\frac23\frac13+\frac9{28}\frac23\frac23\frac23=\frac5{21}.$$

The same probability one would obtain if the balls were drawn directly from a bin with 9 balls: $$\frac69\frac58\frac47=\frac5{21},$$ which was clear also without any calculation.

EDIT:

In general the number of ways to fill the boxes with $$b_1,b_2,\dots b_k$$ black balls and $$w_1,w_2,\dots w_k$$ white balls is: $$\frac{b!}{b_1!b_2!\cdots b_k!}\frac{w!}{w_1!w_2!\cdots w_k!}$$

• The difference comes from the fact that you should choose the white ball(s) as well. In your particular example it is the second box where we put 2 black balls. There are 3 ways to choose the absent white ball which triples the number of possible combinations - $180$.
– user
Mar 2, 2021 at 13:12
• It does matter for correct computation of the probability.
– user
Mar 2, 2021 at 13:21
• This nothing else as your own formula corrected by the fact that black and white balls are to be treated on the equal ground ($w_i=x-b_i$ is the number of white balls in the $i$-th box).
– user
Mar 2, 2021 at 15:24
• To obtain the probability just divide the obtained number by the total number of ways to fill the boxes $$\frac {n!}{(x!)^k}.$$
– user
Mar 2, 2021 at 17:46
• I think you'd better to accept an answer and post a new question rather than permanently change the existing one.
– user
Mar 3, 2021 at 18:50