# Suppose $M$ is connected and suppose $f : M \rightarrow \mathbb R$ is continuous and only has irrational values, then $f$ is a constant function.

I want to do a proof by contradiction. You guys let me know if I goofing up.

-

Suppose $f$ is non-constant. Since $f$ is continuous, it satisfies the Intermediate value theorem [in the most general sense, $f$ satisfies the theorem as long as $f$ is a mapping from any connected space $M$ to $\mathbb R$].
Pick any two irrational numbers $a<b$ in the image of $f$. Since $f$ satisfies the Intermediate value theorem, then $f$ attains all the intermediate values from $[a,b]$. We know that between any two irrationals, lies a rational--a contradiction. $f$ has a value that is not irrational.
This means the assumption of $f$ being non-constant is false. QED
Your reasoning is correct. Just a linguistic quibble - the word "consecutive" would mean that there are no irrational numbers between $a$ and $b$, whereas I suspect you just meant to say that $a<b$. – Brad Nov 5 '12 at 2:37
First, it makes no sense to talk about consecutive irrational numbers: between any two irrational numbers there is another irrational number, so they can’t be consecutive. Apart from that, the basic idea is sound, provided that $M$ is given to be a subset of $\Bbb R$; if not, you can’t use the intermediate value theorem. – Brian M. Scott Nov 5 '12 at 2:38
@BrianM.Scott The intermediate value theorem applies for any connected topological space $M$: the image of $M$ under a continuous map $M\to\mathbb{R}$ is connected, and every connected subspace of $\mathbb{R}$ is an interval. – Brad Nov 5 '12 at 2:41