Prove if $f(x)$ is a continuous function from reals to irrationals then it is constant Prove if $f(x)$ is a continuous function from reals to irrationals then it is constant.
In the first look it doesn't seem to be true because we can have two irrationals that are so close to each other and we can have that.But I don't know how to disprove that.
 A: Hint: $f(\text{connected set}) = \text{connected set}$
A: Suppose that $f$ is not constant. Then there are numbers $a$ and $b$ such that $a<b$ and that $f(a)\neq f(b)$. Let $q$ be a rational number between $f(a)$ and $f(b)$. Then, by the intermediate value theorem, there is a $c\in(a,b)$ such that $f(c)=q$. But this is impossible, since $f(\mathbb{R})\subset\mathbb{R}\setminus\mathbb{Q}$.
A: The intermediate value theorem states that if $f$ is continuous, then for any $a,b\in\mathbb R$, if $y\in \mathbb R$ is between $f(a)$ and $f(b)$ (inclusive), there exists $x$ in the interval $[a,b]$ such that $f(x)=y$.
However, if $f:\mathbb R\to C(\mathbb Q)$, and there exist two distinct values of $f(a)$ and $f(b)$ (such that $f(a)\ne f(b)$) then there exist some rational number between $f(a)$ and $f(b)$. However, if you choose $y$ to be a rational number between $f(a)$ and $f(b)$, there does not exist $x\in R$ such that $f(x)=y$. Thus, for each $a,b\in \mathbb R$, $f(a)=f(b)$ and $f$ is constant.
A: *

*Suppose to the contrary that a continuous function $f: \mathbb R
   \rightarrow \mathbb R \setminus \mathbb Q$ is not constant. Then
there exist $x,y \in \mathbb R$, $x \not = y$, such that $f(x) <
   f(y)$. 

*By the density of rationals in the reals, since $f(x)$ and
$f(y)$ are real numbers, there exists a $q \in \mathbb Q$ such that $f(x) < q < f(y)$.

*Since $f$ is continuous by assumption, by the Intermediate Value Theorem (IVT, as previous commentors have referred to), there exists a $z \in \mathbb R$ such that $f(z) = q$. But this is a contradiction since $q \in \mathbb Q$ and cannot be in the range of $f$.

*Therefore, $f$ is constant. $\square$

