# 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. – user39115 Aug 26 '14 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.
-

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]$. – Christian Remling Aug 27 '14 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$. – Nate Eldredge Aug 27 '14 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). – Christian Remling Aug 27 '14 at 17:56