# Does every continuous map from $\mathbb{Q}$ to $\mathbb{Q}$ extends continuously as a map from $\mathbb{R}$ to $\mathbb{R}$?

Given a continuous function $f:\mathbb{Q}\to\mathbb{Q}$ ,does there exist a continuous function $g:\mathbb{R}\to\mathbb{R}$ such that $g|_{\Bbb Q} = f$?

What I have no Idea about how to attempt this Question! Any suggestion will be very helpful.

• Try $f(x)=1/(x^2-2)$ Jul 27, 2017 at 13:26

Not in general. Consider the function $f_{0}:\mathbb{Q}\rightarrow\mathbb{Q}$ defined by $$f_{0}(x)=\begin{cases}0 \hspace{4mm} \mbox{if } x^{2}<2 \\ 1 \hspace{4mm} \mbox{if } x^{2}>2\end{cases}.$$ It is easy to see that $f_{0}$ is continuous on $\mathbb{Q}$ (since $\sqrt{2}\notin\mathbb{Q}$), but if $g_{0}:\mathbb{R}\rightarrow\mathbb{R}$ is an extension of $f_{0}$ to $\mathbb{R}$, then $g_{0}$ is necessarily discontinuous at $\sqrt{2}$.

It is worth noting that if $f:\mathbb{Q}\rightarrow\mathbb{Q}$ can be extended to a continuous function $g:\mathbb{R}\rightarrow\mathbb{R}$, then such an extension is unique. That is, if $g:\mathbb{R}\rightarrow\mathbb{R}$ and $h:\mathbb{R}\rightarrow\mathbb{R}$ are continuous functions such that $g(x)=h(x)$ for all $x\in\mathbb{Q}$, then $g=h$. This is because $\mathbb{Q}$ is a dense subset of $\mathbb{R}$.

Yes, it's possible, iff $f$ is sequentially continuous, in the sense that if $a_n$ and $b_n$ are two sequences of rational numbers that converge to the same real number, then $f(a_n)$ and $f(b_n)$ are two converging sequences that converge to the same real number.

If you want a characterisation that doesn't mention $\Bbb R$ at all, you probably have to use the notion of Cauchy: "$a_n$ and $b_n$ are Cauchy sequences such that $a_n-b_n$ converges to $0$".

• May i know the reason , Or can you give any references?
– user229886
Jul 27, 2017 at 13:35
• @MasterX Because this tells you exactly what $f(r)$ has to be for irrational $r$ if we want the function to be continuous. Jul 27, 2017 at 13:38

Let E be a dense a subset of a metric space X and let f be a uniformly continuous real function defined on E. Then f has a continuous Extension from E to X. (From rudin.)

• Function must be uniformly continuous right?? Here we assume just continuity
– user229886
Jul 27, 2017 at 13:31
• But that doesn't cover all cases, like $f(x)=x^2$. Jul 27, 2017 at 13:31
• It's a statement that needs uniform continuity . For continuity we can't be sure. Further extension will be unique and uniformly continuous . (By kumresan) Jul 27, 2017 at 13:38
• Specifically, this is from Rudin, Principles of mathematical analysis, 3rd ed. (1976), ch. 4, exercise 13.
– Mike
Mar 8, 2021 at 6:29