# Non-zero smooth functions vanishing on a Cantor set

It is easy to give examples of continuous functions $f:[0,1]\to \mathbb R_+\cup\{0\}$ non-zero but vanishing on a Cantor set (ex: Can Cantor set be the zero set of a continuous function?). It is clearly non-true for analytic functions. My question is:

1. Are there uniformly continuous non-zero functions vanishing on a Cantor set?
2. Are there α-Hölder continuous non-zero functions vanishing on a Cantor set?
3. Are there continuously differentiable non-zero functions vanishing on a Cantor set?

A Cantor set $C\subset[0,1]$ is closed, and that is all we need. Therefore $f(x)=d(x,C)$ (distance from $x$ to $C$) vanishes on and only on $C$. It is also Lipschitz-continuous.

For your third question, you can take $g(x)=f(x)^2$. This is $C^1$ apart from peaks in the middle points of the intervals of the complement of $C$. You can easily smooth the function near these points, since you are well away from $C$.

Choosing a higher power gives you any $C^k$ smoothness you want. But you can also get $C^\infty$. Let $\phi:\mathbb R\to[0,\infty)$ be a smooth function vanishing on $(-\infty,0]$ and set $g(x)=\phi(f(x))$ and mollify the tips.

Conclusion: The answer to all three questions is yes.

Edit: It is not entirely clear what you mean by constructing by hand. This is as close as I can come to making an explicit function if the Cantor set is not specified. (I also noted that the distance was also used in this answer to the OP's linked question. But it was not concerned with regularity.)

• Thanks! I need to think a bit about your answer for the third question. Aug 26, 2014 at 16:23

By a theorem of Whitney, for any closed subset $C$ in $\mathbb R^n$ there exists a nonnegative $C^\infty$-function $f$ on $\mathbb R^n$ which vanishes exactly at $C$. This also holds on any smooth manifold. I tried to find the exact reference, but I could not find it just now. Maybe, this result is hidden in:

• Whitney, Hassler: Analytic extensions of differentiable functions defined in closed sets, Trans. AMS 36 (1934), 63--89.
• For a precise statement, see my answer. Mar 21, 2018 at 20:03

It's not hard to construct such a function explicitly. Let $$\psi(x) = \begin{cases} e^{-1/(1-x^2)}, & -1 < x < 1 \\ 0, & \text{else} \end{cases}$$ so that $\psi$ is $C^\infty$ and is nonzero precisely on $(-1,1)$. In the usual middle-thirds construction of the Cantor set, let $C_n$ be the centers of the intervals removed at step $n$ (there are $2^{n-1}$ of them and they have width $3^{-n}$; computing these points explicitly is left as an exercise for the reader with nothing better to do). Then let $$f(x) = \sum_{n=1}^\infty \sum_{y \in C_n} \frac{1}{n!} \psi(2 \cdot 3^n(x-y)).$$ It should be easy to verify that the sum converges uniformly with all its derivatives, so $f$ is also $C^\infty$, and by construction we have made it strictly positive precisely on the removed intervals, i.e. the complement of the Cantor set.

• $f(x)=\exp(-1/d^2(x))$ works for a general closed set $C\subset [0,1]$. Aug 27, 2014 at 16:12
• @ChristianRemling: I'm sure you're right, though maybe it takes a bit of work to see that it is $C^\infty$. Aug 27, 2014 at 17:35
• On second thoughts, this version is actually not $C^{\infty}$ at the midpoint of a gap of $C$, but that's easy to fix (I need a smooth modification near that midpoint). Aug 27, 2014 at 17:56

This answer is to provide a precise statement for a result mentioned by Peter Michor.

Theorem (Calderón-Zygmund). If $$F\subset\mathbb{R}^n$$ is closed, then there is a function $$f$$ such that

• $$c_1(n)d(x,F)\leq f(x)\leq c_2(n)d(x,F)$$, for all $$x\in\mathbb{R}^n$$,
• $$f\in C^\infty(\mathbb{R}^n\setminus F)$$ and $$\left|\frac{\partial^\alpha f}{\partial x^\alpha}(x)\right|\leq c_3(n,\alpha) d(x,F)^{1-|\alpha|} \quad \text{for all multiindices \alpha.}$$

This result says that there is a smooth regularization of a distance function. Originally it was proved in:

A.P.Calderón, A.Zygmund, A. Local properties of solutions of elliptic partial differential equations. Studia Math. 20 1961 171–225.

You can also find this result in

E.M. Stein, Singular integrals and differentiability properties of functions. Princeton Mathematical Series, No. 30 Princeton University Press, Princeton, N.J. 1970 (Theorem 2 in Chapter VI.2).