# How to find the coefficient of $x^8$ in the following:

I need to find the coefficient of $x^8$ in the following using generating functions:

$$\frac{(1+x)^2}{1-3x}$$

I attempted to write out three different generating functions adding together to give the numerator with a common denominator of $1-3x$. But this has led me no where. Any hints would be appreciated, even in the general way.

Use the geometric series to expand the denominator (assuming $|x|<\frac13$) and then multiply with $(1+x)^2$. More specifically \begin{align*}\frac{(1+x)^2}{1-3x}&=(x^2+2x+1)\cdot\frac{1}{1-3x}=(x^2+2x+1)\sum_{n=0}^{\infty}(3x)^n=\\&=(x^2+2x+1)\left(1+3x+(3x)^2+\ldots+(3x)^6+(3x)^7+(3x)^8+\ldots\right)=\\&=\ldots+x^2\cdot(3x)^6+2x\cdot(3x)^7+(3x)^8+\ldots=\\&=\left(3^6+2\cdot3^7+3^8\right)x^8+\ldots\end{align*} where in the last equations I wrote only the terms concerning $x^8$. So the requested coefficient is equal to $$3^6+2\cdot3^7+3^8$$ assuming $|x|<\frac13$.
Solution: $$3^{8} + 2\times 3^{7} + 3^{6} = 3^{6}\times 16 = \color{#00f}{\Large 11664}$$