Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

If $f:[a,b]\to\mathbb{R}$ is a continuous function and $f(x)\in\mathbb{Q}$ for all $x\in[a,b]$ then what can say about $f$?

My try: I think f should be constant, if it is not constant then it contradicts the continuity. Can anyone prove that f is constant?

share|cite|improve this question

marked as duplicate by Martin Sleziak, arjafi Jul 16 '14 at 8:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Intermediate value theorem. – Adam Hughes Jul 16 '14 at 6:09
@AdamHughes That should be an answer! – Mike Miller Jul 16 '14 at 6:11
As you wish, one moment. – Adam Hughes Jul 16 '14 at 6:11
up vote 6 down vote accepted

We proceed by contradiction: Assume that

$$\begin{cases}a\le x,y\le b \\f(x)\ne f(y)\end{cases}$$

WLOG assume $f(x)<f(y)$ (if not: switch their labels). Then by the intermediate value theorem, $f$ takes all values in the interval $[f(x),f(y)]$. Since there are infinitely many irrationals between any two real numbers, $f$ takes on an irrational value: a contradiction. So $f$ is constant.

share|cite|improve this answer

Suppose if f is not constant then there are x and y in [a,b] such that $f(x)\not=f(y)$ then it also takes any value between f(x) and f(y) at some point in [x,y].Which is contradiction to $f(x)\in\mathbb{Q}$ for all $x\in[a,b]$

share|cite|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.