# Number of ways (with repetition) to pick r objects from n distinct types of objects

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!

• Why should you multiply? You are overcounting, say for example the scenario of picking five blue balls in the first step and five purple balls in the second step you also counted while picking five purple balls in the first step and five blue in the second step as well as by picking 3blue2purp in first step and 2blue3purp in second step. Multiplication principle should only be used if every outcome is achieved exactly once (or exactly the same number of times as one another). – JMoravitz Mar 15 '17 at 20:25
• A correct method would be to remove the "bad" outcomes from the total number of outcomes. The arrangements with at most 5 red balls are those arrangements where you did not use 6 or more red balls. – JMoravitz Mar 15 '17 at 20:26

## 1 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).