<s>[INST] How to factorize $X^5-1$ into irreductible factors? I have to factorize the polynomial $P(X)=X^5-1$ into irreducible factors in $\mathbb{C}$ and in $\mathbb{R}$, this factorisation happens with the $5$th roots of the unity. 
In $\mathbb{C}[X]$ we have $P(X)=\prod_{k=0}^4 (X-e^\tfrac{2ki\pi}{5})$.
In $\mathbb{R}[X]$ the solution states that by gathering all complex conjugate roots we find that $P(X)=(X-1)(X^2-2\cos(\frac{2\pi}{5})+1)(X^2-2\cos(\frac{4\pi}{5})+1)$, but I can't figure out how. Another problem I ran into was trying to figure out where the $2\cos(\frac{2\pi}{5})$ and $2\cos(\frac{4\pi}{5})$ come from so I tried these two methods:
The sum of the roots of unity is zero so we have: 
$1+e^\tfrac{2i\pi}{5}+e^\tfrac{4i\pi}{5}+e^\tfrac{6i\pi}{5}+e^\tfrac{8i\pi}{5}=0$
In the $5$th roots of unity circle P3 and P4 are images according to the x-axis the same goes to P2 and P5, therefore $e^\tfrac{6i\pi}{5}=e^\tfrac{-4i\pi}{5}$ and $e^\tfrac{8i\pi}{5}=e^\tfrac{-2i\pi}{5}$ afterwards by using Euler's formula we find $1+2\cos(\frac{2\pi}{5})+2\cos(\frac{4\pi}{5})=0$.
Another method is that $\cos(6\pi/5) = \cos(-6\pi/5) = \cos(-6\pi/5 + 2\pi) = \cos(4\pi/5)$ $\cos(8\pi/5) = \cos(-8\pi/5) = \cos(-8\pi/5 + 2\pi) = \cos(2\pi/5)$ 
therefore $1 + \cos(2\pi/5) + \cos(4\pi/5) + \cos(4\pi/5) + \cos(2\pi/5) = 0$ and we find $1+2\cos(\frac{2\pi}{5})+2\cos(\frac{4\pi}{5})=0$
I don't know if both of these methods are correct on their own and I don't know if they will help in the factorisation since I don't know how to go from there and find $P(X)=(X-1)(X^2-2\cos(\frac{2\pi}{5})+1)(X^2-2\cos(\frac{4\pi}{5})+1)$
 [/INST] In $\mathbb C[x]$ we can write it as $$p(x)=(x-1)(x-\color{blue}{e^{2\pi i/5}})(x-\color{blue}{e^{-2\pi i/5}})(x-\color{red}{e^{4\pi i/5}})(x-\color{red}{e^{-4\pi i/5}})$$ where the blue and red are conjugate root pairs. Multiplying these conjugate root pairs together gives (i.e. multiply the second and third terms together, and then the fourth and fifth together)
$$\begin{align}p(x)&=(x-1)(x^2-(e^{2\pi i/5}+e^{-2\pi i/5})x+e^{2\pi i/5}e^{-2\pi i/5})(x^2-(e^{4\pi i/5}+e^{-4\pi i/5})x+e^{4\pi i/5}e^{-4\pi i/5}) \\&=(x-1)\left(x^2-2\cos\left(\frac{2\pi}{5}\right)x+1\right)\left(x^2-2\cos\left(\frac{4\pi}{5}\right)x+1\right) \end{align}$$
using Euler's formula for $e^{2k\pi i/5}+e^{-2k\pi i/5}=2\cos\left(\frac{2k\pi}{5}\right)$.
</s>