<s>[INST] Converting a generating function from fraction form to a power series Given a fraction $\frac{(1 + ax^{n})^{m}}{(1 + bx^{p})^{q}}$, how does one convert it to a series of the form $a_{0}x^{0} + a_{1}x^{1} + a_{2}x^{2} + a_{3}x^{3} . . .$ ?
I was unable to find instructions for this, and I could use the information to to solve this problem:

Given the equation $x_{1} + x_{2} + x_{3} + x_{4} + y_{1} + y_{2} = 6$,
where $0 ≤ x_{i} ≤ 2$ and where $y_{i}$ is divisible by $3$,
find the number of possible solutions in natural numbers by calculating the coefficient of $x^{6}$ in the generating function:
$f(x) = (1 + x + x^{2})^{4} (1 + x^{3} + x^{6} + . . .)^{2}$.
Hint:
$1 + x^{3} + x^{6} + . . . = \frac{1}{1 - x^{3}};$
$1 + x + x^{2} = \frac{1 - x^{3}}{1 - x}$.

 [/INST] Looking at the hints, we have:
$$1 + x^{3} + x^{6} + \cdots = \frac{1}{1 - x^{3}}$$
and
$$1 + x + x^{2} = \frac{1 - x^{3}}{1 - x}$$
so
$$\begin{align}f(x) &= (1 + x + x^{2})^{4} (1 + x^{3} + x^{6} + \cdots)^{2}\\[1ex]&=\frac{(1 - x^{3})^4}{(1 - x)^4(1-x^3)^2}\\[1ex]&=\frac{(1 - x^{3})^2}{(1 - x)^4}\\[1ex]&=\frac{(1 - 2x^{3}+x^6)}{(1 - x)^4}\\[1ex]&=(1 - 2x^{3}+x^6)\sum_{k\ge 0}\binom{k+3}{3}x^k\\[1ex]&=\sum_{k\ge 0}\left(\binom{k+3}{3}-2\binom{k}{3}+\binom{k-3}{3}\right)x^k\tag{1}\end{align}$$
The penultimate step uses the negative binomial expansion:
$$(1-x)^{-4}=\sum_{k\ge 0}\binom{k+3}{3}x^k$$
So the $x^6$ coefficient of $(1)$ is:

$$\binom{9}{3}-2\binom{6}{3}+\binom{3}{3}=45\tag{Answer}$$


This method can be easily generalised by using the general binomial and negative binomial expansions:
$$(1+x)^n=\sum_{k= 0}^{n}\binom{n}{k}x^k$$
and
$$(1-x)^{-m}=\sum_{k\ge 0}\binom{k+m-1}{m-1}x^k$$
respectively.
</s>