# How smooth is the boundary of a set defined by a function with certain smoothness?

Given a non-negative function $\phi\colon\mathbb R^n\to\mathbb R$, which is in $C^k$, and define the set \begin{align} S:=\{x\in\mathbb R^k\colon \phi(x)>0\} \end{align} then can we say that $\partial S$ is of $C^k$, assuming that $S,S^c\ne\emptyset$?

The above has counterexamples, and I want to change the question as below.

The $\phi, S$ are as above and consider one connected component $\Omega$ of $S$, does $\Omega$ has $C^k$ boundary?

• Not much, for instance, if $n=1$, $\partial S$ can be a Cantor set. Are you familiar with the implicit function theorem? – Moishe Kohan Feb 17 '18 at 18:14
• Consider $\mathbb{R}^2 \to \mathbb{R}$, $(x, y) \mapsto x^2y^2$ (the squares only because you demanded that the function be non-negative). – hunter Feb 17 '18 at 18:15
• @MoisheCohen I can not construct such an example, and I do not understand how to use the implicit function theorem here. – Display Name Feb 17 '18 at 18:18
• What if I consider a connected component of $S$ and it seems like having $C^k$ boundary? – Display Name Feb 17 '18 at 18:20
• The thing to know is that given any closed subset $E\subset R^n$ there exists a $C^\infty$ function $f: R^n\to [0,\infty)$ such that $E=f^{-1}(0)$. Restricting to a connected component will not help you. You pretty much have to assume that $0$ is a regular value of $f$, then the IFT will tell you the rest of the story. – Moishe Kohan Feb 17 '18 at 18:55

Let me convert my comments into an answer. First of all, given any closed subset $E\subset R^n$ there exists a $C^\infty$ function $f: R^n\to [0,\infty)$ such that $E=f^{−1}(0)$. See for instance here. In particular, the boundary of your set $S$ can be as bad as you wish, for instance, it can be the Koch snowflake or a Cantor subset of $R^2$, or the Menger curve in $R^3$, etc. In particular, even if you $S$ is connected, its boundary need not even be a topological manifold.
The "correct" assumption to make is that $0$ is a regular value of $f$, i.e. for every $x\in f^{-1}(0)$, $\nabla f(x)\ne 0$. Then the Implicit Function Theorem will imply that $f^{-1}(0)$ is a smooth submanifold of dimension $n-1$. See for instance this wikipedia article. My favorite reference for this staff is Guillemin and Pollack "Differential Topology". You then can prove (quite easily) that $$f^{-1}(0)= \partial S,$$ where $S=\{x: f(x)>0\}$.