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.


Solution 1:

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}$.

Solution 2:

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$".

Solution 3:

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.)