Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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|improve this question

marked as duplicate by Martin Sleziak, Arthur Fischer Jul 16 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.

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

2 Answers 2

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|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|improve this answer

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