[Math] How many ways are there to distribute 8 balls into 6 boxes with the first two boxes collectively having at most four balls

combinatorics

How many ways are there to distribute eight balls into six boxes with the first
two boxes collectively having at most four balls if:

a) The balls are identical.

b) The balls are distinct.

I'm thinking you have to use the stars and bars method, but don't know how to go about the restriction of only having collectively 4 balls in the first two boxes.

Best Answer

I'll solve the case in which the balls are identical. This is not the nicest solution, but it works and I hope it is clear.


Case 1: First two boxes have exactly four balls.

If the first two boxes together contain four balls, then we can use stars and bars twice. The number of ways to place four balls in two boxes is the number of ways to arrange $4$ stars and $1$ bar, or $5$ choose $1$. The number of ways to place the remaining four balls in the other four boxes is the number of was to arrange $4$ stars and $3$ bars, or $7$ choose $3$. This gives

$$\binom{5}{1}\binom{7}{3}$$

Case 2: First two boxes have exactly three balls. With the same reasoning, we get

$$\binom{4}{1}\binom{8}{3}$$

Case 3: First two boxes have exactly two balls.

$$\binom{3}{1} \binom{9}{3}$$

Case 4: First two boxes have exactly one ball.

$$\binom{2}{1}\binom{10}{3}$$

Case 5: First two boxes have no balls.

$$\binom{1}{1}\binom{11}{3}$$

(This makes sense because this is just stars and bars applied to putting $8$ balls into $4$ boxes)


Our total is therefore

$$5\binom{7}{3}+4\binom{8}{3}+3\binom{9}{3}+2\binom{10}{3}+\binom{11}{3}=\boxed{1056}$$