Determining if a map on a space is continuous by checking on a dense subset I recently read a proof of something my calculus teacher had told me, namely that the set of continuous maps $f: \mathbb{R} \to \mathbb{R}$ had the cardinality of $\mathbb{R}$. The proof was simple enough: There must be at least that many, as it includes all constant maps, but can be no more because we can injectively map the continuous maps on $\mathbb{R}$ to $\mathbb{R}^{\mathbb{Q}}$ by $\phi : f \mapsto (f(q))_{q \in \mathbb{Q}}$, and $\mathbb{R}^{\mathbb{Q}}$ has the same cardinality as $\mathbb{R}$, as this is enough to determine the value of $f$ on any real value by taking $f(x) = \lim_{q \to x, q \in \mathbb{Q}} f(q)$; that is, assuming the map is continuous.
But there's also the following: Let $g: \mathbb{Q} \to \mathbb{R}$ be given by
\begin{align*}
g(x) & = \begin{cases}
0, & x < \sqrt{2} \\
1, & x > \sqrt{2} .
\end{cases}
\end{align*}
Then $g$ is continuous on $\mathbb{Q}$, but does not extend to a continuous map on $\mathbb{R}$. So my question is: Is there a way to determine if a map $g : \mathbb{Q} \to \mathbb{R}$ extends to a continuous map $f: \mathbb{R} \to \mathbb{R}$?
Thanks.
 A: The answer in terms of Cauchy sequences is correct. A condition that may be easier to use is this: The function $g:\Bbb Q\to \Bbb R$ extends to a continuous function $f:\Bbb R\to\Bbb R$ if and only if for every $a,b\in\Bbb R$ with $a<b$ the restriction of $g$ to $\Bbb Q\cap [a,b]$ is uniformly continuous.
The necessity is clear, since we know that $f$ must be uniformly continuous on $[a,b]$. On the other hand, it's a general fact that a function uniformly continuous on a set $E$ contained in some metric space extends to a continuous function on the closure of $E$. (And it's clear that if $f$ is continuous on $[a,b]$ for all $a,b$ then $f$ is continuous.)
A: It is necessary and sufficient that for any Cauchy sequence $\{x_n\}$ of rational numbers, the sequence of $\{f(x_n)\}$ is also Cauchy.
Since the real numbers are the completion of the rational numbers, if a sequence in the rational numbers converges (i.e., is Cauchy), then it converges to a real number, and you need the values of $f$ to converge as well (so it must also be Cauchy).
