# Using generating functions to find the coefficient

I was looking at an example in my textbook where it was asked to find in how many ways can a police captain distribute 24 rifle shells to four police officers so that each officer gets at least three shells, but not more than eight. Using generating functions: ${f(x)=(x^3+x^4+x^5+...+x^8)^4}$, and we will be looking to find the coefficient of ${x^{24}}$ in $f(x)$

We know that $f(x)= x^{12}((1-x^6)/(1-x))^4$

Therefore the answer will be the coefficient of $x^{12}$ in the expansion of $(1-x^6)^4*(1-x)^{-4}$

Which in turn is equal to $A$:
$[1-\dbinom{4}{1}x^6+\dbinom{4}{2}x^{12}-\dbinom{4}{3}x^{18}+x^{24}]*[\dbinom{-4}{0}+\dbinom{-4}{1}(-x)+\dbinom{-4}{2}(-x)^2+...]$

Up to this point I perfectly understand the problem and the proposed solution; but the textbook goes on saying that the above expression is equivalent to $B$: $[\dbinom{-4}{12}(-1)^{12}-\dbinom{4}{1}\dbinom{-4}{6}(-1)^6+\dbinom{4}{2}\dbinom{-4}{0}]$

I do not understand how they went from $A$ to $B$

I know that $C$: $[\dbinom{-4}{12}(-1)^{12}]$ is the coefficient of $x^{24}$ in: $x^{12}[\dbinom{-4}{0}+\dbinom{-4}{1}(-x)+\dbinom{-4}{2}(-x)^2+...]$

But I do not seem to make the link between $C$ and the following subtraction and addition, namely:
$[C-\dbinom{4}{1}\dbinom{-4}{6}(-1)^6+\dbinom{4}{2}\dbinom{-4}{0}]$

• What are the ways to get an $x^{12}$ term in the product $(1 - ax^6 + bx^{12} -\dotsc)\cdot (1 - ux + vx^2 - wx^3 +\dotsc)$? – Daniel Fischer Oct 12 '15 at 8:31
• @DanielFischer there will be $ax^6 * zx^6$ or $bx^{12}*1$ or $1 * mx^{12}$ – O.A. Oct 12 '15 at 8:57
• Right, if we ignore the signs. And to get the coefficient of $x^{12}$ in the product, we sum the possible ways (where the signs of course do matter). And that's what is done there, we have "coefficient of $x^0$ times coefficient of $x^{12}$ plus coefficient of $x^6$ times coefficient of $x^6$ plus coefficient of $x^{12}$ times coefficient of $x^0$". – Daniel Fischer Oct 12 '15 at 9:01
• @DanielFischer, I see! Thank you for the clarification. – O.A. Oct 12 '15 at 9:03