Let $(M,d)$ be a metric space and let $X$ be a subset of $M$. If $x$ is in $M$, we define $$d(x,X) = \inf \{d(x,y) | y\in X\}$$ Prove that $f(x) = d(x,X)$ is continuous on $M$.
I believe we have to show the triangle inequality but I am getting stuck as to what exactly I'm supposed to show. Any help would be appreciated!
$f(u)\leq d(u,x)\leq d(u,v)+d(v,x)$ for each $x\in X$.
Consequently $f(u)\leq d(u,v)+f(v)$.
Of course $u$ and $v$ can be switched here, so finally you end up with...: