# Continuous $f: \mathbb R \to \mathbb R$ with infinitely many zeroes in every interval

Is there a continuous function $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for any two real numbers $a>b$, $f(x)=0$ has exactly a countable infinite many solutions with $a>x>b$?

-
@KaratugOzanBircan Why is \rightarrow better than \mapsto, the latter is more appropriate IMO – Sasha Nov 5 '11 at 20:51
@Sasha: $\mapsto$ is usually used when explicitly saying where $x$ is mapped to, e.g. $$x\mapsto x^2$$ When the function is just from one set to another, $\to$ is more common. – Asaf Karagila Nov 5 '11 at 20:54
@Sasha: It is appropriate to use \mapsto when we deal with the elements. For example, we define a function $f(x): \mathbb{R} \rightarrow \mathbb{R}$ such that $x \mapsto x^2.$ – HbCwiRoJDp Nov 5 '11 at 20:56
Thanks for the clarification, good to know. – Sasha Nov 5 '11 at 20:59
@Karatung: I don't remember I've ever seen that written this way. Usually people write $f: \mathbb{R} \to \mathbb{R}, x \mapsto x^2$. – t.b. Nov 5 '11 at 21:20

No. If that were the case, then for every $a\in \mathbb R$ and every $n\in\mathbb N$, there would be an $x_n$ such that $a<x_n<a+1/n$ and $f(x_n)=0$. Then the sequence $(x_n)$ converges to $a$, and by continuity $(f(x_n))=(0,0,0,0,...)$ converges to $f(a)$, so $f(a)=0$. Therefore $f$ is identically zero, which implies its zero set is uncountable in each interval, contradicting the hypothesis.
More briefly: The zero set of a continuous function is closed, so if it is also dense, it must be all of $\mathbb R$. This makes the existence of such $f$ impossible, because intervals in $\mathbb R$ are uncountable.