<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+x^2)(1-x+x^2)=(x^2+1)^2-x^2=1+x^2+x^4$. So: multiply both sides by $1+x+x^2$:
$$\begin{array}{rcl}(1+x+x^2)\cdot(\text{LHS})&\equiv&(1+x+x^2)(1-x+x^2)(1-x^2+x^4)(1-x^4+x^8)\cdots\\&=&(1+x^2+x^4)(1-x^2+x^4)(1-x^4+x^8)\cdots\\&=&(1+x^4+x^8)(1-x^4+x^8)\cdots\\&&\vdots\end{array}$$
The second row shows that the formal product on the left has no (nonzero) odd terms. The third row shows that it doesn't even have the terms $x^2, x^6$ etc. i.e. all the (nonzero) terms are of the form $x^{4k}$, then in the next step all the (nonzero) terms will actually be of the form $x^{8k}$ etc. - so by using induction (or otherwise) you can easily see that the formal product does not have any nonzero terms (except for the constant, which is obviously $1$). Thus, this formal product is $1$.
</s>