[Math] Finding a coefficient using generating functions

combinatoricsgenerating-functions

I need to find a coefficient of $x^{21}$ inside the following expression:

$$(x^{2} + x^{3} + x^{4} + x^{5} + x^{6})^{8}$$

I think the only way (using generating functions) is to express the parentheses content with a generating function.

The generating function for the $(1, x, x^{2}, x^{3}, …)$ sequence is equal to $\frac{1}{1-x}$.

However, well…the expression at the top is not infinite, so I can't really express it as a generating function.

How can I do this?

Best Answer

$$(x^{2} + x^{3} + x^{4} + x^{5} + x^{6})^{8}=(x^2(1+x+x^2+x^3+x^4))^8=$$ $$=x^{16}\left(\frac{1-x^5}{1-x}\right)^8=x^{16}(1-x^5)^8(1-x)^{-8}=$$ $$=x^{16}\sum_{k=0}^{8}\binom{8}{k}(-x)^{5k}\sum_{l=0}^{\infty}\binom{8+l-1}{l}x^l=$$ $$=\sum_{l=0}^{\infty}\sum_{k=0}^{8}(-1)^{5k}\binom{8+l-1}{l}\binom{8}{k}x^{16+5k+l}$$ $$16+5k+l=21\Rightarrow k=1,l=0 \text{and}k=0,l=5$$ coefficient next $x^{21}$ is $$(-1)^0\binom{8+5-1}{5}\binom{8}{0}+(-1)^5\binom{8+0-1}{0}\binom{8}{1}=\binom{12}{5}-8$$