<s>[INST] Need help to understand how to deduce the value of $\cos^2\displaystyle\big(\frac{\pi}{5}\big)+\cos^2\big(\frac{2\pi}{5}\big)$ I have some trouble understanding the steps provided in the book on solving the last part of the question.
For context purposes (and to provide the full picture), the whole question (with solution) is as follows:

Prove de Moivre's theorem for positive integer exponents.
  (I have no problem with this)



Using de Moivre's theorem, show that $\sin5\theta=a \sin^5\theta+b \cos^2\theta\sin^3\theta+c\cos^4\theta\sin\theta$ , where $a,b$ and $c$ are integers to be determined. (No issue with this either)



Express $\displaystyle\frac{\sin5\theta}{\sin\theta}$ in terms of $\cos\theta$, where $\theta$ is not a multiple of $\pi$. (Still no problem)



Hence, find the roots of the equation $16x^4-12x^2+1=0$ in trigonometric form. (I understand this part)



Deduce the value of $\displaystyle\cos^2\Big(\frac{\pi}{5}\Big)+\cos^2\Big(\frac{2\pi}{5}\Big)$. (I don't understand the working given by the book)


My question is, since it is found that $\displaystyle\cos^2\theta=\frac{3\pm\sqrt5}{8}$, how to tell that $\displaystyle\cos^2\frac{\pi}{5}=\frac{3+\sqrt5}{8}$ and how is it known that $\displaystyle\cos^2\frac{2\pi}{5}=\frac{3-\sqrt5}{8}$?
 [/INST] Since what you asked seems to be answered in comments, here is an alternative way in case you are interested, it uses Euler's formula $$e^{it}=\cos t +i \sin t.\tag{*}$$
First notice that (*) implies $\cos t = \frac{1}{2}(e^{it}+e^{-it})$. Now put $z=e^{i\frac{\pi}{5}}$, and notice that $z^5=e^{i\pi}=-1$. Subsequently, we get $z^{-2}=z^{3}/z^5=-z^3$, and similarly $z^{-4}=z/z^5=-z$.  
Then finally we have
\begin{align}
\cos^2 \frac{\pi}{5}+\cos^2 \frac{2\pi}{5}&= \left(\frac{1}{2}(e^{i\frac{\pi}{5}}+e^{-i\frac{\pi}{5}})\right)^2+\left(\frac{1}{2}(e^{i\frac{2\pi}{5}}+e^{-i\frac{2\pi}{5}})\right)^2\\
&=\frac{1}{4}((z+z^{-1})^2+(z^2+z^{-2})^2)\\
&=\frac{1}{4}(z^2+2+z^{-2}+z^4+2+z^{-4})\\
&=\frac{1}{4}(z^2+2-z^3+z^4+2-z)\\
&=\frac{1}{4}(3+1-z+z^2-z^3+z^4)\\
&=\frac{1}{4}\left(3+\frac{z^5+1}{z+1}\right)\\
&=\frac{3}{4}
\end{align}
where we have used $(z+1)(1-z+z^2-z^3+z^4)=z^5+1=0$.
</s>