<s>[INST] Problem solving a word problem using a generating function 
How many ways are there to hand out 24 cookies to 3 children so that they each get an even number, and they each get at least 2 and no more than 10? Use generating functions. 

So the first couple steps are easy.
The coefficient is $x^{24}$
$g(x) = x^6(1+x^2+x^4+x^6+x^8)^3$ or  what I got was $x^6 (1 + (x^2)^1 +...+ (x^2)^4)^3$
now finding the closed formula is where I am having problems 
My answer: using the fact that $\dfrac{1-x^{n+1}}{1- x}$
I get $x^6\left(\dfrac{1-x^9}{1-x}\right)$ which is wrong 
The correct answer: $x^6\left(\dfrac{1-x^{10}}{1-x^2}\right)$
If someone could explain in some detail on how to get the correct formula would be much appreciated. Thanks!
 [/INST] Here is variation of the theme which might be helpful when doing the calculation. It's convenient to use the coefficient of operator $[x^n]$ to denote the coefficient of $x^n$ of a series.

We obtain
  \begin{align*}
[x^{24}]&(x^2+x^4+x^6+x^8+x^{10})^3\tag{1}\\
&=[x^{24}]x^6(1+x^2+x^4+x^6+x^8)^3\\
&=[x^{18}]\left(\frac{1-x^{10}}{1-x^2}\right)^3\tag{2}\\
&=[x^{18}](1-x^{10})^{3}\sum_{n=0}^\infty\binom{-3}{n}(-x^2)^n\tag{3}\\
&=[x^{18}](1-3x^{10})\sum_{n=0}^\infty\binom{n+2}{2}x^{2n}\tag{4}\\
&=\left([x^{18}]-3[x^8]\right)\sum_{n=0}^\infty\binom{n+2}{2}x^{2n}\tag{5}\\
&=\binom{11}{2}-3\binom{6}{2}\tag{6}\\
&=10
\end{align*}

Comment:


*

*In (1) we respect that an even number of at least $2$ and at most $10$ cookies is to distribute to three children. The coefficient of operator selects the coefficient of $x^{24}$ which gives the wanted number.

*In (2) we use the rule
\begin{align*}
[x^{p+q}]A(x)=[x^p]x^{-q}A(x)
\end{align*}
and apply the finite geometric series with argument $x^2$.

*In (3) we use the binomial series expansion for $\frac{1}{(1-x^2)^3}$

*In (4) we expand $(1-x^{10})^3$ and take the first two terms only since all other therms have powers greater than $18$. We also use the binomial identity
\begin{align*}
\binom{-p}{q}=\binom{p+q-1}{p-1}(-1)^q
\end{align*}

*In (5) we use the linearity of the coefficient of operator and apply the rule stated in the comment of (2).

*In (6) we select the coefficients of $x^{18}$ and $x^{8}$ by taking $n=9$ and $n=4$.
</s>