In how many ways can we select $r$ balls from a set consisting of $3$ red, $3$ yellow, $3 $ black and $3$ blue balls? 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$
 A: It is convenient to use the coefficient of operator $[x^n]$ to denote   the coefficient  of $x^n$ of a series.

We obtain for $0\leq r\leq 12$
\begin{align*}
\color{blue}{[x^r]}&\color{blue}{\left(\frac{1-x^4}{1-x}\right)^4}\\
&=[x^r]\left(1-4x^4+6x^8-4x^{12}\right)\sum_{j=0}^\infty  \binom{-4}{j}\left(-x\right)^j\tag{1}\\
&=[x^r]\left(1-4x^4+6x^8-4x^{12}\right)\sum_{j=0}^\infty  \binom{j+3}{3}x^j\tag{2}\\
&\,\,\color{blue}{=\binom{r+3}{3}-4\binom{r-1}{3}[[r\geq 4]]+6\binom{r-5}{3}[[r\geq  8]]-4[[r=12]]}\tag{3}
\end{align*}
which  results in
  \begin{align*}
1,4,10,20,31,40,44,40,31,20,10,4,1
\end{align*}
  corresponding to the answer from @SDolan.

Comment:


*

*In (1)  we  expand the numerator  up to powers of $12$ since other powers do not contribute to $[x^r]$. We also  use  the   binomial series expansion.

*In (2) we use the binomial identity $\binom{-p}{q}=\binom{p+q-1}{q}(-1)^q$.

*In (3) we select the coefficients accordingly. We use Iverson  brackets to avoid negative upper indices of  binomial coefficients.
A: 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$.
