# Regarding algebric manipulation in order to find $a_0^2 - a_1^2 + a_2^2 + ... a_{2n}^2$

In the problem below I am unsure about the validity of the manipulation in Step 3 of the solution.

Tldr : How is $$(1/x^2+1+x^2)^n = 1/x^{2n}(1 + x^2 + x^4)^n$$? (I plugged in small numbers and it does show that the equation is valid but I do not understand how it was deduced)

The problem :

Given $$(1+x+x^2)^n$$ = $$a_0 + a_1x + a_2x^2 + .... a_{2n}x^{2n}$$ find $$a_0^2 - a_1^2 + a_2^2 + ... a_{2n}^2$$

The solution is as follows :

Step 1 : Let $$LHS = (1+x+x^2)^n * (1- 1/x + 1/x^2)^n$$

$$i.e : = (a_0 + a_1x + a_2x^2 + .... a_{2n}x^{2n})(a_0 - a_1/x + a_2/x^2 +...+a_{2n}/x^{2n})$$

This gives us the sum that has to be found on $$LHS$$ as the term independent of $$x$$.

Step 2 : Let $$RHS = (1+x+x^2)^n * (1- 1/x + 1/x^2)^n$$ = $$[(1+x+x^2)(1- 1/x + 1/x^2)]^n$$ = $$(1/x^2 + 1 + x^2)^n$$

This is where I don't understand how $$1/x^{2n}$$ can be factored out :

Step 3 : $$RHS = 1/x^{2n}(1 + x^2 + x^4)^n$$ = $$1/x^{2n}(a_0 + a_1x^2 + a_2x^4 + ... + a_{2n}^{4n})$$

This indicates that the term independent of $$x$$ on $$RHS$$ is $$a_n$$ which is thus equal to the term independent of $$x$$ on $$LHS$$, thus giving the solution.

$$\left(\frac1{x^2}+1+x^2\right)^n=\left(\frac1{x^2}(1+x^2+x^4)\right)^n =\left(\frac1{x^2}\right)^n(1+x^2+x^4)^n=\frac1{x^{2n}}(1+x^2+x^4)^n.$$