# What is the probability that if $5$ balls are distributed to $3$ bags (with no bag left empty) that there is exactly one ball in the first bag?

A friend of mine gave me the following exercise: There are $5$ balls and $3$ bags, there are no empty bags (each bag contains at least $1$ ball). What is the probability to have exactly $1$ ball in the first bag?

My reasoning was as follows: Since there are no empty bags we can assume that we already have $3$ balls in place and we only have $2$ left. So I will denote 1 1 0 as 'there is a ball in the first bag and in the second bag, but not in the third'.

The favorable outcomes are:

0 1 1
0 2 0
0 0 2


The unfavorable outcomes are:

1 0 1
2 0 0
1 1 0


The probability of having exactly $1$ ball in the first bag is favorable outcomes/ (favorable outcomes + unfavorable outcomes) which is $3/6$ or $1/2$. But my friend keeps telling me that the answer is slightly different. Please let me know if there is a flaw in my reasoning. Thanks!

• Are the balls distinguishable? – DHMO Apr 13 '17 at 0:26

## 2 Answers

The answer to your question depends on whether the balls are distinct. If the balls are identical and the bags are distinct (which seems to be a reasonable assumption since there is a first bag), your answer is correct.

What is the probability that if five identical balls are distributed to three bags so that there are no empty bags that exactly one ball is in the first bag?

Assume the bags are distinct. Let $x_k$ be the number of balls placed in the $k$th bag. Then the number of possible outcomes is the number of solutions in the positive integers of the equation $$x_1 + x_2 + x_3 = 5$$ A particular solution corresponds to the placement of two addition signs in the four spaces between successive ones in a row of five ones. For instance, $$1 1 + 1 + 1 1$$ corresponds to $x_1 = 2$, $x_2 = 1$, and $x_3 = 2$, while $$1 1 1 + 1 + 1$$ corresponds to $x_1 = 3$, $x_2 = 1$, and $x_3 = 1$. Thus, the number of possible outcomes is the number of ways we can select two of the four spaces between successive ones to be filled with addition signs, which is $$\binom{4}{2} = 6$$ as you found. Since an outcome is favorable if exactly one ball is placed in the first bag, the number of favorable outcomes is the number of solutions of he equation $$1 + x_2 + x_3 = 5$$ in the positive integers, which is equivalent to the number of solutions of the equation $$x_2 + x_3 = 4$$ in the positive integers. The number of such solutions is the number of ways we can insert one addition sign in the three spaces between successive ones in a row of four ones, which is $$\binom{3}{1} = 3$$ as you found. Hence, if the five balls are identical, the probability that exactly one ball is placed in the first bag is $$\frac{\binom{3}{1}}{\binom{4}{2}} = \frac{3}{6} = \frac{1}{2}$$

What is the probability that if five different balls are distributed to three bags so that are no empty bags that exactly one ball is in the first bag?

Assume the bags are distinct. There are $3^5$ ways to distribute five different balls to three bags since there are three choices for each of the five balls. However, this includes distributions in which some of the bags are empty. The number of ways we can distribute five balls to only two of the bags is $$\binom{3}{1}2^5$$ since there are three ways to choose which bag will be empty and two remaining choices for each of the five balls. However, subtracting this from $3^5$ removes those distributions in which exactly one bag is used twice, once for each of the ways we could have selected one of the other two bags to be empty.
We only want to subtract these cases once, so we need to add them back. There are $\binom{3}{2}$ ways to select which two bags will be empty and one way to place all the balls in the remaining bag. Thus, by the Inclusion-Exclusion Princple, the number of possible outcomes is $$3^5 - \binom{3}{1}2^5 + \binom{3}{2}1^5 = 243 - 3 \cdot 32 + 3 \cdot 1 = 150$$ It remains to count favorable outcomes. There are five ways to select which ball is placed in the first bag. If there were no further restrictions, there would be $2^4$ ways to distribute the remaining balls to the other two bags. However, two of these outcomes place all of the remaining balls in one bag, which would leave an empty bag. Hence, the number of favorable outcomes is $$\binom{5}{1}\left[2^4 - \binom{2}{1}1^4\right] = 5(16 - 2) = 5 \cdot 14 = 70$$ Thus, if the balls are distinct, the probability is $$\frac{\binom{5}{1}\left[2^4 - \binom{2}{1}1^4\right]}{3^5 - \binom{3}{1}2^5 + \binom{3}{2}1^5} = \frac{70}{150} = \frac{7}{15}$$

• Or you can just put weighting on the 6 cases if the balls turn out to be distinguishable. – DHMO Apr 13 '17 at 0:28
• (+1) A thought though: Which answer is for real life balls and bags? And what situation is the other answer for? – N. Shales Apr 13 '17 at 0:51
• Just out of curiosity, do you use any LaTeX-editor to type detailed answers or do you do it right onsite? – alekscooper Apr 13 '17 at 6:51
• @alekscooper This site uses MathJax to render LaTeX, so I can type up answers on site unless I need to include a diagram, in which case I create a diagram using the LaTeX drawing program tikz, then upload it by clicking the button that looks like a picture of the sun above a mountain. – N. F. Taussig Apr 13 '17 at 8:17

For the total number of combinations, in this situation, two balls are distributed among 3 bags, after placing 1 ball in each bag. This situation is also the same, if we take away one ball from each bag, so that 2 balls are distributed among 3 people with no balls.

Using the combination with repetition formula we have: $$^{n+r-1}C_{n-1},$$ Total outcomes = $$^{3+2-1}C_{2-1}$$

where n is the number of people, and r is the number of balls.

For the situation in placing no more than one ball, we leave out the first bag, and distribute the remaining 2 balls to 2 people.

Thus, there are $^{2+2-1}C_{2-1}$ favourable outcomes.

Answer $\rightarrow$ $\frac{^3C_1}{^4C_2} \rightarrow \frac{3}{6}\rightarrow \frac{1}{2}$

Please specify if I'm wrong. Cheers!

EDIT: I accidentally did $\frac{1}{probability}$ . Thanks for specification fellas!

• In your denominator, you need to find the number of solutions of the equation $x_1 + x_2 + x_3 = 2$ in the nonnegative integers since you wish to distribute the remaining two balls among the three bags. That calculation yields $\binom{2 + 3 - 1}{3 - 1} = \binom{4}{2} = 6$. – N. F. Taussig Apr 13 '17 at 0:19