How many triplets $(a, b, c)$ of integers satisfy the equation $a+b+c=6$ as well as the conditions $-1 \leqslant a \leqslant 2$ and $1 \leqslant b, c \leqslant 4$?
We start by generalizing the problem by looking for the generating series of the sequence of the number of solutions to the equation $a+b+c=n$ with the same conditions on $a, b, c$ (of course, this will actually be a polynomial). Since $-1 \leqslant a \leqslant 2$, the contribution of the variable $a$ is a factor $x^{-1}+x^{0}+x^{1}+x^{2}$. As for $b$ and $c$, each gives a factor $x^{1}+x^{2}+x^{3}+x^{4}$. The generating series we are looking for is therefore

$$
f(x)=\left(x^{-1}+x^{0}+x^{1}+x^{2}\right)\left(x^{1}+x^{2}+x^{3}+x^{4}\right)^{2}=x\left(1+x+x^{2}+x^{3}\right)^{3}
$$

What we are interested in is the coefficient of $x^{6}$ in this polynomial. Directly expanding the expression above is a bit lengthy and almost returns to the original combinatorial problem. It is always advantageous to rewrite things in a form that involves terms of the highest possible degree. Thus, here, we can write

$$
f(x)=x\left(\frac{1-x^{4}}{1-x}\right)^{3}=x\left(1-3 x^{4}+3 x^{8}-x^{12}\right)(1-x)^{-3}
$$

The terms of degree 6 come from choosing either 1 or $-3 x^{4}$ in the first parenthesis, and therefore the term of degree 5 or the term of degree 1 in the second parenthesis. According to the binomial formula, the coefficient we are looking for is therefore

$$
1 \times\left(-\binom{-3}{5}\right)+(-3) \times\left(-\binom{-3}{1}\right)=\binom{7}{5}-3\binom{3}{1}=21-9=12
$$