Show that a set is dense in $[-1,1]$

We have that $|\cos x-\cos y|\le |x-y|$ for all $x,y$, by the mean value theorem. This can also be established without calculus; see here for the analogous proof for $|\sin x-\sin y|\le |x-y|$.

We know that $\cos(x)$ takes all values between $-1$ and $1$ as $x$ varies between $0$ and $2\pi$, so given $t\in[-1,1]$ begin by finding $x$ in $[0,2\pi)$ with $\cos x=t$. Fix $\epsilon>0$. We want to show that there is an $n$ such that $|t-\cos n|<\epsilon$. Note that $\cos (x+2\pi m)=t$ as well for any $m\in\mathbb Z$. If, for some $n$, $|(x+2\pi m)-n|<\epsilon$, we are done, since $$ |t-\cos n|=|\cos(x+2\pi m)-\cos n|\le|(x+2\pi m)-n|<\epsilon. $$ (The sign of $n$ is irrelevant here, since $\cos(n)=\cos(-n)$.)

Suppose then that this is not the case. Fix $k$ with $1/k<\epsilon$, so we are assuming that $(x+2\pi m)-n|\ge 1/k$ for any $m,n$. Consider the sequence $x_m=\{2\pi m\}$, where $\{r\}$ denotes the fractional part of $r$. There must be $m<l$ such that $|x_m-x_l|<1/k$. This is simply because if we look at more than $N$ numbers between $0$ and $1$, two of them must be within $1/N$ of each other. Since $\pi$ is irrational, we also have $0<|x_m-x_l|$. Finally, note that $|x_m-x_l|=|2\pi(m-l)+c|$ for some integer $c$.

Write $s$ for $|x_m-x_l|$. Now look at the numbers $x,x+s,x+2s,x+3s,\dots$. Since all of them have the form $x+2\pi a+b$ for some $a,b\in\mathbb Z$, we must have that they are all at distance at least $1/k$ from any integer. Given $n\in\mathbb N$, let $M\in\mathbb Z$ be such that $M+1/k\le x+ns\le M+1-1/k$. Note that $M+1/k< x+(n+1)s< M+1$, since $0<s<1/k$. But then $x+(n+1)s\le M+1-1/k$ as well. This is of course absurd, because by induction it means that if $M+1/k\le x\le M+1-1/k$, then the same inequalities hold replacing $x$ with $x+ns$ for any $n\in\mathbb N$.

The above appears to avoid the density fact you are given (Dirichlet's approximation theorem), though the argument in the third paragraph is just its proof. If one wants to use the density fact explicitly, note that $2\pi$ is irrational, so there are arbitrarily large $q$ for which there is a $p$ with $$ \left|2\pi-\frac pq\right|<\frac1{q^2}. $$ Pick such a $q$ large enough so that $1/q<\epsilon$, let $s=|2\pi q-p|$, and proceed with the fourth paragraph.


Hint: $\pi$ is irrational, and the cosine function has period $2\pi$. Try to approximate any $\theta\in[0,2\pi]$ with numbers of the form $n-2m\pi$, for integers $m$, $n$.


Suppose this is not true. Then there is an open interval $V$ in $[-1,1]$ such that $\cos\mathbb{N}\cap V=\emptyset$. Since $\cos:[0,\pi]\rightarrow[-1,1]$ is continuous and surjective, the preimage $U=\cos^{-1}V$ is a non-empty open set in $[0,\pi]$ such that for every $n,m\in\mathbb{Z}$: $n-2\pi m\not\in U$. Since $U$ is open and non-empty, it contains an $\epsilon$-width subinterval $\Delta$ for some $\epsilon>0$. If we show that some point $n-2\pi m$ falls into $\Delta$, this will lead to contradiction.

Using the fact stated in the problem, for any $N$ there are $p,q\in\mathbb{Z}$ such that $q>N$ and $0<|2\pi-\frac{p}{q}|<\frac{1}{q^2}$ or $0<\delta=|2\pi q-p|<\frac{1}{q}$. Let's choose $N$ large enough, so that $\delta<\frac{1}{q}<\frac{1}{N}<\epsilon$. Then, for some $k\in\mathbb{N}$: $|2\pi\cdot kq-kp|=k\delta$ falls into the $\epsilon$-width subinterval $\Delta$. We may choose the signs of $q$ and $p$ so that $0<2\pi\cdot kq-kp=k\delta\in\Delta\subseteq U$. This contradiction concludes the proof.