Continuity of $\delta_E : (X, \tau_d) \rightarrow (R, \varepsilon_1): \delta_E(p) = d(p, E)$ Let $(X,d) $be a metric space and $E \subseteq X$.
We define $d(p,E) = inf \{ d(p, q)| q \in E \}$ the distance from $ p \in X$ to $E$
I have the following example in my lecture notes:
Problem:
Let $(X, d)$be a metric space and $E \subseteq X$.Now, the function
$\delta_E : (X, \tau_d) \rightarrow (R, \varepsilon_1)$ defined by  $\delta_E(p) = d(p, E)$ is continuous
Proof
Let $p_0 \in X$ and let $d_0 = \delta_E(p_0) \in \mathbb{R}$. For each $p \in X$ and $q \in E $ we have
$d(p, q)  \leq  d(p, p_0) + d(p_0,q)$ ........(1)
and $d(p_0, q) ≤ d(p_0, p) + d(p, q)$
from which
$\delta_E(p) = inf_{q \in E}d(p, q) ≤ d(p, p_0) + \delta_E(p_0)$ and $\delta_E(p_0) ≤ d(p_0, p) + \delta_E(p)$:
Therefore,  $|\delta_E(p) − \delta_E(p_0)| = |\delta_E(p) − d_0| ≤ d(p, p_0)$.
Now, given $\epsilon > 0, V_{\epsilon} = (d_0 −
\epsilon, d_0 +\epsilon) $ is the ball of center $d_0 $ and radious $\epsilon > 0 $ in $(\mathbb{R}, d_{\varepsilon})$ and $\delta_E(B(p_0, \epsilon)) \subseteq V_{\varepsilon}$, ........(2)
from which we get the continuity of $ \delta_E$.
I am having trouble understanding (1) and (2) :
(1)$\delta_E(p) = inf_{q \in E}d(p, q) ≤ d(p, p_0) + \delta_E(p_0)$
How did the last term $\delta_E(p_0)$ get here?
(2) how do they get this expresion: $\delta_E(B(p_0, \epsilon)) \subseteq V_{\varepsilon}$ ? I tried to take an element in the left set and prove it is the right one , but I am not getting anywhere. I know that to prove continuity I must show the first ball is contained in the second one
Can someone please detail what is going on?
 A: Hint for (1) Take infimum over $q$ on both sides
of the given inequality
$$d(p, q)  \leq  d(p, p_0) + d(p_0,q)$$
Use the general statement: If for every $y$ in set of real numbers $B$ there is an $x$ in set of real numbers $A$ such that $x\leq y$, then
$$ \inf A \leq \inf B.$$
Edit:  Take:
$$A = \{ d(p, q) \mid q \in E \}$$
$$B = \{ d(p, p_0) + d(p_0,q) \mid q \in E \} $$
and then note that:
$$ \inf B = d(p, p_0) + \inf \; \{  d(p_0,q) \mid q \in E \} $$
Hint for (2) From
$$|\delta_E(p) − \delta_E(p_0)|≤ d(p, p_0),$$
if $p \in B(p_0,\epsilon)$, then
$$ |\delta_E(p) -\delta_E(p_0)| ≤ d(p, p_0) < \epsilon. $$
That is
$$ \delta_E(p) \in B(\delta_E(p_0), \epsilon)=V_\epsilon $$
for all $p \in B(p_0,\epsilon)$.
A: A more clear proof:
Proof. In order to show that $\delta_E : X \to \mathbb R$ is continuous, we show that $\delta_E$ is continuous at every $p_0 \in X$, that is, we show that for all $\varepsilon>0$ there exists $\delta>0$ such that $$\delta_E(B(p_0,\delta)) \subseteq (\delta_E(p_0)-\varepsilon,\delta_E(p_0)+\varepsilon),$$ in other words, for all $\varepsilon>0$ there exists $\delta>0$ with the following property:
$$\textrm{for all $p \in X$ such that $d(p,p_0)<\delta$ we have $|\delta_E(p)-\delta_E(p_0)|<\varepsilon.$}$$
So, let $p_0 \in X$ be arbitrary, and $\varepsilon>0$ also arbitrary. We claim that $\delta := \varepsilon/2$ works. To see this, let $p \in X$ such that $d(p,p_0) < \delta$ and now note that:

*

*For any $q \in E$ we have $\delta_E(p) \leq d(p,q) \leq d(p,p_0)+d(p_0,q) < \delta +d(p_0,q)$, or,
$$\delta_E(p) - \delta < d(p_0,q)$$
meaning that the set $\{d(p_0,q) : q \in E\}$ is bounded below by $\delta_E(p) - \delta$. Now, since $\delta_E(p_0)$ is the greatest lower bound for $\{d(p_0,q) : q \in E\}$ we have $\delta_E(p) - \delta \leq \delta_E(p_0)$, i.e.
$$\delta_E(p) - \delta_E(p_0) \leq \delta < \varepsilon.$$


*Similarly we can obtain the other inequality: $-\varepsilon < \delta_E(p) - \delta_E(p_0)$.
