# How many ways balls can be selected?

I am trying to solve

In how many ways can 25 balls be selected from a bag containing 15 identical red balls, 20 identical blue balls and 25 identical green balls?

Should not be the answer be -

$$60C3 - 15C3 -20C3 - 25C3 +3$$

3 IS ADDED TO take a uniuqe case from each of the three 3 same colours of ball selected.

But the answer is 281 .

Where i am wrong ?

How i can achieve this ? Thanks in advance.

## 4 Answers

Imagine that you have $25$ identical balls and three boxes, one labelled RED, one labelled BLUE, and one labelled GREEN. Your problem is equivalent to asking how many different ways there are to distribute your $25$ balls amongst the boxes, if you can put at most $15$ balls into the RED box and at most $20$ balls into the BLUE box.

If there were no upper limits, the answer would be $\binom{25+3-1}{3-1}=\binom{27}2$; see here. However, some of these violate the upper limits, so to get the actual answer, we’ll have to subtract those.

First calculate the number of distributions that put too many balls into the RED box. That requires putting $16$ balls into the RED box and then distributing the remaining $9$ balls however you please amongst the three boxes. This can be done in $\binom{9+3-1}{3-1}=\binom{11}2$ ways.

Now calculate the number that put too many (i.e., at least $21$) balls into the BLUE box; the same reasoning shows that there are $\binom{4+3-1}{3-1}=\binom62$ ways to do this.

We don’t have enough balls to put too many balls into more than one box, so the final result is $$\binom{27}2-\binom{11}2-\binom62=351-55-15=281\;.$$

Added: Here’s another way to look at it that may be more familiar to you. Let $x_1,x_2$, and $x_3$ by the number of red, blue, and green balls, respectively, that you select. Then you’re counting integer solutions to $x_1+x_2+x_3=25$ that satisfy the conditions $0\le x_1\le 15$, $0\le x_2\le 20$, and $0\le x_3\le 25$.

• you are right but i am getting difficulty in understanding your answer .It may be because i am not that good in PnC . Coming back to the question Is it similar to the question when we are asked number of non negative integral solution of x1+x2 + ..+ xn = S and each Xi >= 0 . If yes can you explain me in that terms. – vikiiii Oct 10 '12 at 17:17
• @vikiiii: Yes, it’s exactly like that. I’ll add an explanation along those lines to my answer in a few minutes. – Brian M. Scott Oct 11 '12 at 4:24
• Thanks I understood the problem .I hope spending a little time in this question will make me solve this type of problem later. – vikiiii Oct 11 '12 at 5:41
• Is this question can be solved by the same method? – vikiiii Oct 11 '12 at 5:41
• @vikiiii: I’m sorry, but I’m not sure what you’re asking; which method do you mean when you say the same method? – Brian M. Scott Oct 11 '12 at 6:12

You're seeking $\# \{(i,j,k):i \in \{0,1,\ldots,15\}, j \in \{0,1,\ldots,20\}, k \in \{0,1,\ldots,25\} \text{ and } i+j+k=25\}$ which is given by $\sum_{i=0}^{15} \sum_{j=0}^{\mathrm{min}(20,25-i)} 1=281$ since one $i$ and $j$ are determined, there is exactly one value of $k$ for which $i+j+k=25$.

We can verify this (constructively) in GAP via the code:

A:=Concatenation(List([1..15],i->1),List([1..20],i->2),List([1..25],i->3));;
B:=Combinations(last,25);;
Size(B);


which gives $281$.

Your argument has the following problem:

$\dbinom {60} 3$ counts each possibility to take three red balls separately, although you are not supposed to be able to tell the difference between different sets of red balls (because they are "identical").

So, you overcount, but you do not overcount in the sense of the inclusion-exclusion formula that you count illegal combinations, but in the sense, that you count each legal combination multiple times.

What you have been counting is: Regard the balls as distinguishable and take three balls that do not all have the same color.

This is the same as asking for the number of solutions of $a+b+c=25$ subject to the restrictions $0\le a\le15$, $0\le b\le20$, $0\le c$. That kind of question has been asked, and answered, many times on this site (although searching the site for an instance may not be the easiest thing to do --- but do look at the questions listed under the heading "Related" down the right side of this page).