In how many different ways can eight identical cookies be distributed among three distinct children if each child receives at least two cookies and no more than four cookies?
$x_1 \ ^2$ + $x_2 \ ^2$ + $x_3 \ ^2$ = 8
could be written as -
($x^2$ + $x^3$ + $x^4$)($x^2$ + $x^3$ + $x^4$)($x^2$ + $x^3$ + $x^4$) = $(x^2 +x^3 + x^4)^3$
Now I had to find out coefficient of $x^8$. This was a small problem so I manually calculated it and I got the answer 6, but is there any direct way to find out $a_kx^k$? without any expansion. I know the same problem can be solved using stars and bars method, but I wanted to know if there is any direct way to find coefficient using above method or not.
A handy identity that often helps in this type of problem is $$1+x+x^2+ \dots +x^n = \frac{1-x^{n+1}}{1-x}$$ so let's see if we can apply it here: $$\begin{align} (x^2+x^3+x^4)^3 &= x^6 (1+x+x^2)^3 \\ &= x^6 \left( \frac{1-x^3}{1-x} \right)^3 \\ &= x^6 (1-x^3)^3 (1-x)^{-3} \\ &= x^6 (1-3x^3+3x^6-x^9) \sum_{i=0}^{\infty} \binom{3+i-1}{i} x^i \end{align}$$ We applied the Binomial Theorem for a negative exponent in the last step.
From the last expression we can easily see that the coefficient of $x^8$ is $$\binom{3+2-1}{2} = 6$$