Complete factorisation of $x^8-2x^4\cos (4\theta)+1$ with roots of unity 
Factorize completely $x^8-2x^4\cos (4\theta)+1$ using complex numbers and $n$-th root of unity.

The answer given is
$$\prod_{r=0}^3 \left(x^2-2x\cos\left(\theta+\frac{r\pi}{2}\right)+1\right)\,.$$
Can anyone please help . I just want to know how to tackle this . I just want the conceptual trick to solve such sum.
 A: With the 4th root of unity $e^{\pm i\frac{a+2\pi r}4} $ for $x^4 - e^{\pm ia}=0$, factorize as follows
\begin{align}
x^8-2x^4\cos  (4\theta)+1 
=&\> (x^4-e^{i 4\theta})(x^4-e^{-i 4\theta}) \\
= &\prod_{r=0}^{3}(x-e^{i\frac{4\theta+2\pi r}4})
 \prod_{r=0}^{3}(x-e^{-i\frac{4\theta+2\pi r}4})  \\
 = &\prod_{r=0}^{3}(x-e^{i(\theta+ \frac{\pi r}2)})
  (x-e^{-i(\theta+ \frac{i\pi r}2)}) \\
= &\prod_{r=0}^{3}(x²-2x\cos(\theta+\frac{\pi r}{2})+1)
\end{align}
A: $$
\begin{aligned}
x^8-2x^4\cos4\theta+1
&=x^8-x^4(e^{4i\theta}+e^{-4i\theta})+1 \\
&=(x^4-e^{4i\theta})(x^4-e^{-4i\theta}) \\
&=(x^2+e^{2i\theta})(x^2-e^{2i\theta})(x^2+e^{-2i\theta})(x-e^{-2i\theta}) \\
&=(x+ie^{i\theta})(x-ie^{i\theta})(x+e^{i\theta})(x-e^{i\theta}) \\
&\cdot(x+ie^{-i\theta})(x-ie^{-i\theta})(x+e^{-i\theta})(x-e^{-i\theta}) \\
&=\prod_{r=0}^3(x-i^re^{i\theta})(x-i^{-r}e^{-i\theta})\quad{(*)} \\
&=\prod_{r=0}^3[x^2-x(i^re^{i\theta}+i^{-r}e^{-i\theta})+1] \\
\end{aligned}
$$
in which the asterisk step follows from interchanging each linear factor.
Now, using the fact that for every integer $i^r=e^{\pi ir/2}$ for all integer $r$, we obtain
$$
\begin{aligned}
x^8-2x^4\cos4\theta+1
&=\prod_{r=0}^3\left[x^2-2x\left(e^{i\theta+i\pi r/2}+e^{-(i\theta+i\pi r/2)}\over2\right)+1\right] \\
&=\prod_{r=0}^3\left[x^2-2x\cos\left(\theta+{\pi r\over2}\right)+1\right]
\end{aligned}
$$
Hope this answers your question!
