I have to prove that a sphere centered at $x_0$ with radius $r$
$S(x_0,r) = \{x \in X | d(x,x_0) = r\}$
is a closed set.
I know I should prove that the complement is open. If I take a point $y$ inside the complement and consider the open ball with radius $\epsilon = \frac{d-r}{2}$ where $d$ is the distance from $x_0$ to $y$ I have to show that the distance $d(x_0,y) > r$. This is where I am stuck. I thought about using the triangle inequality, but I am sure how to proceed. Any help would be greatly appreicated.
Take $y$ in the complement of your sphere, $S(x_0, r)^c$.
If $y$ is inside the sphere, meaning $d(x_0, y) < r$, then consider $\varepsilon = r - d(x_0, y) > 0$ and the open ball $B(y, \varepsilon)$.
For $z \in B(y, \varepsilon)$ we have
$$d(x_0, z) \le d(x_0, y) + d(y,z) < d(x_0, y) + r - d(x_0, y) = r $$
Hence $B(y, \varepsilon) \subseteq S(x_0, r)^c$.
If $y$ is on the outside of the sphere, meaning $d(x_0, y) > r$, then consider $\varepsilon = d(x_0, y) -r > 0$ and the open ball $B(y, \varepsilon)$.
For $z \in B(y, \varepsilon)$ we have
$$d(x_0, y) \le d(x_0, z) + d(y,z) \implies d(x_0, z) \ge d(x_0, y) - d(y,z) > d(x_0, y)- d(x_0, r) +r= r $$
Hence $B(y, \varepsilon) \subseteq S(x_0, r)^c$.
$\therefore$ in any case we have, for all $y\in S(x_0,r)^c$, there exists $\varepsilon>0$ such that $B(x_0,\varepsilon)\subseteq S(x_0,r)^c$.
So, $S(x_0, r)^c$ is open which implies that $S(x_0, r)$ is closed.