In how many ways can we select $r$ balls from a set consisting of $3$ red, $3$ yellow, $3 $ black and $3$ blue balls?
let $x_1,x_2,x_3,x_4$ be the number of balls of colour red, yellow, black, and blue that are selected respectively.
then we have $x_1 + x_2 + x_3 + x_4 = r\;\; $ where $x_i\in\{0,1,2,3\}$
So the generating function for this is $g(x)= (1+x+x^2+x^3)^4$
So, the answer that I want is the coefficient of $x^r$ in $g(x)$
Can someone tell me a precise and easy way to determine that?
I can write $g(x)$ as $g(x)=(\frac{1-x^4}{1-x})^4$ but this doesn't seem to help.
EDIT:- Ok so I have $g(x)= f(x)\cdot h(x)$
where $$f(x) = (1-x^4)^4 = \sum_{i=0}^{4} (-1)^iC(4,i) x^{4i}$$ and
$$h(x)=\frac{1}{(1-x)^{4}} = \sum_{i\geq 0} C(4+i -1, i)x^i$$
So I just need to use the convolution formula now to arrive at the coefficient of $x^r$
Since the numbers are small (and we can use the obvious symmetry) we can find the numbers for $r=0,1, ...$. These are
$$1,4,10,20,31,40,44,40,31,20,10,4,1$$
I then found the sequence in the OEIS and this then links to quite a number of related series.
http://oeis.org/A008287Triangle of quadrinomial coefficients, row $n$ is the sequence of coefficients of $(1 + x + x^2 + x^3)^n$.