<s>[INST] Showing the formal identity $(1-x+x^2)(1-x^2+x^4)(1-x^4+x^8)\cdots =\frac{1}{1+x+x^2}$ 
How to show this formal identity (or you can assume $|x|<1$)?
$$(1-x+x^2)(1-x^2+x^4)(1-x^4+x^8)\cdots =\frac{1}{1+x+x^2}$$

I can show that the latter is $$=1-x+x^3-x^4+x^6-x^7+\cdots$$ but how to show this is equal to the infinite product. I think it has something to do with residue of the exponent modulo $3$.
 [/INST] Notice that $$(1+x^n+x^{2n})(1-x^n+x^{2n}) = 1+x^{2n}+x^{4n}$$

Now if  $p_n$ is product of first $n$ brackets on LHS then $$p_n ={1+x^{2^n}+x^{2^{n+1}}\over 1+x+x^2}$$
Taking $\displaystyle \lim _{n\to \infty}p_n$ for $|x|<1$ we get the desired.
</s>