Suppose $\Omega$ is a subset of $\mathbb{R}^n$ with smooth boundary, $\partial\Omega$. Let’s define the function,

which gives the distance from a point to the boundary of the region.

Let’s assume that the gradient of $g(x)$ is defined almost everywhere and show that it has magnitude one. This will also apply to the signed distance function which is positive inside $\Omega$ and negative outside (or the opposite, depending on convention). The signed distance function is used in the level set method and the PDE, $|Dg|=1$, is an instance of the eikonal equation.

First let’s choose some $x$ and suppose that $y^* = \text{arg}\min_{y \in \partial\Omega} |x-y|$ is unique.

Now let’s consider the line segment, $(1-t)x + ty^*$. Along this segment,

but on the other hand, the inequality,

yields the result,

So, we have that $g\left( (1-t)x + ty^*\right) = (1-t)g(x)$ where by taking derivatives with respect to $t$, we obtain the relation,

which says that

… or since $|y^* - x| = g(x)$,

Now note that when $t=0$, $Dg(x)$, points in the direction of maximal increase while points from $x$ to the closest point on the boundary, . However, the direction, , is clearly in the direction of maximum decrease since otherwise, would not be the minimizing point on the boundary. Therefore, $y^*-x = -Dg(x)$, so $\cos\theta = -1$, which must therefore hold for all $t \in [0,1]$.

So, we’ve shown that for any point, $x$, not on the boundary, if there is a unique closest point to the boundary, then we have,