# Thread: constant function question

1. ## constant function question

Hi I am having trouble with a proof, was wondering if someone could give me some insight...
Here is the problem:
Suppose f:[a,b] --> Q is continuous on [a,b]. Prove that f is constant on [a,b].

I did a proof by contradiction, but realized that nowhere in my proof was there anything about Q, which Im sure is the crux of the issue.
Any insight into how to prove this using contradiction?
My contradiction was to assume that for some x,y existing in [a,b], f(x) does not equal f(y)....

2. Originally Posted by dannyboycurtis
Hi I am having trouble with a proof, was wondering if someone could give me some insight...
Here is the problem:
Suppose f:[a,b] --> Q is continuous on [a,b]. Prove that f is constant on [a,b].

I did a proof by contradiction, but realized that nowhere in my proof was there anything about Q, which Im sure is the crux of the issue.
Any insight into how to prove this using contradiction?
My contradiction was to assume that for some x,y existing in [a,b], f(x) does not equal f(y)....
Do you know the intermadiate value theorem? I assume that your Q stands for the set of rational numbers $\displaystyle \mathbb{Q}$, i.e. f can only assume rational values. If so, consider this: if $\displaystyle f(x_1)\neq f(x_2)$ for some $\displaystyle x_{1,2}\in [a,b]$, then, by the intermediate value theorem, for any non-rational (irrational) $\displaystyle y$ between $\displaystyle f(x_1)$ and $\displaystyle f(x_2)$ there must exist an $\displaystyle x_3$ between $\displaystyle x_1$ and $\displaystyle x_2$ such that $\displaystyle f(x_3)=y$. But since $\displaystyle y\notin \mathbb{Q}$, and the codomain of f is $\displaystyle \mathbb{Q}$ we have a contradiction. (The point, of course, is that between any two rational numbers there lies a non-rational (irrational) number.)

3. so simple, I cant believe I overlooked it. Thanks a lot!

4. Hello there,

I just want to make sure that the above proof by contradiction is based on the assumption that $\displaystyle f(x)$ is NOT a constant function $\displaystyle \Rightarrow f(x) \neq f(y)$.

Then the density of irrational numbers in the set of rational numbers would provide the contradiction as needed.

Thank you!