[Math] Number of ways (with repetition) to pick r objects from n distinct types of objects

combinationscombinatorics

So in my combinatorics class we learned of a theorem that stated that the number of combinations with repetition of r objects from n type of objects is $\binom{r+n-1}{r}$.

To start us off with this theorem, the teacher gave us the question, "How many ways are there to pick a collection of exactly 10 balls from a pile of red balls, blue balls, and purple balls if there must be at least 5 red balls?" She said to assume we have 5 red balls set aside, and now we pick 5 more balls from the 3 types of balls using our new theorem. So we get $\binom{5+3-1}{5}$ = $\binom{7}{5}$ = 21.

Now what I had trouble with is the next problem. The next question was the same, but the condition is now you can have at most 5 red balls. What I tried was first picking all combinations of 5 balls from only blue and purple, which would be $\binom{5+2-1}{5}$ = 6, then picking the other 5 as combinations from all three groups, which would be $\binom{5+3-1}{5}$ = 21, then multiplying my 2 results together. However, I'm told the answer should be 51, which mine obviously does not come out to.

Could someone explain what is wrong with the logic in my method and how I could go about solving it? Thanks!

Best Answer

The problem here is that options are being over counted. For example you could pick:

BBBBP then BBBBB

or

BBBBB then BBBBP

and they would count as different. I think you may have overcomplicated things. The number of ways to pick 10 balls if you can't go over 5 red is the total number of ways to pick 10 balls (which you know) minus the number of ways to pick 10 balls if atleast 6 are red (which you know how to calculate).

Related Question