Distance from Point to Subset is Continuous Function

Theorem
Let $M = \left({X, d}\right)$ be a metric space.

Let $A \subseteq X$ be a non-empty subset of $X$.

Let $f: X \to \R$ be the function defined as:
 * $\forall x \in X: f \left({x}\right) = d \left({x, A}\right)$

where $d \left({x, A}\right)$ denotes the distance from $x$ to $A$.

Then $f$ is continuous.

Proof
$\forall x, y \in X, \forall z \in A$, by the definition of the distance from $x$ to $A$, we have:
 * $d \left({x, A}\right) \le d\left({x, z}\right) \le d \left({x, y}\right) + d \left({y, z}\right)$

Taking inf to above inequality, we get:
 * $d \left({x, A}\right) \le d \left({x, y}\right) + d \left({y, A}\right)$

Similarly, we have:
 * $d \left({y, A}\right) \le d \left({x, y}\right) + d \left({x, A}\right)$

Therefore:
 * $\left\Vert{d \left({x, A}\right)-d \left({y, A}\right)}\right\Vert \le d \left({x, y}\right)$

We can conclude that $f$ is continuous.