# Calculate $a_n$ with formal power series

I have $$A(x) = \sum_{n=0}^\infty a_n x^n$$ and $$A(x) = (1+x)/(1+7x+6x^2)$$

I need to find $a_0,a_1,a_2,a_3$.

I multiply on each side and I get

$$(1+7x+6x^2) (a_0+a_1x+a_2x^2+a_3x^3+\ldots)=1+x$$

Now I get $$a_0+a_1x+7a_0x+\ldots = a_0 + x(a_1+7a_0) = 1+x$$

and I can compare the two sides which gives me $$a_0 = 1, \qquad a_1=1-7a_0=-6, \qquad a_2=0, \qquad a_3=0.$$

This makes sense to me but according to my homework the correct result should be $a_0 = 1$, $a_1 = -6$, $a_2 = 36$ and $a_3 = -216$.

What am I doing wrong?

Expand what you wrote $$(1+7x+6x^2) (a_0+a_1x+a_2x^2+a_3x^3+\ldots)$$ to get $$a_0+(7 a_0+a_1) x+(6 a_0+7 a_1+a_2) x^2+(6 a_1+7 a_2+a_3) x^3+(6 a_2+7 a_3) x^4+6 a_3 x^5$$ and now compare with the rhs which is $1+x$; so $$a_0=1$$ $$7a_0+a_1=1$$ $$6 a_0+7 a_1+a_2=0$$ $$6 a_1+7 a_2+a_3=0$$
$$1+7x+6x^2=(1+x)(1+6x)$$
So assuming $1+x\ne0,$ we need $$(1+6x)^{-1}=1+(-1)(6x)+\frac{(-1)(-1-1)}{2!}(6x)^2+\cdots=\sum_{r=0}^\infty(-6x)^r$$
assuming $|-6x|<1$ using Newton's generalized binomial theorem