# Which properties must a function, $f$, fulfill for $d(x,y)=|f(x)-f(y)|$ to be a metric

I have two questions I need to answer:

Let $\mathbb{X}$ be a set and $f : \mathbb{X} \rightarrow \mathbb{R}$ a function. Define $$d : \mathbb{X} \times \mathbb{X} \rightarrow \mathbb{R}, ~d(x,y) = |f(x) - f(y)|$$ State which properties $f$ must fulfill in order for $d$ to be a metric, and prove that they are suffecient and necessary.

The only property I am certain that $f$ must have, is that $f$ must be injective. This is to ensures that $d(x,y) = 0 \Leftrightarrow x = y$. I'm having trouble finding out how to show that this must be true though and that you don't need anything else, but I assume that it simply involves showing that it injective functions also make $d$ fulfill all the other requirements for $d$ to be a metric (triangle inequality, non-negativity and symmetry). Non-negativity and symmetry is obvious since $d$ is the absolute value of the difference between $f(x)$ and $f(y)$. I assume that the triangle inequality is equally simple.

Given points $u, v, w, x$ in a metric space $(\mathbb{X}, d)$ prove that $$|d(u,v) - d(w, x)| \leq d(u, w) + d(v, x)$$ Use this result to prove that for sequences $\{x_n\}$, $\{y_n\}$ in $\mathbb{X}$ with $\lim_{n\rightarrow \infty}x_n = x \in \mathbb{X}$, $\lim_{n\rightarrow \infty}y_n = y \in \mathbb{X}$ it holds $$\lim_{n\rightarrow \infty}d(x_n, y_n) = d(x, y)$$

I'm assuming this is bascially using the triangle inequality to show the first part.

What I'm really asking is for hints on how to formulate the proofs, not the proofs themselves.

You’ve nearly answered the first question; all that remains is to verify the triangle inequality, which boils down to showing that for all $x,y,z\in\Bbb X$,

$$|f(x)-f(y)|\le|f(x)-f(z)|+|f(z)-f(y)|\,$$

which should be very straightforward. For the actual write-up, I suggest first proving that $d$ separates points iff $f$ is injective. If $f$ is injective, it’s clear that $d(x,y)=0$ iff $x=y$. If $f$ is not injective, suppose that $x$ and $y$ are distinct points of $\Bbb X$ such that $f(x)=f(y)$, and observe that in that case $d(x,y)=0$. Then just go ahead and prove that for any $f$ at all, $d$ has the other properties required of a metric. When you’ve done all that, you’ve exactly what’s required.

You’re right that the triangle inequality is used to show the first part of the second question; don’t forget to consider both possibilities, $d(u,v)\le d(w,x)$ and $d(w,x)\le d(u,v)$. Write that up as a separate argument, so that you can simply appeal to the result when you get to the second part.

For the second part, you want to proceed as for most any proof requiring that you show that some point is the limit of some sequence: let $\epsilon>0$ be arbitrary, and show that you can find an $m_\epsilon\in\Bbb N$ such that

$$|d(x_n,y_n)-d(x,y)|<\epsilon\tag{1}$$

whenever $n\ge m_\epsilon$. You can apply the first part directly here, using what you know about the sequences $\langle x_n:n\in\Bbb N\rangle$ and $\langle y_n:n\in\Bbb N\rangle$.

• I was considering just writing out $\forall \epsilon : \exists n_0 \in \mathbb{N} : \forall n \leq n_0 : |d(x_n, y_n) - d(x, y)| < \epsilon$ and go from there. If I'm reading you right, that's also what you're saying I should do. Oct 9 '14 at 22:47
• @Clearer: No, that’s backwards: starting with an arbitrary $\epsilon>0$, you need to prove that there is such an $n_0$. You’ll do that by using the result from the first part of the problem together with the convergence of the $x_n$’s and $y_n$’s to $x$ and $y$, respectively Oct 9 '14 at 22:54
• I'm struggling a bit with this. Is $|d(x,y) - \sum_i=1^n d(x_i, y_i) | < \epsilon$ relevant? Oct 10 '14 at 9:23
• @Clearer: There’s no reason to look at that sum. Here’s a further hint: you know that there are $n_1,n_2\in\Bbb N$ such that $d(x_n,x)<\frac{\epsilon}2$ whenever $n\ge n_1$ and $d(y_n,y)<\frac{\epsilon}2$ whenever $n\ge n_2$. Take $n_0=\max\{n_1,n_2\}$. Apply the first part to $(1)$ with $u=x_n,v=y_n$, etc. and consider what these two inequalities imply if $n\ge n_0$. Oct 10 '14 at 17:30
• So, I should just arrive at $|d(x_n,y_n) - d(x,y)| \leq d(x_n,x) + d(y_n,y) < \epsilon$? Oct 10 '14 at 20:44

For the first question you can try to apply the triangle inequality for real numbers to $f(x)-f(z)$ and $f(z)-f(y)$ (i.e. for real numbers $|a+b|\le |a|+|b|$).

For the second question, first assume that $d(u,v)\ge d(w,x)$, such that you can remove the absolute value, and the statement you want to prove is then $d(u,v)\le d(u,w)+d(w,x)+d(v,x)$, which is the triangle inequality applied twice. For $d(u,v)<d(w,x)$ you will instead have to replace the absolute value by a minus sign, and then you can do something similar as in the first case. To prove the part about the limit, try to use the result for $|d(x_n,y_n)-d(x,y)|$.

• I was thinking along those lines. Oct 9 '14 at 22:42