Prove the triangle inequality for $d(x,y) = \min(|x−y|,1−|x−y|)$. Let $X$ be the set $[0,1)$. Define a non-standard metric on X as follows: For two numbers $x,y ∈ X$, take $d(x,y) = \min(|x−y|,1−|x−y|)$. Show that this is a metric.
In order to show this is a metric, I need to prove the triangle inequality for the metric. That is, for any $x, y, z \in X,\quad d(x,z) \le d(x,y)+d(y,z)$.
I try to prove this with the inequality $|x-y|+|y-z|\ge|x-z|$, but I was lost when I reached the case: $d(x,z)=|x-z|,\,d(x,y)=|x-y|,\,d(y,z)=1-|y-z|$.
Could anyone give some hints?
 A: We want 
$$d(x,z)\leq d(x,y)+d(y,z)\quad \forall x,y,z\in[0,1)$$
There are $2^3=8$ possible combinations. 
1) If $d(x,z)=|x-z|$, $d(x,y)=|x-y|$, $d(y,z)=|y-z|$  this is obvious.
2) If $d(x,z)=|x-z|$, $d(x,y)=1-|x-y|$, $d(y,z)=|y-z|$ then
$$d(x,z)=|x-z|\leq 1-|x-z|\leq 1-\left[|x-y|-|y-z|\right]=d(x,y)+d(y,z)$$
3)  If $d(x,z)=|x-z|$, $d(x,y)=|x-y|$, $d(y,z)=1-|y-z|$ the argument is similar to case 2.
4) If $d(x,z)=|x-z|$, $d(x,y)=1-|x-y|$, $d(y,z)=1-|y-z|$ then
we have that $|x-z|\leq 1/2$ while $|x-y|\geq 1/2$ and $|y-z|\geq 1/2$. This can only happen if $y\notin [\min\{x,z\},\max\{y,z\}]$. Then either
$$ |x-y|+|y-z|+|z-x|=|x-y|+|y-x|=2|y-x|\leq 2$$
or
$$ |x-y|+|y-z|+|z-x|=|y-z|+|y-z|=2|y-z|\leq 2$$
that also yields the desired inequality.
5) If $d(x,z)=1-|x-z|$, $d(x,y)=|x-y|$, $d(y,z)=|y-z|$ then
$$d(x,z)\leq |x-z|\leq |x-y|+|y-z|=d(x,y)+d(y,z)$$
6) If $d(x,z)=1-|x-z|$, $d(x,y)=1-|x-y|$, $d(y,z)=|y-z|$ then
$$d(x,z)=1- |x-z|\leq 1-[|x-y|-|y-z|]=d(x,y)+d(y,z)$$
7) If $d(x,z)=1-|x-z|$, $d(x,y)=|x-y|$, $d(y,z)=1-|y-z|$ then similar to 6.
8)  If $d(x,z)=1-|x-z|$, $d(x,y)=1-|x-y|$, $d(y,z)=1-|y-z|$ then $|x-y|\geq 1/2$, $|y-z|\geq 1/2$, $|x-z|\geq 1/2$. We will prove that this is not a valid possibility. 
In this case $y\notin[[\min\{x,z\},\max\{y,z\}]$ or else $|x-z|\geq 1$(contradiction). So either $y<\min\{x,z\}$ or $y>\max\{x,z\}$. If the former is true then $|y-\max\{x,z\}|=|y-\min\{x,z\}|+|\min\{x,z\}-\max\{x,z\}|\geq \frac{1}{2}+\frac{1}{2}=1$ (contradiction). Similarly, for the other case.
