# continuous function from $\mathbb{Q}$ to $\mathbb{R}$

Is there exist continuous function from $\mathbb{Q}$ to $\mathbb{R}$?

if such continuous function exist and contain more than one point then by intermediate value theorem contains uncountable points which is not possible f($\mathbb{Q}$) is atmost countable.

hence must be constant function

Let f($\mathbb{Q}$)=$\{a\}$ but singleton is closed in $\mathbb{R}$ and under continuous function inverse image of closed set is closed.Here inverse image of {a} is $\mathbb{Q}$. But $\mathbb{Q}$ is not closed hence there doesnot exist any continuous function from $\mathbb{Q}$ to $\mathbb{R}$.

please correct me if i am wrong

• Why do you think that singletons are not closed in $\Bbb Q$? – Asaf Karagila May 11 '17 at 5:06
• You cannot appy the intermediate value theorem, since it requires the source of the map to be complete. Anyway, you need to say which topology you want to use on $\mathbb{Q}$, If you are using the subspace topology then have a look at the map $q\mapsto q$ (the identity). – Thomas May 11 '17 at 5:07
• Any continuous function from $\mathbb{R}$ to $\mathbb{R}$ is continuous also in $\mathbb{Q}$. – Robert Z May 11 '17 at 5:08
• I am not getting why we cannot apply intermediate value theorem – dipali mali May 12 '17 at 10:40
• let $x_n$ be the sequence of rationals which converge to some irrational number y then by sequential continuity f($x_n$) converges to f(y).we are defining map from $\mathbb{Q}$. so what will be f(y)? – dipali mali May 12 '17 at 11:24

## 2 Answers

Since $\Bbb Q$ is a subspace of $\Bbb R$, any continuous function $\Bbb R\to\Bbb R$, such as the identity $f(x)=x$, will be continuous when restricted to $\Bbb Q$.

Singletons are continuous as inverse of open sets in the image, under the subspace topology is open in the domain of $f$.

• irrelevant but interesting – user379195 May 11 '17 at 5:20