Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can we impose such condition on function $f:\mathbb{R}\rightarrow \mathbb{R}$ so that $(a,b)\mapsto | f(a) - f(b)|$ generates a metric on $\mathbb{R}$?

This question came into my mind when I was working on problem $(a,b)\mapsto | e^{a} - e^{b}|$ is a metric on $\mathbb{R}$. I guess this can be done by taking injective function $f$. But I am not sure whether this will work or not. Certainly, this will help everyone in dealing with such kind of problems. I need help with this.

Thank you very much.

share|cite|improve this question
I think you just need strictly monotonic. – copper.hat Jun 7 '12 at 7:27
@copper.hat Can we take strictly monotonicity as a necessary and sufficient condition? – srijan Jun 7 '12 at 7:31
@copper.hat: Why do you need Strict monotonicity? Isn't just injective $f$ sufficient? – Ashok Jun 7 '12 at 7:46
for $\mathbb{R} \to \mathbb{R}$ injective and strict monotonic are equivalent. – copper.hat Jun 7 '12 at 8:27
@copper.hat: This is false, e.g. $f(0)=1$, $f(1)=0$, $f(x)=x$ otherwise. – Chris Eagle Jun 7 '12 at 9:55
up vote 11 down vote accepted

Let $f:\Bbb R\to\Bbb R$, and for $x,y\in\Bbb R$ define $d(x,y)=|f(x)-f(y)|$.

First note that for any function $f:\Bbb R\to\Bbb R$ and $x,y,z\in\Bbb R$ we have $$\begin{align*} |f(x)-f(y)|&=\left|\big(f(x)-f(z)\big)+\big(f(z)-f(y)\big)\right|\\ &\le|f(x)-f(z)|+|f(z)-f(y)|\;, \end{align*}$$

so $d$ always satisfies the triangle inequality. It’s also clear that $d(x,x)=0$ for all $x\in\Bbb R$ and that $d$ is symmetric no matter what $f$ we use. Thus, $d$ is always a pseudometric on $\Bbb R$. Finally, in order for $d$ to separate points, so that it’s necessary and sufficient that $f$ be injective: that ensures that if $x\ne y$, then $f(x)\ne f(y)$ and hence $d(x,y)\ne 0$. The function $f$ need not be nice in any other way.

For example, you could use the following function:

$$f(x)=\begin{cases} \tan^{-1}x,&\text{if }x\in\Bbb Q\\ \tan^{-1}(x+1),&\text{if }x\in\Bbb R\setminus\Bbb Q\;. \end{cases}$$

It’s discontinuous at every point, and it’s not surjective, but it is injective, and that’s all that matters.

share|cite|improve this answer
Sir, i think by mistake you have written $\mid f(z) - f(z) \mid$. I can't edit. – srijan Jun 7 '12 at 7:45
@srijan: Thanks; you’re right. – Brian M. Scott Jun 7 '12 at 7:46
Sincerely thanks to you sir. I got a very useful result today.:) – srijan Jun 7 '12 at 7:47
So, here $\mathbb R$ is a set, it could be any set. The other interpretation of "a metric on $\mathbb R$" would be where $\mathbb R$ is a topological space. So we want conditions on $f$ that make $|f(x)-f(y)|$ a metric for the usual topology. – GEdgar Jun 7 '12 at 12:24

It is necessary and sufficient that $f$ be injective. If $f$ is injective, then $|f(a)-f(b)|=0$ iff $a=b$, and otherwise we have some $a\neq b$ such that $|f(a)-f(b)|=0$. Clearly $|f(a)-f(b)|=|f(b)-f(a)|$, so it remains to check the triangle inequality. But this follows from just applying the triangle inequality for $|\cdot |$, so $f$ gives you a metric.

share|cite|improve this answer
Thank you very much. – srijan Jun 7 '12 at 7:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.