# If $(X, d)$ is a metric space and $a \in X$, prove $f : (X, d) \to \mathbb{R}$ defined by $f(x) = d(x, a)$ is continuous

If $(X, d)$ is a metric space and $a \in X$, prove $f : (X, d) \to \mathbb{R}$ defined by $f(x) = d(x, a)$ is continuous

My Attempt at a Proof

Recall that a function $f : (X, d_x) \to (Y, d_y)$ is continuous if for each $x \in X$ and $\epsilon > 0$, there exists a $\delta > 0$ such that $$d_X(x, y) < \delta \implies d_Y(f(x), f(y)) < \epsilon$$

So let $\epsilon > 0$ be given and pick $x, y \in X$.

Suppose that $d_Y((f(x), f(y)) < \epsilon$, then we have $d_Y\left(d_X(x, a), d_X(y, a)\right) < \epsilon \implies |d_X(x, a) - d_X(y, a)| < \epsilon \implies |d_X(x, y) - 2d_X(a, y)| < \epsilon$ (by the triangle inequality)

But that was as far as I got, I need to algebraically manipulate $|d_X(x, y) - 2d_X(a, y)| < \epsilon$ into the form $|d_X(x, y)| = d_X(x, y) < \delta$ which would allow me to find a $\delta > 0$ that works for the given $\epsilon$, but I'm not sure how to go about doing that.

• You're going backwards. Assuming $d_Y((f(x),f(y)) < \epsilon$ and manipulating to get $d_X(x,y) < \delta$ (where $\delta$ is a some expression in terms of $\epsilon$) does not quite give you continuity, because you need the opposite implication. Try starting with $d_X(x,y) < \delta$, then manipulate using the triangle inequality to get $d_Y(f(x), f(y)) < \epsilon$ where $\epsilon$ is a function of $\delta$ which limits to 0 as $\delta \to 0$ (or at least can be made arbitrarily small by choosing small enough $\delta$).
– nkm
Mar 28 '17 at 23:26

What you are looking for is the reverse triangle inequality

$$|d(x,a)-d(y,a)| \le d(x,y),$$

which is a direct consequence of the triangle inequality

$$d(x,y)\le d(x,z) + d(y,z) .$$

The range is the line. Write $|a-b|$ instead of $d_Y(a,b)$.

You want to prove that $d_X(x,y) < \delta$ implies $|f(x) - f(y)| < \epsilon$, yet your argument begins with "suppose that $|f(x) - f(y)| < \epsilon$". There is no proof method where you are allowed to start by assuming what you need to prove.

The triangle inequality gives you $d_X(x,a) \le d_X(y,a) + d_X(x,y)$ so that $f(x) - f(y) \le d(x,y)$. Exchange the roles of $x$ and $y$ and use the symmetry of the metric to get $f(y) - f(x) \le d_X(y,x) = d_X(x,y)$ too. Combined these give you $$|f(x) - f(y)| \le d_X(x,y).$$ Thus given $\epsilon > 0$ you can take $\delta = \epsilon$.

The triangle inequality tell us that $$d(x,a) - d(y,a) \leq d(x,y)$$ and $$d(y,a) - d(x,a) \leq d(y,x) = d(x,y).$$

Thus

$$\vert d(x,a) - d(y,a) \vert \leq d(y,x).$$

From triangle inequality $d(x, a) \leq d(x, y) + d(y, a)$ so (after a bit of algebra and symmetry) $|d(x, a) - d(y, a)| \leq d(x, y).$ QED