Verify proof that if $f(q)=0$ for all $q\in\mathbb{Q}$ and $f$ continuous, then $f\equiv 0$.

continuityreal-analysissolution-verification

There was a part of a problem in my Real Analysis homework that I wanted to verify. Basically, we have an enumeration $r_1,r_2,\dots$ of $\mathbb{Q}$, we know $f:\mathbb{R}\to\mathbb{F}$ (where $\mathbb{F}=\mathbb{R}$ or $\mathbb{F}=\mathbb{C}$) is continuous, and $f(r_k)=0$ for all $k\in\mathbb{N}$. I tried proving that this means $f\equiv 0$, and I want to see if my proof is correct. Here it is:

Suppose to the contrary that $f$ is not identically $0$. Then there exists $x\in\mathbb{R}\setminus\mathbb{Q}$ such that $f(x)=y$ for some $y\in\mathbb{F}\setminus \{0\}$. Choose $\epsilon_0=|y|/2$ and suppose $\delta>0$. Since $\mathbb{Q}$ is dense in $\mathbb{R}$ we may choose $k_\delta\in\mathbb{N}$ such that $|x-r_{k_\delta}|<\delta$. Thus, $|f(x)-f(r_{k_\delta})|=|y-0|=|y|\geq\epsilon_0.$ This shows that $f$ is not continuous at $x$, which is a contradiction. Thus, $f\equiv 0$.

Is this proof correct? Thank you for your help!

Best Answer

Your proof is not only correct, it is also well written. You have proven that there exists some $\epsilon$ such that, for every $\delta > 0$, there exists some $x_0$ such that $|x-x_0|<\delta$ and $|f(x)-f(x_0)|\geq \epsilon$, which is the exact negation of the definition of continuity, so your proof is solid.


However, the proof is a little hard to comprehend at first, given that it is a proof by contradiction, but then inside it it holds a direct proof that $f$ is not continuous. An alternative way to write it would be:

Suppose $f$ is not $0$. Then, there exists some $x_0\in\mathbb R$ such that $f(x_0)=y\neq 0$. Let us set $\epsilon = \frac{|y|}{2}$. Because $f$ is continuous, there must exist some $\delta > 0$ such that $|f(x)-y|<\delta$ for all $x\in(x_0-\epsilon, x_0+\epsilon)$. However:

  1. If $|f(x)-y|<\delta$, then $f(x)\neq 0$ (since $f(x)=0\implies |f(x)-y|>\delta$)
  2. Because $\mathbb Q$ is dense in $\mathbb R$, the intersection of $\mathbb Q$ with any open interval is nonempty.
  3. Therefore, there exists some $q\in\mathbb Q\cap (x_0-\epsilon, x_0+\epsilon)$, and for that $q$, we have $f(q)\neq 0$, a contradiction.

I would, however, point you to a proof that in my mind is cleaner. It is both shorter and avoids any use of proof by contradiction (which, while a perfectly valid method, is often hard to follow).

This is the proof:

Let $x\in \mathbb R$. Then, because $\mathbb Q$ is dense in $\mathbb R$, there exists some sequence $q_1,q_2,\dots$ such that $$\lim_{n\to\infty}q_n = x.$$

We also know that $f$ is continuous, therefore,

$$f(x)=f(\lim_{n\to\infty} q_n) = \lim_{n\to\infty} f(q_n) = \lim_{n\to\infty} 0 = 0.$$

Note:

Naturally, the proof above hinges on the fact that we already know a couple of things, in particular

  • The alternative definition of dense sets (i.e., knowledge that "$A$ is dense in $\mathbb R$ $\iff$ every element in $\mathbb R$ is a limit of elements from $A$)
  • The alternative definition of continuity (i.e., knowledge that "$f$ is continuous on $\mathbb R$ $\iff$ for every sequence $x_1,x_2,\dots$ of real numbers, we have $$\lim_{n\to\infty} f(x_n)=\lim_{n\to\infty} f(x_n).$$
Related Question