de Moivre says [imath] (\cos(x) +i \sin(x))^n =\cos(nx) + i \sin(nx) [/imath] and we are interested in [imath] \cos(5x). [/imath] Hence,
[math]\begin{array}{lll}
\cos(5x)&=(\cos(x) +i \sin(x))^5-i \sin(5x)\\
&=\cos^5(x) -10\cos^3(x)\sin^2(x)+5\cos(x)\sin^4(x) + i f(\cos(x),\sin(x))\\
&=\cos^5(x)-10\cos^3(x)(1-\cos^2(x))+5\cos(x)(1-\cos^2(x))^2 + i f(\cos(x),\sin(x))\\
&=\ldots
\end{array}[/math]with some function [imath] f(\cos(x),\sin(x)) [/imath] which we are not interested in since it has to be zero anyway.