Continuous function on $[0,1]$ such that its zeros form a nowhere dense set of positive measure

continuitymeasure-theoryroots

I know few facts,

  • if $f : [0,1] \to \mathbb{R}$ is continuous, $Z(f) \triangleq f^{-1}(\{0\})$ is closed,
  • there are continuous functions whose zeros are nowhere dense,
  • there are nowhere dense sets of positive measure.

From these facts, I cannot conclude that if $f:[0,1] \to \mathbb{R}$ is continuous and its zeros $Z(f)$ form a nowhere dense set, this set $Z(f)$ is of null measure. Can we prove that it is indeed the case, or exhibit a counter-example?

Best Answer

Answer to the title question: Yes! There exists such a function. For example, consider the function $$f(x)=\frac{d(x,A)}{d(x,A)+d(x,B)}$$ where $A$ is the fat cantor set in $[0,1]$ and $B$ is any closed singleton set $\{b\}$ where $b \notin A$. Then $f$ is continuous whose zero set is $A$, which is nowhere dense in $[0,1]$ of positive measure!


Edit: The function $x \mapsto d(x,A)$ alone works.