# What is $\{y\in\mathbb Q\mid y=\cos(x),\quad x\in[0,2\pi]\cap\mathbb Q\}?$

Given a range of the rational numbers, $x$, between $0$ and $2\pi$\, what is the set of rational numbers $y = \cos(x)$?

I was inspired by the stackoverflow question Can $\cos(a)$ ever equal $0$ in floating point? (The irrational number $\frac{\pi}{2}$ does not translate well into a computer representation.)

I looked for rational cosines, and came up with the likes of $$0, \frac{\pi}{3},\frac{\pi}{2}, \pi, \frac{3\pi}{2}$$ Following this rabbit hole, I wondered if there were any rational (Floating Point) numbers (besides $0$) that yielded rational cosines.

One respondent opened a different question, on english.stackexchange.com, What is the upper bound on “several”? which involves the size of the set in question.

-

8
The title doesn't seem to ask the same question as the body. – Qiaochu Yuan Aug 3 '11 at 20:31
All floating point numbers are rational, so the floating point cosine of a floating point number might answer your question, if that is what you are asking. But I think you are actually asking if there are rational non-zero exact solutions for $\cos(x) \in \mathbb{Q} \text{ where } x \in \mathbb{Q}$ and if so what they are. I don't see why it has to be restricted to $(0,2\pi]$ unless you are looking for solutions where $\cos(\pi x) \in \mathbb{Q} \text{ where } x \in \mathbb{Q}$. – Henry Aug 3 '11 at 20:49

1
@rajah9: I still don't think you are asking the question you meant to ask. Don't you want $y = \cos (\pi x)$? – Qiaochu Yuan Aug 3 '11 at 21:10
@Henry, I agree, it does not have to be restricted to $(0, 2\pi]$ but I was looking for solutions on the unit circle. Yes, I am looking for rational, non-zero exact solutions. – rajah9 Aug 4 '11 at 14:09
@Americo Tavares, than you for editing the question. – rajah9 Aug 4 '11 at 14:09
show 1 more comment

## 3 Answers

The only cases where $x/\pi$ and $\cos(x)$ are both rational are the obvious ones, where $2\cos(x)$ is an integer. The slick way to show this uses the following facts:

1) when $r$ is rational, $e^{\pm i r \pi}$ are algebraic integers

2) the sum of algebraic integers is an algebraic integer

3) the only algebraic integers that are rational numbers are (ordinary) integers.

-

1
I think the question is asking for $x$, not $x/\pi$, to be rational. – Rahul Narain Aug 3 '11 at 20:50

2
It's not clear, since rajah9 mentioned $0, \pi/3, \pi/2, \pi,3 \pi/2$. If $x$ is algebraic and nonzero, $\cos(x)$ is transcendental by Lindemann's theorem. – Robert Israel Aug 3 '11 at 21:03
Thanks, the reference to Lindemann's theorem and your proof were what I was looking for. – rajah9 Aug 4 '11 at 14:03

Robert Israel has already answered your specific question. For some deeper issues related to your question, see the following web pages:

http://www.uni-math.gwdg.de/jahnel/Preprints/cos.pdf

http://www.mathpages.com/home/kmath460/kmath460.htm

Given the rationals are dense and $\cos$ is continuous, you can say that $\{y=\cos{x}\mid x\in \mathbb{Q} \cap [0,2\pi]\}$ is dense in $[-1,1]$ and countable.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 27, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9457268714904785, "perplexity_flag": "head"}