# Continuous extensions of continuous functions on dense subspaces

I thought that if I have a function $f: \mathbb Q \to \mathbb R$ that is continuous then I can (uniquely) extend it to a continuous function $F: \mathbb R \to \mathbb R$ as follows: for $r \in \mathbb R \setminus \mathbb Q$ pick a sequence $q_n$ converging to $r$ and then define $F(r) = \lim_{n \to \infty} f(q_n)$.

So I thought there must be a theorem saying that given a continuous function $f: D \to Y$ where $D$ is a dense subset of a metric space $X$ one can uniquely extend it to $F: X \to Y$.

Instead I found a theorem stating this but with the additional requirement that $f$ has to be uniformly continuous. Now I'm confused: is my example above wrong? Where does uniform continuity come in here?

Thanks.

-
Well, here's an easy counterexample: try extending $x \mapsto 1/x$ defined on $\mathbb{R} \setminus \{ 0 \}$ to all of $\mathbb{R}$... – Zhen Lin Jul 12 '12 at 6:02

Uniform continuity ensures that the Cauchy sequence $(q_n)$ in $\mathbb Q$ is mapped to a Cauchy (and hence convergent) sequence $\bigl(f(q_n)\bigr)$ in $\mathbb R$. If $f$ is just continuous, $\bigl(f(q_n)\bigr)$ needn't converge (remember: $f$ is just continuous on $\mathbb Q$, so you can't argue, that convergent sequences $q_n \to r \not\in\mathbb Q$ are mapped onto convergent sequences by $f$). For example $x\mapsto \frac 1{x - \sqrt 2}$ is continuous (not uniformly!) on $\mathbb Q$ and can't be extendend.
@MattN: No, it is weaker than uniform continuity, and uniform continuity doesn't imply Lipschitz. E.g.: $\sqrt[3]{x}$ is uniformly continuous but not Lipschitz, and $x^2$ maps Cauchy sequences to Cauchy sequences but is not uniformly continuous. – Jonas Meyer Jul 12 '12 at 6:12
@MattN. But perserving C-sequences is, what you need in the prove of the extension theorem: If $X$, $Y$ are metric spaces, $Y$ complete, $D \subseteq X$ is dense, $f \colon D \to Y$ is a Cauchy continuous map, then there is a unique extension to a continuous $F \colon X \to Y$. – martini Jul 12 '12 at 6:18
Oops. ${}{}{}{}$ – Rudy the Reindeer Jul 12 '12 at 6:22