Continuous approximation of an indicator function of a closed set. For a closed set $F$ in a metric space $(S,\rho)$, define $f(x)=(1-\rho(x,F)/\epsilon)^+$. In this case, how do we show that 
$$|f(x)-f(y)| \le \rho(x,y)/\epsilon?$$
 A: If $\rho (x,F) <\epsilon$ and $\rho (y,F) <\epsilon$ then this follows easily by triangle inequality. Suppose $\rho (x,F) \geq \epsilon$. Then we have to show that $1-\frac {\rho (y,F)} {\epsilon} <\frac {\rho (x,y)} {\epsilon}$. for this take any $z \in F$ and note that $\epsilon \leq \rho (x,z) \leq \rho (x,y)+\rho (y,z)$. Take infimumm over all $z \in F$. This proves the result when $\rho (x,F) \geq \epsilon$. and a similar argument works for $\rho (y,F) \geq \epsilon$.
A: The function $t \mapsto t^+$ is Lipschitz continuous with Lipschitz constant $1$, i.e.
$$
 |t^+ - s^+| \le |t-s|
$$
for $t,s \in \Bbb R$. It follows that
$$
\begin{align}
|f(x) - f(y)|&= |(1-\rho(x,F)/\epsilon)^+ - (1-\rho(y,F)/\epsilon)^+| \\
 &\le |(1-\rho(x,F)/\epsilon) - (1-\rho(y,F)/\epsilon)| \\
& = \frac 1\epsilon |\rho(x,F) - \rho(y,F)| \, .
\end{align}
$$
So it remains to show that
$$ \\
 |\rho(x,F) - \rho(y,F)|\le  \rho(x, y)
$$
and that is a consequence of the triangle inequality, see for example Continuity of the function $x\mapsto d(x,A)$ on a metric space.
