# Proving that $f$ is identically zero

Suppose that $f:\mathbb{R}\rightarrow\mathbb{R}$ is continuous on $\mathbb{R}$ and that $f(r) = 0$ for every rational number $r$. Prove that $f(x) = 0$ $\forall$ $x \in \mathbb{R}$

Ok, here's what I've done:

Let $c \in \mathbb{Q}$.
Since, $f$ is continuous so $\forall \epsilon > 0$ $\exists \delta > 0$ such that $\forall x \in (c-\delta, c+\delta)$, we should have $|f(x)| < \epsilon$. Now, let $d \in (c-\delta, c+\delta) \cap \mathbb{R} \setminus \mathbb{Q}$, $|f(d)| < \epsilon$. Since $\epsilon$ is arbitrary, we have $f(d) =0$

Hence, $\forall c \in \mathbb{Q}$, $\exists \delta > 0$ such that $\forall$ $|x-c| < \delta$, $f(x) = 0$

From here, how do I deduce that $f(x) = 0$ $\forall x \in \mathbb{R}$?

(Just to mention : I can intuitively think that it should be true because like you can go on taking union of these neighbourhoods but I was unable to rigorously prove it)

• An elegant way to prove the claim would be using that the rational numbers are dense in $\mathbb R$ Nov 16 '16 at 14:15
• Related (but this is far more general): math.stackexchange.com/questions/1084018/… Nov 16 '16 at 14:16
• This is not quite good enough. You pick your $d$ after being given your $\epsilon$. That means that if you choose a smaller $\epsilon$, then your $\delta$ might be smaller, which means that we no longer have $d \in (c-\delta, c+\delta)$, so you can't say that $|f(d)| < \epsilon$ while $\epsilon$ gets smaller and smaller. It's easier to make this work if you let let $c$ be irrational and show that $f(c) < \epsilon$ by finding rational $d\in (c-\delta, c+\delta)$ Nov 16 '16 at 14:16
• @Peter Can you give me some hints on how to proceed with that idea? Nov 16 '16 at 14:21
• @Watson I came across that but like I am a beginner with analysis, so I don't know much about Hausdorff space! I'll try to read about them next. Thanks! Nov 16 '16 at 14:25

The step following "since $\epsilon$ is arbitrary..." is not quite right.

You have shown that if $d \in (c-\delta, c+\delta) \cap \mathbb{R} \setminus \mathbb{Q}$, then $|f(d)|< \epsilon$. You want to say that you could just make epsilon smaller and smaller; the problem with this is that $\delta$ depends on $\epsilon$. If you want $|f(d)|< \frac{\epsilon}{2}$, you might need to be in a smaller interval $(c-\eta, c+\eta)$ for some $\eta< \delta$. So you cannot conclude that $|f(d)|<\epsilon$ for all $\epsilon>0$, just for the epsilon you chose.

The slickest way to prove this is to use the fact that $f$ is continuous if and only if for every sequence $(x_n)$ such that $\lim_{n \to \infty}x_n \to x_0$, we have $\lim_{n \to \infty}f(x_n) \to f(x_0)$. If you let $x_0 \in \mathbb{R} \setminus \mathbb{Q}$, can you choose a sequence $(x_n)$ so that $\lim_{n \to \infty} f(x_n)=0$? (This works if $f(x_n)=0$ for all $n$...)

If you want to go the delta-epsilon route, then given $c \in \mathbb{R}\setminus \mathbb{Q}$, you know for all $\epsilon>0$ there exists $\delta>0$ such that for all $x \in (c-\delta,c+\delta)$, $|f(x)-f(c)|< \epsilon$. In particular, for each $\epsilon$ and corresponding $\delta$, there will be an $x \in (c-\delta,c+\delta) \cap \mathbb{Q}$. What can you conclude from that?

• Yep! Got it. Just choose a sequence of rational numbers which converges to some irrational and that works. And using delta-epsilon route, we can choose $c \in \mathbb{R}\setminus\mathbb{Q}$ so that $\forall \epsilon > 0$ $\exists \delta > 0$ such that $\forall x \in (c-\delta, c+\delta)\cap\mathbb{Q}$ we have $|f(x) - f(c)| = |-f(c)| = |f(c)| < \epsilon$. SInce we can always find a rational in the interval $(c-\delta, c+\delta)$, so $f(c) = 0$. Am I right here? Nov 16 '16 at 16:00
• Yep, you got it.
– kccu
Nov 16 '16 at 16:11

Let $x\in\mathbb R$. By continuity, $f(x)=\lim_{y\to x}f(y)$. Since this limit exists, it is independent of the manner of approach $y\to x$; specifically, we may assume that $y\to x$ through rational values since $\mathbb Q$ is dense in $\mathbb R$. But then $f(x) = \lim_{y\to x} 0 = 0$.

A slightly more topological approach:

Theorem: Let $(X, \tau_X)$, $(Y, \tau_Y)$ be two topological spaces. Suppose $Y$ is Hausdorff and that $D \subset X$ is a dense subset in $X$. Let $f,g: X \to Y$ be two continuous functions such that $f_{|D}=g_{|D}$. Then $f=g$ on $X$.

The theorem is proven in this question.

Now, $f_{|\mathbb Q}=0$ and $\mathbb Q$ is dense in $\mathbb R$, which is Hausdorff. By the previous theorem, $$f=0$$

Only thing that remains to show is that $f(r)=0\forall r\in \Bbb Q^c$

Since $\Bbb Q$ is dense in $\Bbb R$ so given $r\in \Bbb Q^c;\exists r_n\in \Bbb Q$ such that $r_n\to r$

$f$ is continuous so $r_n\to r\implies f(r_n)\to f(r)\implies f(r)=0$