# Functions in a metric space.

### Question

Let $(X, d)$ be a metric space. For each $a \in X$, define a function $f_a\colon X \to \mathbb R$ by $f_a(x) = d(x, a), (x ∈ X)$.

Prove that for all $a, b \in X$ $$\sup\{|f_a(x) − f_b(x)| : x \in X\} = d(a,b).$$

I know I have to prove that d(a,b) is a least upper bound but I am unsure how to go about doing it.

-
It is interesting that no answer so far mentioned that this is nothing but the reverse triangle inequality... – t.b. Apr 17 '12 at 19:41

we have by the triangle inequality $f_a(x) = d(x,a) \le d(a,b) + d(x,b) = d(a,b) + f_b(x) \iff f_a(x) - f_b(x) \le d(a,b)$ and $f_b(x) = d(x,b) \le d(a,b) + d(x,a) = d(a,b) + f_a(x) \iff f_b(x) - f_a(x) \le d(a,b)$ which together shows that $d(a,b)$ is an upper bound. But now $f_b(a) - f_a(a) = d(a,b)$, so it's attained and therefore the least upper bound,

-

Let $a,b\in X$. We have for $x\in X$ that $d(a,x)\leq d(a,b)+d(b,x)=$ so $f_a(x)\leq d(a,b)+f_b(x)$ and $f_a(x)-f_b(x)\leq d(a,b)$. Switching $a$ and $b$ we get that $|f_a(x)-f_b(x)|\leq d(a,b)$ so $\sup_{x\in X}|f_a(x)-f_b(x)|\leq d(a,b)$. Taking $x=b$, we see that this supremum is in fact a maximum, equal to $d(a,b)$.

-

As you said, you need to prove d(a,b) is the least upper bound,

You will need to prove 2 things :

1) d(a,b) is an upper bound, ie:

$\forall x\in X, |f_a(x) - f_b(x)| <= d(a,b)$

What property of metric space you can use to prove that?

2) d(a,b) is the least upper bound. You can prove that

$\exists x\in X, |f_a(x) - f_b(x)| = d(a,b)$

Can you choose an x satisfies above?

-

$|f_a(x)-f_b(x)|=|d(x,a)-d(x,b)|$; clearly this is $d(a,b)$ when $x=b$. Suppose that there is some $x\in X$ such that $|d(x,a)-d(x,b)|>d(a,b)$; then either $d(x,a)-d(x,b)>d(a,b)$ or $d(x,b)-d(x,a)>d(a,b)$. Without loss of generality assume that $d(x,a)-d(x,b)>d(a,b)$. Then $d(x,a)>d(x,b)+d(b,a)$, contradicting the triangle inequality. Thus, $|f_a(x)-f_b(x)|\le d(a,b)$ for all $x\in X$, with equality when $x=b$, and the result is immediate.

-