Let $A\subseteq\mathbb{R}$ and let $x\in\mathbb{R}$
Define $d(x,A)=\inf\{|x-a|;a\in A\}$
Now let $y\in\mathbb{R}$.
I want to show: $$|d(x,A)-d(y,A)|\le d(x,y)$$
My first approach was to take 4 cases:
$(1)\space x,y\in A$
$(2)\space x\in A, y\not\in A$
$(3)\space y\in A, x\not\in A$
$(4)\space x,y \not\in A$
The first three cases are fairly easy to solve for, but the last one is giving me a hard time.
Any tips?
Let $a\in A$. Then $|x-a|\leqslant|x-y|+|y-a|$ and therefore$$d(x,A)\leqslant|x-a|\leqslant|x-y|+|y-a|.$$Since this inequality takes place for each $a\in A$,\begin{align}d(x,A)&\leqslant\inf_{a\in A}|x-y|+|y-a|\\&=|x-y|+\inf_{a\in A}|y-a|\\&=|x-y|+d(y,A).\end{align}In other words,$$d(x,A)-d(y,A)\leqslant|x-y|,\tag1$$and, by the same argument$$d(y,A)-d(x,A)\leqslant|x-y|.\tag2$$But $(1)$ and $(2)$ together mean that $\bigl|d(x,A)-d(y,A)\bigr|\leqslant|x-y|$.