# Counterexample: Continuous function with level sets of Lebesgue measure zero

Let $$f:[0,1] \rightarrow \mathbb{R}$$ be a continuous function. It is given that it has "no flat regions", i.e. its level sets have empty interiors. My question is, must it mean that each of its level sets has Lebesgue measure zero? In other words, can a continuous function with "no flat regions" have level sets which have positive Lebesgue measure?

Somewhere on this site I read a comment to a question that said a continuous function can have, as one of its level sets, the fat Cantor set, which has empty interior but positive Lebesgue measure. Unfortunately I can't find it now, and the comment also did not give an actual example.

Any example is most appreciated.

• Given any closed set in $[0,1]$ say there is a continuous function that is $0$ precisely only on $F$ and for which the level set of any other point is at most countable - take $[0,1]-F$ union of disjoint at most countably many open intervals and define the function to be $0$ on $F$ and triangular with height $1$ on each interval (start at $0$ at an end go up linearly to $1$ at midpoint and back to $0$); note that you can make $F$ nowhere dense of arbitrary measure less than $1$ Commented Dec 24, 2022 at 17:04
• But if $F$ is a union of disjoint at most countably many open intervals, it does not have empty interior. You did mention "you can make F nowhere dense of arbitrary measure less than 1" but I do not know any such construction. I'm very much a beginner in measure theory. Any example would be most helpful. Commented Dec 24, 2022 at 17:08
• The complement of $F$ being open is a disjoint union of open intevals; a fat Cantor set is nowhere dense Commented Dec 24, 2022 at 17:10
• Consider your favourite closed set $C\subseteq[0,1]$ with empty interior and positive Lebesgue measure (namely, the complement of the fat rationals). The map $f(x)=\inf_{y\in C}\lvert x-y\rvert$ is zero on $C$ and it takes any specific real value $c\ne 0$ at most twice in every connected component of $[0,1]\setminus C$. Therefore $f^{-1}(c)$ is $C$ for $c=0$ and a countable subset for $c\ne 0$. Either way, its interior will be empty. Commented Dec 24, 2022 at 17:23
• @Conrad You can't make the function triangular of height $1$ on every interval, because you still need to preserve global continuity. Commented Dec 24, 2022 at 17:32

Take $$\operatorname{dist}(x,{\mathcal F}):=\inf_{y\in\mathcal F}|x-y|$$ where $$\operatorname{dist}$$ is the distance function and $$\mathcal F$$ is the fat Cantor set. Since $$\mathcal F$$ is closed, this function is zero precisely on $$\mathcal F$$.

EDIT: The construction of a fat Cantor set is outlined here.

• If you want (once-)differentiable, you could probably do$$\big({\operatorname{dist}(x,{\mathcal F}_{\le x})\cdot\operatorname{dist}(x,{\mathcal F}_{\ge x})}\big)^2,$$where ${\mathcal F}_{\le x}=\{y\in{\mathcal F}\mid y\le x\}$ etc, which seems to me like it would smooth things out Commented Dec 25, 2022 at 19:36
• Thank you so much! I had already accepted ApassJack's answer per his comment in the question thread. But I'm most grateful for both answers. This is a simple and easily understood construction, so that you especially for that. Commented Dec 25, 2022 at 20:42
##### An idea

Suppose we have a fat Cantor set $$\mathcal F\subset[0,1]$$, which has empty interior. We can define a function $$f$$ that is $$0$$ on $$\mathcal F$$. The complement of $$\mathcal F$$ in $$[0,1]$$ is a union of open intervals. For each interval, let $$f$$ be a continuous function that looks like "$$\land$$" on it with $$0$$ at boundaries.

This idea is also stated by as Sassatelli Giulio.

##### A fat cantor set

For any $$a=\sum _{k=1}^\infty a_{k}2^{-k^2}\in[0,1]$$, where $$a_k=\lfloor2^{k^2}a-2^{2k-1}\lfloor2^{(k-1)^2}a\rfloor\rfloor\in\{0,1, 2, \cdots, 2^{2k-1}-1\}$$. In terms of positional notation system, $$a=a_1a_2a_3a_4\cdots,$$ where the weight of each position is respectively $$\frac1{2^1},\frac1{2^4},\frac1{2^9},\frac1{2^{16}},\cdots.$$

Consider $$\mathcal F=\{\sum _{k=1}^\infty a_{k}2^{-k^2}: a_k\in\{0,1, 2, \cdots, 2^{2k-1}-1\}, a_k\not=2^{2k-2}\}\subset[0,1]$$. In plain words, we start with $$[0,1]$$. At round $$k\in\{1,2,\cdots\}$$, for each remaining intervals, we split it into $$2^{2k-1}$$ equal pieces and then take away the interior of one of the pieces in the middle. All the points that have never been taken away form $$\mathcal F$$.

$$\ \mathcal F$$ is a fat Cantor set with Lebesgue measure $$\prod_{k=1}^{\infty}\frac{2^{2k-1}-1}{2^{2k-1}}>1-\sum_{k=1}^{\infty}\frac1{2^{2k-1}}=\frac13.$$

##### A continuous function $$f$$ with $$f^{-1}(0)$$ having positive lebsegue measure

Suppose $$a\in[0,1], a\notin\mathcal F$$. Since $$\mathcal F$$ is a closed subset of $$\Bbb R$$, there are open intervals that are disjoint with $$\mathcal F$$ that contain $$a$$. Let $$(\ell_a,r_a)$$ be the biggest one of them.

Define $$f:[0,1]\to\Bbb R$$, $$f(a)=\begin{cases} 0&\text{if }a\in\mathcal F,\\ (\ell_a+r_a)/2-|a-(\ell_a+r_a)/2|&\text{if }a\notin\mathcal F.\\ \end{cases}$$

$$f$$ is continuous.
$$f^{-1}(a)$$ is finite if $$a\not=0$$.
$$f^{-1}(0)=\mathcal F$$, a fat Cantor set with Lebseque measure $$>\frac13$$.
All level sets of $$f$$ have empty interiors.

• I think mine is the same as yours. Commented Dec 25, 2022 at 19:40
• @AkivaWeinberger Yes. Commented Dec 25, 2022 at 19:48