# Extending a continuous function defined on the rationals

Is there an elementary way of proving that for any continuous function $f:\mathbb{Q}\to[0,1]$ there is such an $x\in\mathbb{R}\setminus\mathbb{Q}$ that $f$ can be extended to a continuous function $\mathbb{Q}\cup\{x\}\to[0,1]$, without resorting to the fact that $\mathbb{Q}$ is not a $G_\delta$-set in $\mathbb{R}$ and the

Theorem (4.3.20. in General Topology by Engelking): If $Y$ is a completely metrizable space, then every continuous mapping $f:A\to Y$ from a dense subset of a topological space $X$ to the space $Y$ is extendable to a continuous mapping $F:B\to Y$ defined on a $G_\delta$-set $B\subset X$ containing $A$.

which seem an overkill to me in this case?

-
If it is extendable to a continuous mapping that ¨fills the gaps¨, then you should be able to proof that it is still continuous when you extends it to $\mathbb{Q}$ with $\{x\}$. It's not overkill, it's just strategy :) –  Marra Apr 2 '12 at 20:24
Do you mean proving that there is at least one $x\in\Bbb R\setminus\Bbb Q$ such that $f$ has a continuous extension to $\Bbb Q\cup\{x\}$? Because it’s certainly not true that an arbitrary continuous $f:\Bbb Q\to[0,1]$ can be extended continuously to $\Bbb Q\cup\{x\}$ for an arbitrary $x\in\Bbb R\setminus\Bbb Q$. –  Brian M. Scott Apr 2 '12 at 20:39
@Brian: Yes, I meant the former claim. I tried to express it with as few words as possible but perhaps it was at the cost of clarity. Now I see that one may understand the claim in more than one way, e.g. "There is such an $x\in\mathbb{R}\setminus\mathbb{Q}$ that every continuous function $\mathbb{Q}\to[0,1]$ can be extended to a continuous function $\mathbb{Q}\cup\{x\}\to[0,1]$." which is also obviously false. So I better rephrase the question. –  LostInMath Apr 2 '12 at 21:43

Here's an explicit construction without using the Baire Category Theorem (on the other hand, one could say that this is the same sort of construction that is used in proving the Baire Category Theorem):

Let $\{r_n: n \in {\mathbb N}\}$ be an enumeration of the rationals. Construct sequences of rationals $x_n$ and positive numbers $\delta_n$ as follows, with $x_0 = 0$ and $\delta_0 = 1$, with the following properties:

1) $|x_n - x_m| < \delta_n$ for all $m > n$

2) $|r_n - x_m| > \delta_n$ for all $m \ge n$

3) $\delta_n \to 0$ as $n \to \infty$

4) $|f(y) - f(x_n)| < 1/n$ for all rationals $y$ with $|y - x_n| < \delta_n$

We can do this inductively: given $x_n$ and $\delta_n$, take $x_{n+1}$ be any rational other than $r_{n+1}$ in $(x_n - \delta_n, x_n + \delta_n)$. Then take $\delta_{n+1} > 0$ small enough that $x_n - \delta_n < x_{n+1} - \delta_{n+1} < x_{n+1} + \delta_{n+1} < x_n + \delta_n$, $|r_{n+1} - x_{n+1}| > 2 \delta_{n+1}$, $\delta_{n+1} < 1/(n+1)$, and $|f(y) - f(x_{n+1})| < 1/(n+1)$ for all rationals $y$ with $|y - x_{n+1}| < \delta_{n+1}$.

It is easy to check that properties (1) to (4) are satisfied. Then $x_\infty = \lim_{n} x_n$ exists, can't be any $r_n$ (so must be irrational), $|x_\infty - x_n| < \delta_n$ for all $n$, and $f$ extends continuously to $x_\infty$ with $f(x_\infty) = \lim_n f(x_n)$.

-
This is exactly the elementary sort of construction what I was looking for. Thanks a lot! –  LostInMath Apr 2 '12 at 23:02

For $n\in \mathbb{N}$ and $\delta > 0$, let $$A_{n, \delta} := \{x \in \mathbb{R} : \operatorname{diam} f(B(x, \delta) \cap \mathbb{Q}) < 1/n\}.$$ In other words, $x \in A_{n, \delta}$ if for every $y,z \in \mathbb{Q}$ with $|x-y|, |x-z| < \delta$, we have $|f(y) - f(z)| < 1/n$.
Let $A_n := \bigcup_{\delta > 0} A_{n, \delta}$, $A := \bigcap_{n \in \mathbb{N}} A_n$. If $x \in A$ then $f$ has a continuous extension to $\mathbb{Q} \cup \{x\}$. (Having $x \in A$ lets us construct a sequence of rationals $q_n \to x$ such that $f(q_n)$ is Cauchy, and setting $f(x) = \lim f(q_n)$ results in a continuous function.)

Now I claim $A_n$ is open. Indeed, it is easy to see that if $x \in A_{n, \delta}$ and $|x-y| < \delta/2$ then $y \in A_{n, \delta/2}$. Moreover, since $f$ is continuous, we have $\mathbb{Q} \subset A_n$, so in fact $A_n$ is open and dense. Thus $A$ is comeager. If $A \subset \mathbb{Q}$ then we have $\mathbb{R}=A^c \cup \mathbb{Q}$ which is the union of two meager sets. By the Baire category theorem, this is impossible.

Note that this may really be the same as your argument, in disguise; in particular, the fact that $\mathbb{Q}$ is not $G_\delta$ is also the Baire category theorem. But I have a pretty strong feeling you are not going to be able to avoid the Baire category theorem completely. (Pun?)

-
Indeed, this seems to be very close to the argument in the question. In particular, the first paragraph corresponds to Lemma 4.3.16. of Engelking. Anyway, it's good to have the argument spelled out in more detail. –  LostInMath Apr 2 '12 at 23:08
@LostInMath: Yes, upon later rereading I realized that it is essentially the same thing. Oh well, it was a nice exercise for me... –  Nate Eldredge Apr 3 '12 at 3:34