selection of balls of three colors with restrictions

I have asked a similar question here and answers were very helpful. I tried doing similar questions and could solve them comfortably. However, I myself came up with a question like this and wondering how to solve this.

Suppose there are 20 black balls, 10 yellow balls and 5 brown balls. Balls of same color are identical. Order of selection does not matter.

1. How many ways can a selection of 15 balls be made?
2. How many ways can a selection of 15 balls be made if 2 brown must be selected always?

My approach

(1) number of solutions of $x_1+x_2+x_3 = 15$ with $0\le x_1\le 20; 0 \le x_2 \le 10; 0 \le x_3 \le5$ is the solution. Is this right? if so, is there any formula for this?

(2) Select the 2 brown balls in (only 1 way) and then find number of solutions of $x_1+x_2+x_3 = 13$ with $0\le x_1\le 20; 0 \le x_2 \le 10; 0 \le x_3 \le3$

Please give directions on how to approach similar problems. thanks.

• (1) is correct (2) all brown balls are identical so there is 1 way to select 2 brown balls. – gt6989b Aug 18 '15 at 18:42
• I think, yes, all brown are identical and hence selection of any 2 brown balls from 5 must be same – Kiran Aug 18 '15 at 18:44
• for the actual number of solutions, look here math.stackexchange.com/questions/395022/… – gt6989b Aug 18 '15 at 18:49
• thanks @gt6989b, but before that, are my approaches right? – Kiran Aug 18 '15 at 18:50
• both approaches seem correct to me – gt6989b Aug 18 '15 at 18:51

Your approaches to both problems are correct.

Since balls of the same color are indistinguishable, the number of ways $15$ balls can be selected from $20$ black balls, $10$ yellow balls, and $5$ brown balls is the number of nonnegative integer solutions of the equation $$x_1 + x_2 + x_3 = 15 \tag{1}$$ subject to the restrictions $x_2 \leq 10$ and $x_3 \leq 5$. Note that since $20 > 15$, we do not need a restriction on the number of black balls.

If there were no restrictions, the number of solutions of the equation $x_1 + x_2 + x_3 = 15$ would be equal to the number of ways of inserting two addition signs in a row of $15$ ones, which is $\binom{15 + 2}{2} = \binom{17}{2}$ since we must select which two of the seventeen symbols ($15$ ones and two addition signs) are to be addition signs.

From these, we must remove those solutions in which $x_2 > 10$ or $x_3 > 5$. Note that it is not possible for both of these conditions to hold simultaneously since $11 + 6 = 17 > 15$.

Suppose $x_2 > 10$. Let $y_2 = x_2 - 11$. Then $y_2$ is a nonnegative integer. Moreover, substituting $y_2 + 11$ for $x_2$ in equation 1 yields \begin{align*} x_1 + y_2 + 11 + x_3 & = 15\\ x_1 + y_2 + x_3 & = 4 \end{align*} Thus, the number of solutions of equation 1 in which $x_2 > 10$ is equal to the number of ways two addition signs can be placed in a row of four ones, which is $\binom{4 + 2}{2} = \binom{6}{2}$.

Now, suppose $x_3 > 5$. Let $z_3 = x_3 - 6$. Then $z_3$ is a nonnegative integer. Moreover, substituting $z_3 + 6$ for $x_3$ in equation 1 yields

\begin{align*} x_1 + x_2 + z_3 + 6 & = 15\\ x_1 + x_2 + z_3 & = 9 \end{align*} Thus, the number of solutions of equation 1 in which $x_3 > 5$ is the number of ways in which two addition signs can be placed in a row of nine ones, which is $\binom{9 + 2}{2} = \binom{11}{2}$.

Hence, the number of ways $15$ balls can be selected from $20$ indistinguishable black balls, $10$ indistinguishable yellow balls, and $5$ indistinguishable brown balls is $$\binom{17}{2} - \binom{6}{2} - \binom{11}{2}$$ which agrees with the answer ml0105 obtained using generating functions.

You can apply the same method to solve the second problem you posed.

• Nice explanation! – user84413 Aug 19 '15 at 1:00
• Nice variation, inserting two addition signs rather than "bars", but not immediately clear what, say, $+x_1\; x_2 + x_3 = 15$ represents. – true blue anil Aug 19 '15 at 6:42
• @trueblueanil Remember that we are solving an equation in the nonnegative integers. The sequence $1 1 1 1 1 1 + 1 1 1 11 + 1111$ represents the solution $x_1 = 6, x_2 = 5, x_3 = 4$, while the sequence $+ 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1$ represents the solution $x_1 = 0,$x_2 = 10, x_3 = 5$. – N. F. Taussig Aug 19 '15 at 8:57 • I understand, I was only thinking how best to explain to students. I guess we can note that$x_1$is to the left of the 1st +, and so on. Nice variation, we can directly deal with$x_1 + x_2...$instead of bringing in the balls and bins or whatever. (+1) – true blue anil Aug 19 '15 at 9:19 Are you familiar with generating functions? These will help a lot, as you can use them rather than writing out the inclusion-exclusion argument yourself. A generating function uses the exponent of the variable to index the quantity. So$x^{0}$indicates we have none of the given item, while$x^{5}$indicates we have$5$of the given item. The coefficient of the term indicates the number of ways to obtain that term, which is the count in which you are interested. Consider first the number of yellow balls. We have at most$10$yellow balls, yielding the generating function for yellow balls: $$f_{y}(x) = \sum_{i=0}^{10} x^{i} = \dfrac{1-x^{11}}{1-x}$$ Similarly, we have for brown balls: $$f_{br}(x) = \sum_{i=0}^{5} x^{i} = \dfrac{1-x^{6}}{1-x}$$ Now since we have more black balls than we can use, we can simply let the series go out to infinity: $$f_{bl}(x) = \sum_{i=0}^{\infty} = \dfrac{1}{1-x}$$ Now we multiply the generating functions together to get: $$f(x) = \dfrac{(1-x^{6})(1-x^{11})}{(1-x)^{3}}$$ Now we have that: $$\dfrac{1}{(1-x)^{3}} = \sum_{i=0}^{\infty} \binom{3 + i - 1}{i} x^{i}$$ So: $$f(x) = (1-x^{6})(1-x^{11}) \sum_{i=0}^{\infty} \binom{3+i-1}{i}x^{i}$$ We are interested in the coefficient of$x^{15}$. This yields: $$\binom{3 + 15 - 1}{15} - \binom{3 + 9 - 1}{9} - \binom{3 + 4 - 1}{4}$$ The second term comes from multiplying with the$-x^{6}$term, so we look$i = 9$in the summation. Similarly, with$-x^{11}$, we look for the coefficient of$x^{4}\$ in the summation.

The approach is similar for part (b).