How many ways are there to distribute 20 identical balls to 3 distinct red boxes and 8 distinct blue boxes?

In order to continue enjoying our site, we ask that you confirm your identity as a human. Thank you very much for your cooperation.

First of all, this is a question that uses the "stars and bars" technique. In case you don't know "stars and bars", we can think of the problem as laying out the 10 balls in a row and then building boxes around the balls. Since the two walls "at the end" of the boxes is trivial, we ignore them and look only at the walls that actually divide the balls.

We can denote the balls with a 0 and the walls of the boxes as a 1.

We can have this:

0001000100010

which is 3 balls in three boxes and 1 ball in one box.

And so what we can do is look at the number of ways we can distribute the walls (the 1s). This is a combinations problem, the formula for which is:

#C_(n,k)=(n!)/((k!)(n-k)!)# with #n="population", k="picks"#

And so with "stars and bars" problems, we look at the number of unique combinations of placing the 0s and 1s.

1. no empty boxes

In this first case, we can assign 4 balls and put one each into a box. That leaves 6 balls to be divided amongst the 4 boxes. Since we need 3 box walls to denote the 4 boxes (just like in our example above), we can then find unique combinations of 6 balls and 3 walls across 4 walls (using 3 walls) is:

#((6+3),(3))=((9),(3))=(9!)/((3!)(6!))=(9xx8xx7)/6=84#

2. at most 3 empty boxes

With the 3 wall technique, we'll always have at least one box with balls (we'd need a 4th wall to wall off the boxes completely from the balls. One arrangement is:

1110000000000

this is the first 3 boxes with no balls and the last with all of them)

And so we can look at the number of ways to combine all 10 balls and 3 walls:

#((10+3),(3))=((13),(3))=(13!)/((3!)(10!))=(13xx12xx11)/6=286#

~~~~~

This question/answer on stackexchange.com was invaluable in helping me arrive at a methodology:

https://math.stackexchange.com/questions/1083000/stars-bars-question-identical-balls-in-distinct-boxes

Hint: a) You have to write 20 numbers $x_1, x_2 \ldots x_4$ that correspond to the numder of balls that will be placed in boxes 1, 2, 3 and 4 respectively. Since, they should add up to 20, you want to determine the number of solutions to the equation: $$x_1+x_2+x_3+x_4=20$$ subject to $0\le x_i$ (practially that means no constraints). According to here, you can do it in $$\dbinom{20+4-1}{4-1}=\dbinom{23}{3}=1771$$ ways.

b)Now place 2 balls in each box. So there remain 12 balls. Then as above you want to determine the number of solutions to the equation: $$x_1+x_2+x_3+x_4=12$$ subject to $0\le x_i$. Proceeding as in (a), you can do it in $$\dbinom{12+4-1}{4-1}=\dbinom{15}{3}=455$$ ways.

c)Place 1 ball in box 1 and close it. Place 1 ball in box 2. So there remain 18 balls and 3 boxes. Then as above you want to determine the number of solutions to the equation: $$x_2+x_3+x_4=18$$ subject to $0\le x_i$. Proceeding as above, you can do it in $$\dbinom{18+3-1}{3-1}=\dbinom{20}{2}=190$$ ways.

d)Put now the balls in pairs. So you have 10 pairs and you want to place them in the 4 boxes. That is exactly the problem stated in (a). Similarly you can do it in $\dbinom{10+4-1}{4-1}=\dbinom{13}{3}=286$ ways.