Generating Functions- Closed form of a sequence We are given the following generating function : $$G(x)=\frac{x}{1+x+x^2}$$
The question is to provide a closed formula for the sequence it determines.
I have no idea where to start. The denominator cannot be factored out as a product of two monomials with real coefficients. Any sort of help to solve this problem is welcome!
 A: From
$$G(x)=\frac{x}{1+x+x^2}=\frac{x(1-x)}{(1+x+x^2)(1-x)}=\frac{x-x^2}{1-x^3}$$
we see that the sequence is periodic mod $3$. By checking the first few terms,
$$a_n=\begin{cases}0&\text{if }n\equiv 0\pmod 3,\\
1&\text{if }n\equiv 1\pmod 3,\\
-1&\text{if }n\equiv 2\pmod 3.\\
\end{cases}$$
A: Another way:
Write $$\frac{x}{1+x+x^2}=\sum_{n=0}^\infty a_nx^n,$$
whence $$x=(1+x+x^2)\sum_{n=0}^\infty a_nx^n.$$
From here $a_0=0, a_1=1, a_n+a_{n-1}+a_{n-2}=0$.
A: If you want the Binet formula for this you can solve the matrix
Set up the partial fraction 
$$\frac{x}{1+x+x^2}=\frac{A}{1-ax}+\frac{B}{1-bx}$$ where $$a=\frac{-1+\sqrt{3}i}{2}$$ and $$ b=\frac{-1-\sqrt{3}i}{2}$$ so that
$$A(1-bx)+B(1-ax)$$
The matrix becomes
\begin{bmatrix}
-b&-a&1\\[0.3em]
1&1&0
 \end{bmatrix}
or
\begin{bmatrix}
\frac{1+\sqrt{3}i}{2}&\frac{1-\sqrt{3}i}{2}&1\\[0.3em]
1&1&0
 \end{bmatrix}
which in reduced echelon form is 
\begin{bmatrix}
1&0&\frac{-\sqrt{3}i}{3}  \\[0.3em]
0&1&\frac{\sqrt{3}i}{3}
\end{bmatrix}
The closed form then becomes
$$a_n=\frac{-\sqrt{3}i}{3}\left(\frac{-1+\sqrt{3}i}{2}\right)^n+\frac{\sqrt{3}i}{3}\left(\frac{-1-\sqrt{3}i}{2}\right)^n$$
$a_0=0$ $a_1=1$, $a_2=-1$, $a_3=0$, $a_4=1$, $a_5=-1$ etc.
