Criteria for metric on a set 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$.
 A: 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.

A: 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.
A: 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$.
