If $$ (1+x+x^2)^n=\sum_{r=0}^{2n}a_rx^r $$ then find the sum of : $$ a_0^2-a_1^2+a_2^2 +.....+(-1)^{n-1}a_{n-1}^2=\sum_{r=0}^{n-1}(-1)^{r-1}a_r^2 $$ in terms of $a_n$ and $n$.
What I've done : I've tried replacing $x$ with $\frac{-1}{x}$ and then multiplying the resultant series with the original series. However, this proved long and tedious and I gave up. Is there any other method to solve this question ? The answer given in my textbook is $\frac{a_n(1-(-1)^na_n)}{2}$. However I believe this answer to be wrong since the previous owner has written so in the margin.
Thankyou.
Firstly note that the $a's$ have the following symmetry $a_{2n-r}=a_r$
\begin{eqnarray*} (1+x+x^2)^n =\sum_{r=0}^{2n} a_r x^{r} \end{eqnarray*} Now substitute $x=-x$ \begin{eqnarray*} (1-x+x^2)^n =\sum_{r=0}^{2n} (-1)^r a_r x^{r} \end{eqnarray*} Multiply these two equations \begin{eqnarray*} (1+x^2+x^4)^n =\cdots \end{eqnarray*} Now consider the coefficient of $x^{2n}$ ... we have \begin{eqnarray*} a_n = 2\sum_{r=0}^{2n} (-1)^r a_r^2 +(-1)^n a_n^2 \end{eqnarray*} So the answer in the book is right ... The answer is $\frac{a_n(1-(-1)^n a_n)}{2}$.