Can there be two distinct, continuous functions that are equal at all rationals?

Without resorting to ε-δ arguments: Let $f$ and $g$ be continuous real functions and $f(x) = g(x)$ for all rational $x$. For any real number $c$ (in particular, an irrational $c$), there exists a Cauchy sequence of rational numbers such that $\lim_{n \to \infty}x_{n}=c$. Since $f$ and $g$ are continuous, $\lim_{n \to \infty}f({x_{n}})=f({c})$ and $\lim_{n \to \infty}g({x_{n}})=g({c})$. Since $x_n$ is rational, $f(x_n) = g(x_n)$ for all $n$, so the two limits must be equal and so $f(c) = g(c)$ for all real $c$.


And one more proof, using the topological notion of continuity: Suppose for contradiction that there exists some $x$ with $f(x)-g(x) = k \neq 0$. Without loss of generality, we can take $k > 0$. Since $f$ and $g$ are continuous, $f-g$ is continuous, so we must have that $f(x) - g(x) > 0$ on a non-empty open set $S$ since the inverse image of the open interval $(k/2, 3k/2)$ must be open. But since the rationals are dense in the reals, $S$ must contain a rational number $y$, with $f(y) \neq g(y)$, a contradiction.


If there were two continuous functions $f(x)$ and $g(x)$ that were equal at all rationals, then (because the rationals are dense) we can show that $\lim_{x \to a} f(x) - g(x) = 0$ for all values of $a$ using a delta-epsilon proof.

Since the difference of two continuous functions is continuous, we know $\lim_{x \to a} f(x) - g(x) = f(a) - g(a)$ for all $a$, and therefore $f(a) - g(a) = 0$ and $f(x) = g(x)$, proving that $f$ and $g$ must be identical.