# prove that the map is a metric

we have the following map:

$d(x,y) = |x_2 - y_2|~~~~~~~~$ if $x_1 = y_1$

and $= |x_2| + |y_2| + |x_1 - y_1| ~~~~~~~$ if $x_1 \neq y_1$

where $x = (x_1,x_2)~~and~~y = (y_1,y_2)$

we have to prove that the above is a metric space on $R^2$,

I have already proved the first two axioms and the cases of the third where: $x_1 = y_1 = z_1$, and $z_1 \neq x_1$ and $x1 \neq y_1 \neq z_1$,

what's left are the case where $x_1 \neq y_1, z_1 = x_1$ and the other case where $x_1 \neq y_1, z_1 = y_1$

$z = (z_1,z_2)$ a third point I introduced.

I know i'm supposed to use the triangle inequality during the steps, but i'm totally stuck= at these last two cases.

I'd be thankful for any sort of help

• Triangle inequality. – jacob smith Sep 27 '16 at 22:00
• It might be useful to remember that $|x_2| = |x_2 - 0|$. Try writing out both sides of the triangle inequality you are trying to prove and group things that look/are similar together. – Mosquite Sep 27 '16 at 22:02
• I tried using this technique, didn't get to somewhere useful – user368063 Sep 27 '16 at 22:04
• Known as the River Metric: The river is $R\times \{0\}$. Lines $\{u\}\times R$ and $\{v\}\times R,$ with $u\ne v ,$ are separated by mountains. To get from $(u,u')$ to $(v,v')$ when $u\ne v$ you must travel in a straight line from $(u,u')$ to $(u,0),$ then travel along the river to $(v,0),$ then travel in a straight line from $(v,0)$ to $(v,v').$ – DanielWainfleet Oct 3 '16 at 5:29

$d(x,y) = \begin {cases} |x_1-y_1| + |x_2-y_2| & x_1 = y_1\\ |x_1-y_1| + |x_2|+|y_2| & x \ne y\end{cases}$

Notice that I have changed the definition slighlty, but that it doesn't really change anything

We must show that $d(x,z) \le d(x,y)+d(y,z)$

You have already done the case where $x_1 = y_1 = z_1$

$|x_1-z_1| + |x_2-z_2| \le |x_1-y_1| +|y_1-z_1| + |x_2-y_2|+|y_2-z_2|$

notice that: $|x_1-y_1| + |x_2-y_2| \le|x_1-y_1| + |x_2|+|y_2|$

Case $1: x_1 = z_1 \ne y_1$

$d(x,y) + d(y,z) = |x_1-y_1| +|y_1-z_1| + |x_2|+|y_2|+|y_2|+|z_2|$ $|x_1-y_1| +|y_1-z_1| + |x_2-y_2|+|y_2-z_2| \le d(x,y) + d(y,z)$

And you have already shown that $d(x,z) \le |x_1-y_1| +|y_1-z_1| + |x_2-y_2|+|y_2-z_2|$

Case $3: x_1 = y_1 \ne z_1,$

$d(x,y) + d(y,z) = |x_1-y_1| +|y_1-z_1| + |x_2-y_2|+|y_2|+|z_2|$

$|x_2|-|y_2| \le |x_2-y_2|$

$|x_1-y_1| +|y_1-z_1| + |x_2|+|z_2| \le d(x,y) + d(y,z)$

$|x_1-z_1| \le |x_1-y_1| +|y_1-z_1|$

$d(x,z)\le d(x,y) + d(y,z)$

Case $2: y_1 = z_1 \ne x_1,$

$d(x,y) + d(y,z) = |x_1-y_1| +|y_1-z_1| + |x_2| + |y_2|+|y_2 - z_2|\\ |z_2|-|y_2|\le |y_2 - z_2|$ $|x_1-y_1| +|y_1-z_1| + |x_2| + |z_2| \le d(x,y)+d(y,z)$

$|x_1-z_1| \le |x_1-y_1| +|y_1-z_1|$

$d(x,z) \le d(x,y)+d(y,z)$

Suppose that $x_1 \neq y_1$ and also $z_1 = x_1$.

$d(x,y) = |x_2|+|y_2|+|x_1-y_1|$

$d(x,z) = |x_2-z_2|$

$d(y,z) = |y_2|+|z_2|+|y_1-z_1|$

Recall that $|x_2|-|z_2| \leq |x_2-z_2|$ from the triangle inequality (the left side). Then $|x_2| \leq |x_2-z_2|+|z_2|$ so using this you get $d(x,y) = |x_2|+|y_2|+|x_1-y_1| \leq |x_2-z_2|+|z_2| +|y_2|+|x_1 -y_1|$ but as in this case $x_1 = z_1$ substitute $x_1$ for $z_1$ in the last term and you get the result.

• you're welcome, you can mark it as answered now! – Joaquin San Sep 28 '16 at 0:10