I have 20 identical balls. I want to put these 20 balls to 4 different boxes. In how many ways I can do it? (If necessary we can keep one or more boxes empty)
-
How many ways with $1$ ball? $2$ balls? $3$ balls? – Simon S Feb 15 '16 at 03:41
-
You may be interested to reference Stanley's Twelve-fold Way which gives a nice chart for the solutions to several classic problem types. This one in particular is provable using a Stars and Bars counting approach. – JMoravitz Feb 15 '16 at 03:46
-
If I were you, I'd like to construct a recurrence relation. – Bumblebee Feb 15 '16 at 04:24
3 Answers
You can visualize this problem as the number of non negative integer solutions to the equation, $$x_1+x_2+x_3+x_4=20$$ where $x_i$ denotes the $i^{th}$ box.
Solving this will give the desired result.
Alternatively, it can be visualized as follows. The four boxes can be viewed as a large box with four compartments. Let the compartments be demarcated by three dividers.
Now, suppose you have $23$ holes. (Number of balls + Number of dividers). Let us arrange the balls and the dividers into these holes. The first box can be defined as the number of balls between the first hole and the hole containing the first divider. The second box can be defined as the number of balls between holes containing the first and second dividers, and so on.
Thus, the problem can now be viewed as the number of ways of arranging $20$ identical balls and $3$ identical dividers into $23$ holes.
To solve this, $3$ holes can be selected from the $23$ holes to keep the dividers. The rest can be filled with balls.
Thus, the number of ways will then be $\binom{23}{3}$
- 11,185
- 3
- 22
- 42
One way of distributing the $20$ balls could be $8+0+5+7,\;\;$ represented by:
$\bullet\; \bullet\; \bullet\; \bullet\; \bullet\;\bullet\; \bullet\; \bullet\; +\;\quad\quad+\;\bullet\; \bullet\;\bullet\; \bullet\; \bullet\;+\; \bullet\; \bullet\;\bullet\; \bullet\; \bullet\; \bullet\; \bullet$
The problem essentialy becomes a count of placing the $(4-1) +'s$ in a string of $(20+4-1)$,
i.e. $\dbinom{20+4-1}{4-1}$, generalized to $\dbinom{n+k-1}{k-1}$ for $n$ balls and $k$ boxes,
the stars and bars formula.
- 41,295
Considering $E=(a+b+c+d)^{n}$, the term $a^{i}b^{j}c^{k}d^{\ell}$ indicates there're $i$ balls in box $A$, etc. There're totally $i+j+k+\ell=n$ balls. For identical balls but different boxes, the required combination are the number of terms in $E$. That is, $$\binom{n+4-1}{4-1}=\binom{n+3}{3}$$
Substitute $n=20$ in your case.
See the link here.
- 18,990