If $f$ and $g$ are continuous and for every $q\in \mathbb{Q}$ we have $f(q)=g(q)$, then $f(x)=g(x)$ for every $x\in \mathbb{R}$ [duplicate]

Hello guys,

Let $f$ and $g$ be continuous functions, $f,g:\mathbb{R} \to \mathbb{R}$, such that for every $q\in \mathbb{Q}$ we have $f(q)=g(q)$.

I need to prove that $f(x)=g(x)$ for every $x\in \mathbb{R}$.

I think I should prove that with sequences. We can choose a $x\in \mathbb{R}$, and we know that there is a sequence of rational numbers whose limit is $x$. Let's call it $X_{n}$, so $\lim f(X_{n})=\lim g(X_{n})$, when $n \to \infty$, and we get what we want.

Is it correct? What do you think?

-

marked as duplicate by t.b., Jonas Meyer, Aryabhata, Sivaram, Pete L. ClarkMay 10 '11 at 22:41

This question was marked as an exact duplicate of an existing question.

Yes, this is correct. – Asaf Karagila May 9 '11 at 17:39
Yes. Your method is right. You may want to prove continuity and sequentially continuity are the same. – user17762 May 9 '11 at 17:39
Yes, that is essentially correct. You might want to be more explicit about how the sequence is constructed, and why you can take limits like that. – Zhen Lin May 9 '11 at 17:39
@Sivaram: They are the same under this context, not in the full mathematical context. – Asaf Karagila May 9 '11 at 17:39
@Asaf: Yes they are the same in this context. But in case he has not proved the equivalence of the $\epsilon-\delta$ definition and sequential definition. – user17762 May 9 '11 at 17:41

Consider h=f-g, which is identically zero for all $q\in \mathbb{Q}$. Assume h(x)= a , for some irrational x, and a is non-zero. Then any e-ball around x will necessarily contain rationals. Choose an e-value that will prevent continuity for any choice of delta, re a delta-epsilon proof.
w($ild)^3$life: you are right, I just edited it. – gary May 10 '11 at 0:41
Suppose $f$ and $g$ are continuous real valued functions. Then $[f = g] = \{x| f(x) = g(x)\}$ is just the set of points $x$ for which $f(x) - g(x) = 0$. By continuity, this is a closed set because it is the inverse image of a single point under a continuous function. So if $f$ and $g$ are real continuous functions and $f(x) = g(x)$ for all $x\in E$ then $f(x) = g(x)% on the closure of$E$. Therefore if$f$and$g$agree on a dense subset of their domain, they agree on the entire domain; to wit, f = g. This entire argument works very nicely if$f$and$g\$ are defined on an arbitrary metric space.