Signed Distance Function and the Eikonal Equation If $\Omega$ is a subset of a matric space $X$ with metric, $d$, then the signed distance function $f$, is defined by $f(x) =  \begin{cases} 
     d(x, \partial \Omega) & x \in \Omega\\
      -d(x, \partial \Omega) & x \in \Omega^c \\
   \end{cases}$
where $\partial \Omega$ denotes the boundary of $\Omega$, and $d(x, \partial \Omega)  =\inf_{y \in \partial \Omega}d(x,y)$
Wikipedia states here, that if $\Omega$ is a subset of $\mathbb{R}^n$ with piecewise smooth boundary, then the signed distance function is differentiable almost everywhere, and its gradient satisfies the Eikonal equation
$|| \nabla f ||  = 1$
I'm not sure why this equation holds.
For instance, if we are in three dimensional space, and we wish to do this for a sphere, 
If the point is inside the sphere, we take a line from the centre of the sphere 
to the point and intersect it with the sphere, and then take the negative distance between the intersection point and our input point. 
If the point is outside the sphere, we take the difference between 
1) the point's distance to the centre of the sphere 
2) consider the ray from the centre of the sphere to the point, and take the length of the subray starting from the centre where the endpoint intersects the surface of the sphere. 
It's not clear to me why this function would have its gradient's norm equal to $1$.
Any insights appreciated.
 A: For simplicity, consider $\Omega\subseteq\mathbb{R}^n$, with which we benefit from the fact that the geodesic between any two given points is a line segment.
First, let us show that $\left\|\nabla f\right\|\le 1$. $\forall\,x,y\in\Omega$ with $\left\{x+t\left(y-x\right):t\in\left[0,1\right]\right\}\subseteq\Omega$, obviously we have the triangle inequality
$$
f(y)\le\left\|y-x\right\|+f(x).
$$
This is because its left-hand side is the distance between $y$ and $\partial\Omega$, while its right-hand side is the sum of the distance between $x$ and $y$ and the distance between $x$ and $\partial\Omega$. This inequality implies
$$
\left\|\nabla f\right\|\le 1.
$$
This can be seen as one replaces $y$ with $x+at$ for some $a\in\mathbb{R}^n$, i.e.,
$$
\frac{f(x+at)-f(x)}{t}\le\left\|a\right\|,
$$
and takes $t\to 0$, i.e.,
$$
a\cdot\nabla f\le\left\|a\right\|;
$$
the arbitrariness of $a$ leads to $\left\|\nabla f\right\|\le 1$.
Second, let us show that $\left\|\nabla f\right\|\ge 1$. Given $x\in\Omega$, suppose $\left\{y(t):t\in\left[0,1\right],y(0)=x,y(1)\in\partial\Omega\right\}$ is the shortest path between $x$ and $\partial\Omega$. Then we have, $\forall\,t\in\left[0,1\right]$,
$$
f(y(t))=\int_t^1\left\|\dot{y}(t)\right\|{\rm d}t.
$$
That is, as $y(t)$ falls on the shortest path between $x$ and $\partial\Omega$, the distance between $y(t)$ and $\partial\Omega$ (i.e., its left-hand side) must be the length of the path segment between $y(t)$ and $\partial\Omega$ (i.e., its right-hand side, as an integral of speed with respect to time). Therefore, the $t$-derivative of this equality yields
$$
\dot{y}(t)\cdot\nabla f(y(t))=-\left\|\dot{y}(t)\right\|.
$$
Then Schwarz inequality implies
$$
\left\|\nabla f(y(t))\right\|\ge 1.
$$
Taking $t=0$, the arbitrariness of $x\in\Omega$ leads to
$$
\left\|\nabla f\right\|\ge 1.
$$
Finally, combine the above two facts, and we eventually obtain
$$
\left\|\nabla f\right\|=1.
$$
[Note that this argument is merely conceptual. Assumptions like compact and simply-connected $\Omega$, and differentiable $f$ are made for simplicity.]
