A nontrivial everywhere continuous function with uncountably many roots?

The roots of a continuous function is always a closed subset of $\mathbb{R}$ : $\{0\}$ is closed, thus $f^{-1}(\{0\})$ is closed too.

If you have a closed set $S$, you can define a function $f : x \mapsto d(x,S)$, which is continuous and whose set of roots is exactly $S$ : you can make a continuous function have any closed set as its set of roots.

Therefore you only have to look for closed sets that are uncountable.


This could be interesting for you.


Even though you seem to be happy with the given answers, I can't resist pointing out the following construction which I already mentioned in this thread. If this example is already contained in one of the links provided in the other answer, I apologize for the duplication:

Choose a space-filling curve $c: \mathbb{R} \to \mathbb{R}^2$ and compose it with the projection $p$ to one of the coordinate axes. This gives you an example of a continuous and surjective function $f = p \circ c: \mathbb{R} \to \mathbb{R}$ all of whose pre-images are uncountable.