# If $f:X \rightarrow \mathbb{Q}$ is continuous, then $f$ must be constant

Let $X$ be a connected topological space. Prove if $f:X\to\mathbb Q$ is continuous, then $f$ must be constant.

I know the definition of continuous is: for all $x\in X$ and all neighbourhoods $N$ of $f(x)$ there is a neighborhood $M$ of $x$ such that $f(M)\subseteq N$. This relates easily to the usual definition in analysis. Equivalently, $f$ is continuous if the inverse image of every open set is open. But I don't know how to relate this to the proof I need to come up with.

• Do you mean $\mathbb{Q}$ with the subspace topology from $\mathbb{R}$? – manthanomen Apr 7 '13 at 20:15
• yeah sorry I looked into the math thing and couldn't find out how to type it – moe Apr 7 '13 at 20:16
• the relative topology in Q inherited from R. – moe Apr 7 '13 at 20:17
• Assume that $f(X)$ contains two different $f(x)$ and $f(y)$. Can you find disjoint open sets $U,V$ covering $\mathbb Q$ such that each of these sets contains one of those points? – Stefan Hamcke Apr 7 '13 at 20:20

The image of $f$ has to be connected. The only connected subsets of $\Bbb Q$ are points, as it is totally disconnected. So the image of $f$ is a point so it is constant.
Hint: The continuous image of a connected space is connected (assume otherwise, find two disjoint open sets whose union is the entire image and use continuity to conclude a contradiction); every connected component in $\Bbb Q$ is a singleton.
• @moe: Why does the intermediate value theorem hold here? We prove it for functions into $\Bbb R$. But continuity into $\Bbb R$ is not necessarily equivalent to continuity into $\Bbb Q$. If you prove that you can extend $f$ to a continuous function into $\Bbb R$, then you might be able to use the intermediate value theorem. – Asaf Karagila Apr 7 '13 at 20:36
Assume $f$ is not constant so there are $a,b$ in $f(X)$ with $a\neq b$ and suppose $a <b$ , since $f$ is continuous and $X$ is connected then $f(X)$ is connected too. Because $f(X)\subset\mathbb{R}$ for any $c$ s.t. $a<c<b$ then $c\in f(X)$(the connected subsets of $\mathbb{R}$ are exaclty the spaces) so $f(X)$ is a subset of $\mathbb{Q}$ that contains a space, a contradiction.