Let $n\in\mathbb{N}$ with $n\geq 3$.
Claim. $\cos\frac{2\pi}{n}$ is an algebraic number over $\mathbb{Q}$ with degree $\frac{\varphi(n)}{2}$.
Proof. It is simple to construct from $\Phi_n(x)$ a polynomial with integer coefficients and degree $\frac{\varphi(n)}{2}$ which vanishes at $x=\cos\frac{2\pi}{n}$. For instance, in the case $n=18$ we have that the palindromic polynomial $\Phi_{18}(x) = x^6-x^3+1$ vanishes at $x=\exp\left(\frac{2\pi i}{18}\right)$. Since
$$ \frac{\Phi_{18}(x)}{x^3} = \left(x^3+\frac{1}{x^3}\right)-1 = \left(x+\frac{1}{x}\right)^3-3\left(x+\frac{1}{x}\right)-1$$
we have that $p(x)=8x^3-6x-1$ vanishes at $x=\cos\frac{2\pi}{18}$. The general theory grants that $\Phi_n(x)$ is an irreducible polynomial, hence $\exp\left(\frac{2\pi i}{n}\right)$ is an algebraic number over $\mathbb{Q}$ with degree $\varphi(n)$. De Moivre's formula $e^{i\theta}=\cos\theta+i\sqrt{1-\cos^2\theta}$ then grants that the polynomial found by the above procedure is the minimal polynomial of $\cos\frac{2\pi}{n}$.
Corollary #1. Since $20^\circ=\frac{2\pi}{18}$ and $\frac{\varphi(18)}{2}>1$, $\cos 20^\circ\not\in\mathbb{Q}$.
Corollary #2. We cannot construct a regular $9$-agon with straightedge and compass alone.