# Same in $\mathbb{Q}$ implies same in $\mathbb{R}$

Prove that if $f : \mathbb{R} → \mathbb{R}$ and $g : \mathbb{R} → \mathbb{R}$ are continuous functions such that $f(r) = g(r)$ for every $r \in \mathbb{Q}$,

Then show that $f(x) = g(x)$ for all $x \in \mathbb{R}$.

I find this question to be kind of weird why do we know that each irrational will be mapped the same irrational on the other function why couldn't it be mapped to a different one? (im guessing because it continuous on the reals but not sure how to argue it)

• Do you know that $\mathbb{Q}$ is dense in $\mathbb{R}$? Or that given any irrational number there is a sequence of rational numbers coverging to it? – Krish Nov 7 '17 at 16:24

Continuity forces this since $\mathbb Q$ is dense in $\mathbb R$.

The point is that every $r \in \mathbb R$ is the limit of a suitable sequence of rationals $(q_n)$.

So, $$f(r)=f\left(\lim_{n \to \infty} q_n\right)=\lim_{n \to \infty} f(q_n)=\lim_{n \to \infty}g(q_n)=g\left(\lim_{n \to \infty}q_n\right)=g(r),$$

using the definition of sequential continuity.

• We defiantly dont have the sequential continuity thing you linked but i think i understand your argument – Faust Nov 7 '17 at 16:27
• I intentionally included a link to the proof of equivalence. One can adapt that proof for this problem, or prove it as a lemma (it is really short.) – Andres Mejia Nov 7 '17 at 16:28

If $t \in \Bbb R \setminus \Bbb Q$, then there is a sequence $r_n \in \Bbb Q$ such that $\lim_{n \to \infty} r_n = t$. Then by continuity $f(t) = \lim_{n \to \infty} f(r_n) = \lim_{n \to \infty} g(r_n) = g(t)$.

• Hi bob! hope all is well. – Andres Mejia Nov 7 '17 at 16:27
• @AndresMejia: howdy, good to hear from you. Things are OK. Yourself? – Robert Lewis Nov 7 '17 at 16:28
• I'm well! Wrapping up that paper from ucsb now, getting ready to apply for graduate school. Glad things are ok. – Andres Mejia Nov 7 '17 at 16:29