For example, $\sqrt 2 = 2 \cos (\pi/4)$, $\sqrt 3 = 2 \cos(\pi/6)$, and $\sqrt 5 = 4 \cos(\pi/5) + 1$. Is it true that any integer's square root can be expressed as a (rational) linear combinations of the cosines of rational multiples of $\pi$?


Products of linear combinations of cosines of rational multiples of $\pi$ are themselves such linear combinations, so it only needs to be true of primes. But I do not know, for example, a representation of $\sqrt 7$ in this form.



Is every square root of an integer a linear combination of cosines of $\pi$-rational angles?
Someone should actually record the formula. If $p$ is a prime $\equiv 1 \bmod 4$, then 
$$\sqrt{p} = \sum\_{k=1}^{p-1} \left( \frac{k}{p} \right) \cos \frac{2 k \pi}{p}$$
where $\left( \tfrac{k}{p} \right)$ is the quadratic residue symbol. Note that $\left( \tfrac{k}{p} \right) = \left( \tfrac{p-k}{p} \right)$, so every term appears twice. 


Similarly, if $p \equiv 3 \bmod 4$, then 
$$\sqrt{p} = \sum\_{k=1}^{p-1} \left( \frac{k}{p} \right) \sin \frac{2 k \pi}{p}.$$
Again, $k$ and $p-k$ make the same contribution. 


These are usually both written together as
$$\sqrt{(-1)^{(p-1)/2} p} = \sum\_{k=1}^{p-1} \left( \frac{k}{p} \right) \exp \frac{2 k \pi i}{p}.$$
This is a formula of [Gauss](https://en.wikipedia.org/wiki/Quadratic_Gauss_sum).


