TITLE: The distance function is continuous.
QUESTION [5 upvotes]: Let $S\subset\Bbb R$ not empty, define $f:\Bbb R\rightarrow\Bbb R$ such that $f(x)=
\inf\{|x-s| ;s\in S\}$ 
then, prove that  $|f(x)-f(y)|\le|x-y| $ for any $x,y \in \Bbb R$

REPLY [6 votes]: $|x - s| \le |x - y| + |y - s|$ for every $s \in S$.
Hence $f(x) \le |x - y| + f(y)$.
Similarly $f(y) \le |x - y| + f(x)$.
Hence $|f(x) - f(y)| \le |x - y|$.