<s>[INST] Value of $\cos\frac{2k\pi}{n}$ We know that $\cos\frac{2\pi}{5} = \frac{-1 + \sqrt{5}}{4}$ and $\cos\frac{4\pi}{5} = \frac{-1 - \sqrt{5}}{4}$. In general is there any formula for 
$$\cos\frac{2k\pi}{n}$$
where $k\leq n/2$.
 [/INST] Claim: for any $n\geq 3$, $\cos\frac{2\pi}{n}$ is an algebraic number over $\mathbb{Q}$ with degree $\frac{1}{2}\varphi(n)$, hence it can be found by solving $p(x)=0$ where $p(x)\in\mathbb{Z}[x]$ is such that $\deg p = \frac{1}{2}\varphi(n)$.
Proof: we first invoke a well-known lemma, i.e. that the cyclotomic polynomial $\Phi_n(x)$ is irreducible over $\mathbb{Q}$. The complex roots of $\Phi_n(x)$ are the primitive $n$-th roots of unity, i.e. the numbers of the form $\exp\left(\frac{2\pi i k}{n}\right)$ with $\gcd(k,n)=1$. In particular $\deg \Phi_n=\varphi(n)$. $\Phi_n$ is a palindromic polynomial, since if $\Phi_n(z)=0$ then $\Phi_n(z^{-1})=0$ too. Thus there is a polynomial $q(x)\in\mathbb{Q}[x]$ such that
$$ \frac{\Phi_n(z)}{z^{\varphi(n)/2}} = q\left(z+\frac{1}{z}\right),\quad \deg q=\frac{\varphi(n)}{2} $$
and a polynomial $p(x)\in\mathbb{Q}[x]$ with $\deg p=\frac{\varphi(n)}{2}$ such that
$$ p\left(\cos\frac{2\pi k}{n}\right)=0,\quad \forall k:\gcd(k,n)=1.$$
This polynomial $p(x)$ is necessarily irreducible over $\mathbb{Q}$, since we have $\left[\mathbb{Q}(e^{2\pi i/n}):\mathbb{Q}(\cos(2\pi/n))\right]=2$. If $p(x)$ were reducible, we would have $[\mathbb{Q}(e^{2\pi i/n}):\mathbb{Q}]<\varphi(n)$, contradicting the irreducibility of $\Phi_n(x)$.
Corollary 1: The regular eptagon and nonagon cannot be constructed with straightedge and compass. Indeed both $\varphi(7)$ and $\varphi(9)$ equal $6$, so both $\cos\frac{2\pi}{7}$ and $\cos\frac{2\pi}{9}$ are algebraic numbers over $\mathbb{Q}$ with degree $3$ and the construction of the associated polygons implies the extraction of a cube root, which is impossible with straightedge and compass. The involved minimal polynomials are
$$ 8x^3+4x^2+4x-1,\quad 8x^3-6x+1. $$
Corollary 2: the regular $5$-agon, $6$-agon, $8$-agon, $10$-agon, $12$-agon, $15$-agon, $16$-agon and $17$-agon are constructible with straightedge and compass. Indeed
$$ \cos\frac{2\pi}{5}=\frac{\sqrt{5}-1}{4},\quad \cos\frac{2\pi}{6}=\frac{1}{2},\quad \cos\frac{2\pi}{8}=\frac{\sqrt{2}}{2},\quad \cos\frac{2\pi}{10}=\frac{\sqrt{5}+1}{4},$$
$$\cos\frac{2\pi}{12}=\frac{\sqrt{3}}{2},\quad \cos\frac{2\pi}{15}=\frac{1}{8} \left(1+\sqrt{5}+\sqrt{6 \left(5-\sqrt{5}\right)}\right),\quad \cos\frac{2\pi}{16}=\frac{1}{2}\sqrt{2+\sqrt{2}}$$
$$\cos\frac{2\pi}{17}=\frac{1}{16}\left[-1+\sqrt{17}+\sqrt{34-2\sqrt{17}}+2\sqrt{17+3\sqrt{17}-\sqrt{170+38\sqrt{17}}}\right].$$
Corollary 3: the regular $N$-agon is constructible with straightedge and compass iff $N$ is a number of the form $2^\alpha M$, with $M$ being a product of distinct Fermat primes.
</s>