I encountered this question in undergrad intro combinatorics class and my professor showed us how to use generating expressions to get the answer (it should be 1061).
My question has two parts:
- Is there anyway to solve this problem from first principles without generating expressions? (I'm not looking for some complicated analytic expression, but an actual exact result)
- Using generating expressions, what's the intuition behind each step of the process of solving?
I realize this is a bulky question, so please feel free to answer either part (or both) in full or just leave whatever thoughts you may have.
With regard to the first question, if we let $x_r, x_b,$ and $x_g$ represent, respectively, the number of red, blue, and green balls selected, then the number of ways we can select $70$ balls from the jar containing $30$ red, $40$ blue, and $50$ green balls is the number of solutions of the equation $$x_r + x_b + x_g = 70 \tag{1}$$ in the nonnegative integers subject to the restrictions $x_r \leq 30, x_b \leq 40, x_g \leq 50$.
If we initially ignore the restrictions on $x_r, x_b,$ and $x_g$, equation $1$ is an equation in the nonnegative integers. A particular solution of equation $1$ corresponds to the placement of two addition signs in a row of $70$ ones, with the number of ones to the left of the first addition sign representing the number of red balls selected, the number of ones between the two addition signs representing the number of blue balls selected, and the number of ones to the right of the second addition sign representing the number of green balls selected. Therefore, the number of solutions of equation $1$ is the number of ways we can select two of the $72$ positions required for $70$ ones and two addition signs to be filled with addition signs, which is $$\binom{70 + 3 - 1}{3 - 1} = \binom{72}{2}$$
In general, the number of ways $k$ objects can be selected from $n$ types of objects without restrictions is the number of solutions of the equation $$x_1 + x_2 + x_3 + \cdots + x_n = k$$ in the nonnegative integers, which is $$\binom{k + n - 1}{n - 1}$$ since we must select which $n - 1$ of the $k + n - 1$ positions required for $k$ ones and $n - 1$ addition signs will be filled with addition signs.
However, we must remove those solutions of equation $1$ which violate one or more of the restrictions $x_r \leq 30, x_b \leq 40, x_g \leq 50$. Observe that it is not possible to violate two or more of the restrictions simultaneously since $31 + 41 = 72 > 70$.
Suppose $x_r > 30$. Then $x_r' = x_r - 31$ is a nonnegative integer. Substituting $x_r' + 31$ for $x_r$ in equation $1$ yields \begin{align*} x_r' + 31 + x_b + x_g & = 70\\ x_r' + x_b + x_g & = 39 \end{align*} which is an equation in the nonnegative integers with $$\binom{39 + 3 - 1}{3 - 1} = \binom{41}{2}$$ solutions.
As you should verify, there are $$\binom{31}{2}$$ solutions of equation $1$ which violate the restriction that $x_b \leq 40$ and $$\binom{21}{2}$$ solutions of equation $1$ which violate the restriction that $x_g \leq 50$.
Thus, by the Inclusion-Exclusion Principle, the number of ways we can select $70$ balls from the jar containing $30$ red, $40$ blue, and $50$ green balls is $$\binom{72}{2} - \binom{41}{2} - \binom{31}{2} - \binom{21}{2} = 1061$$