Counting problem involving candy and overcounting

239 Views Asked by At

I have $40$ chocolates, $29$ gumdrops, and $38$ lollipops. Why is it that the total number of ways to select $41$ candies from this set is:

$$\binom{41+3-1}{3-1} - \binom{0 + 3 - 1}{3 - 1} - \binom{11+3-1}{3-1} - \binom{2 + 3 - 1}{3 - 1}?$$

In other words, why is it that the subtracted part accounts for every instance of overcounting?

I left the combinations in the unsimplified form to provide clarity as to how I am approaching the problem using the stars and bars technique.

1

There are 1 best solutions below

2
On BEST ANSWER

The number of ways to choose $41$ candies, from an unlimited supply of each kind, is $\binom{41+3-1}{3-1}$.

From this we must subtract the all chocolate choices, the choices where we choose more than $29$ gumdrops, or where we choose more than $38$ lollipops. These choices are pairwise disjoint.

The number of all chocolate choices is $1$. That is the first subtracted term.

Now we count the more than $29$ gumdrop choices, that is, $30$ or more. Grab $30$ gumdrops. Then from the unlimited numbers, we need to choose $11$ candies. That can be done in $\binom{11+3-1}{3-1}$ ways. That is the second subtracted term.

The third is done in a similar way. Grab $39$ lollipops from the unlimited supply. We need $2$ more candies.