-1

Let $f, g$ be continuous from $\mathbb R$ to $\mathbb R$, and suppose that $f(r) = g(r)$ for all rational numbers $r$. Is it true that $f(x) = g(x)$ for all $x \in \mathbb R$?

Thomas Andrews
  • 186,215
JLIU
  • 117
  • Please search before asking. Keywords: "continuous", "functions", "rational", "equal". –  Apr 21 '15 at 04:54

4 Answers4

2

Yes, this is true. Here is justification for why:

Let $x \in \Bbb R$. Since $\Bbb Q$ is dense in $\Bbb R$, there is some sequence $r_{n}$ of rational numbers such that $r_{n} \to x$, right?

Well, by continuity of $f$ and $g$, $f(r_{n}) \to f(x)$ and $g(r_{n}) \to g(x)$ (do you understand why?). But since $r_{n}$ is rational for each $n$, $f(r_{n}) = g(r_{n})$ for each $n$. That means $f(x) = g(x)$, and this is true for each $x \in \Bbb R$ (this is because a convergent sequence cannot converge to two different limits -- something you should be able to prove on your own).

layman
  • 20,819
1

Hint: Every real number is the limit of rational numbers.

Yuval Filmus
  • 57,953
1

Assume $f(x)\neq g(x)$ for some $x$. Let $\epsilon=\left|\frac{f(x)-g(x)}{2}\right|$. Find $\delta_1$ so that if $|x-y|<\delta_1$ then $|f(x)-f(y)|<\epsilon$. Similarly, find $\delta_2$ for $g$.

Then let $\delta = \min(\delta_1,\delta_2)$, and find a rational number $r\in(x-\delta,x+\delta)$. So $$2\epsilon=|f(x)-g(x)|\leq|f(x)-f(r)|+ |f(r)-g(r)|+|g(r)-g(x)| < \epsilon + 0 + \epsilon=2\epsilon$$

Thomas Andrews
  • 186,215
1

Yes it is true. If two continuous function takes same values on rational numbers then they are equal on the entire line.

Consider the set $\{x\in\mathbb R:f(x)=g(x)\}$. This is a closed set. Clearly this set contains all rational numbers. So this set is dense. Dense and closed sets in $\mathbb R$ must be whole of $\mathbb R$.

Thomas Andrews
  • 186,215
Ripan Saha
  • 1,901