# Continuous functions and uncountable intersections with the x-axis

Let $f : \mathbb{R} \to \mathbb{R}$ such that the set $X = \{x \in \mathbb{R} : f(x) = 0\}$ does not contain any interval (i.e. there is no interval $I \subset X$)

Of course the set $X$ can be uncountable (see Cantor Set). If we add that $f$ is continuous, is it true that X is countable? I have been thinking about this for a while, and couldn't find any counterexamples - my intuition says the answer is yes. I tried to start a proof but really couldn't move forward.

My attempt (by contradiction): assume $X$ is uncountable. Then there exists $[a, b] \subset \mathbb{R}$ such that $X \cap [a, b]$ is uncountable. Now, let $g$ be the restriction of $f$ to $[a, b]$. Then $g$ is uniformly continuous. I don't know what to do next, though...

Any hints appreciated.

• There was a lot of nineteenth century confusion about closed nowhere dense sets, i.e., sets that contain no interval. So you just need to bring your intuition up to date. If it was hard for them then don't be surprised if it takes a little while to get it. Too bad they didn't have StackExchange! Dec 10, 2015 at 17:53
• Absolutely! After some more months studying hopefully my intuition will be updated! Dec 10, 2015 at 17:59
• Fun fact: if $f$ is the path of a Brownian motion, then with probability 1, its zero set is uncountable and contains no intervals. So in some sense, "almost every" continuous function has this property. Dec 10, 2015 at 21:18

No, the conclusion is not true. Take an uncountable compact set $E$ that contains no intervals (for example, the $1/3$ Cantor set) and define
$$f(x) = \operatorname{dist}(x, E)$$
This is zero if and only if $x \in E$, and is actually Lipschitz continuous.
• If you take Brouwer's construction for a space-filling curve and project it onto the x-axis and extend it periodically with period 1,you get a continuous $f : R\to R$ which is not constant on any interval of positive length . And for any $x\in R$ and any $d>0$ the set $\{y :|y-x|<d \land f(y)=f(x)\}$ has the cardinal of the reals. Dec 10, 2015 at 18:33