Number of unique ways to select $3$ balls from $4$ red balls, $2$ green balls and $1$ blue ball Suppose there is a jar with $7$ balls: $4$ red, $2$ green and $1$ blue.
In how many unique ways can we choose $3$ balls?
Just by considering all the possibilities, I found out the answer is $6$. Namely:  


*

*red, red, red  

*red, red, green  

*red, red, blue  

*green, green, red  

*green, green, blue  

*blue, green, red  


I was wondering if it is possible to express the solution in terms of the amount of different colors (in this case $3$) and the quantity per color. (in this case $4$, $2$ and $1$)

Consider the polynomial
$$\eqalign{p(x)&:=(1+x+x^2+x^3+x^4)(1+x+x^2)(1+x)\cr  &=(1-x^5)(1-x^3)(1-x^2)(1-x)^{-3}\cr  &=(1-x^5)(1-x^3)(1-x^2)\sum_{k\geq0}{2+k\choose k}x^k\ .\cr}\tag{1}$$
For each admissible choice of $r\in[0 .. 4]$ red balls, $g\in[0 .. 2]$ green balls, and $b\in[0 .. 1]$ blue balls the expansion of this polynomial creates a term $x^r\,x^g\,x^b=x^{r+g+b}$. Now we want $r+g+b=3$. It follows that we have to extract  $N:={\rm coeff}[x^3]$ on the last line of $(1)$. Since
$$(1-x^5)(1-x^3)(1-x^2)=1-x^2-x^3+{\rm higher\ terms}$$
it follows that 
$$N={2+3\choose3}-{2+1\choose1}-{2+0\choose0}=6\ .$$
