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

Let $X$ be a set and $d: X \times X \to X$ be a function such that $d(a,b)=0$ if and only if $a=b$.

Suppose further that $d(a,b) ≤ d(z,a)+d(z,b)$ for all $a,b,z \in X$.

Show that $d$ is a metric on $X$.

share|cite|improve this question
Your $<$ must be $\le$. Otherwise your condition can't be true (try $z=a$). – Robert Israel Dec 2 '12 at 19:52
Welcome to math.SE: since you are new, I wanted to let you know a few things about the site. In order to get the best possible answers, it is helpful if you say in what context you encountered the problem, and what your thoughts on it are; this will prevent people from telling you things you already know, and help them give their answers at the right level. – Julian Kuelshammer Dec 2 '12 at 20:07
up vote 1 down vote accepted

The first condition of a metric is $d(a,b)\geq 0$ with equality if and only if $a=b$. Obviously that latter portion is satisfied by hypothesis. To show it is greater than zero otherwise, just observe $0=d(b,b)<d(a,b)+d(a,b)$. Thus, the first condition is satisfied.

Next, we want to show $d(a,b)=d(b,a)$. This is clear, though, since $d(a,b)\leq d(b,a)+d(b,b)=d(b,a)$ and vice versa, hence we get equality.

Finally, your last hypothesis is precisely the triangle inequality. Hence, $d$ is a metric.

share|cite|improve this answer
Thanks for your answer. Actually, I am not good at this subject, I could not understand how we exactly show d(a,b)≥0 and d(a,b)=d(b,a). – Ersin Dec 2 '12 at 20:22
When we show that $d(a,b)\geq0$, I used the "triangle" inequality of the hypothesis. That is, $$d(b,b)\leq d(a,b)+d(a,b)=2\cdot d(a,b).$$ Dividing by 2 yields $0<d(a,b)$ when $a\neq b$. Now, to show $d(a,b)=d(b,a)$, simply start with $d(a,b)$, and use the triangle inequality from the hypothesis. Then $d(a,b)\leq d(b,a)+d(b,b)=d(b,a)$. On the other hand, $d(b,a)\leq d(a,a)+d(a,b)$. Thus, $d(a,b)\leq d(b,a)\leq d(a,b)$, and so we have equality. Hope this helps! – Clayton Dec 2 '12 at 20:44
Sorry for asking so many questions but I did not understand how we can say d(b,a)≤d(a,a)+d(a,b). Thanks – Ersin Dec 2 '12 at 21:34
And how we say d(b,b)≤d(a,b)+d(a,b). – Ersin Dec 2 '12 at 21:51
That follows from the inequality that we take in the hypothesis. Simply take $z=a$ or $z=b$ depending on the direction. – Clayton Dec 2 '12 at 22:49

Let $X$ be a set and $d: X \times X \to X$ be a function such that $$d(a,b)=0\text{ if and only if}\;\; a=b,\text{ and}\tag{1}$$ $$d(a,b) ≤ d(z,a)+d(z,b)\forall a,b,z \in X.\tag{2}$$

There's additional criterion that needs to be met for a function $d$ to be a metric on $X$:

  • You must have that $d(a, b) = d(b,a)$ for all $a, b \in X$ (symmetry).

    You can use the two properties you have been given to prove this.

    $d(a,b)\leq d(b,a)+d(b,b)= d(b, a) + 0 = d(b,a)$ and vice versa, hence we get equality.

  • Having proven symmetry, you will then have that

    $d(a,b) \leq d(z,a) + d(z, b) \iff d(a, b) \leq d(a, z) + d(z, b)$.

  • Finally, using the property immediately above, along with the $(1)$, you can establish that for all $a, b\in X$ such that $a\neq b$, we must have $d(a, b) > 0$.

Then you are done.

share|cite|improve this answer
Thanks for your answer. Really helped me. – Ersin Dec 2 '12 at 22:30

This must be the discrete metric. 1) The first condition follows by definition that d(a,b)=0 iff a=b; 2) Symmetry: this is trivial, because if a=b you have d(a,b)=0 and b=a gives you d(b,a)=0; 3) The triangle inequality: from the symmetry you can write d(z,a)=d(a,z). Consider two cases: - if a=b, clear - if a is not equal to b, then either a not equal to z or z not equal to b. There you have $1\leqslant 1$ or $1\leqslant 2$.

share|cite|improve this answer
You did not prove symmetry except in the case $a=b$. And where did that $1$ and $2$ come from? – Robert Israel Dec 2 '12 at 19:55

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.