Can any surface be described by an equation? There seems to be two definitions of a surface:


*

*The set $S$ of points $(x,y,z)$ satisfying the equation $f(x,y,z)=0$ for some smooth/differentiable function $f:E^{3} \to R$ with $\nabla f \neq
0$ on $S$

*As a two-dimensional submanifold of $E^{3}$. That is, a collection of points $S \subset E^{3}$ for which there exists an atlas of compatible charts $E^{2} \to S$


A surface with respect to definition 1 is also a surface with respect to definition 2. But is the converse true?
My intuition says yes. Given any surface $S$, I can imagine a function $f:E^{3} \to R$ with the property that $f(p)$ is the minimal distance from $p$ to $S$. Then $S=\{p:f(p)=0\}$. Is my intuition correct?
 A: $\newcommand{\Reals}{\mathbf{R}}$Locally the two are equivalent, but globally they're not: If $S$ is globally cut out by a non-degenerate smooth function $F$, then the non-vanishing gradient field $\nabla F$ defines an orientation of the surface. Thus, for example, a Möbius strip in $\Reals^{3}$ is not the non-degenerate zero set of a smooth function.
Separately, the distance function to the surface $S$ isn't suitable; it's not differentiable along $S$, nor is it generally differentiable everywhere off $S$. (Think of the case where $S$ is a sphere; the distance function is non-differentiable at the center.
If you ask about compact $S$ (without boundary), then yes, every smooth surface is globally a non-degenerate level set of some smooth function. Intuitively, take $F$ to be the "oriented distance" to $S$ on a sufficiently thin tube about $S$. As far as I know, this claim is non-trivial to establish rigorously. Here's a sketch:
Fix a smooth unit normal field $N$ on $S$ (which I believe requires hard topological results). For each point $x$ of $S$, define
$$
\delta(x) = \sup\{t : d(x + tN, S) = |t|\};
$$
in words, take the longest interval $I$ normal to $S$ for which the distance from a point $x + tN$ of $I$ to the surface $S$ is the absolute value of $t$. If you cover $S$ by patches on which $S$ is locally the graph of some smooth function of two variables, then $\delta$ is a continuous function in each patch and bounded away from zero. Use compactness of $S$ to extract a finite covering by such patches, then let $\delta_{0}$ be any positive number that does not exceed any of the local positive functions $\delta$. Finally, define the smooth, non-degenerate function $F$ by
$$
F(x + tN) = t
$$
(n.b., not $|t|$) on the tubular neighborhood consisting of all $x + tN$ with $|t| < \delta_{0}$, and extend $F$ to a smooth function on $\Reals^{3}$.
