I have a very simple question regarding proof of the distance metric d(x,A). Given non empty subset of $\mathbb R^n$ $A$ and $\forall x \in \mathbb R^n$, $ f(x) = inf\{d(x,a):a\in A\}$. Prove $f(x)$ is continuous.
Prove sited here starts of with taking two points x and y and arbitrary $a\in A$ and via triangle inequality:
(1) $d(x,a)\leqslant d(x,y)+d(y,a)$.
Then by taking infimum over a, the previous equation is:
(2) $d(x,A)\leqslant d(x,y)+d(y,A)$ and so on.
I have problem with this last step. It is not obvious to me how it is possible to go from step (1) to step (2)? Why does going from $d(x,a)$ to $d(x,A)$ and from $d(y,a)$ to $d(y,A)$ preserve inequality in (1)?
Any help to clarify this problem is hugely appreciated.