# Is $d_1(x,y)=2|x-y|$ a metric space?

Im trying to check if $d_1(x,y)=2|x-y|$ and $d_2(x,y)=|x-y|^2$ are metric spaces.

Im just not sure how to proceed with checking the triangle inequality property $d(x,y)\le d(x,z)+d(z,y)$. Is what I did below sufficient?

$d(x,y) = 2|x-y| =2|x-z+z-y| \le 2|x-z|+2|z-y| = d(x,z)+d(z,y)\\ \text{and} \\ d(x,y)=|x-y|^2=|x-z+z-y|^2\le |x-z|^2+|z-y|^2=d(x,z)+d(z,y)?$

Also is $d(x,y)=|\arctan(x)-\arctan(y)|$a metric space? Can I write

$d(x,y)=|\arctan(x)-\arctan(y)| = |\arctan(x)-\arctan(z)+\arctan(z)-\arctan(y)| \le |\arctan(x)-\arctan(z)|+|\arctan(z)-\arctan(y)|$

-
Why $|x-y|^2=|x-z+z-y|^2\le |x-z|^2+|z-y|^2$? – user17762 May 17 '12 at 22:10
If you have trouble proving the inequality Marvis asked about, you might want to consider some particular choices of $x$, $y$, and $z$. – Jonas Meyer May 17 '12 at 22:14
Let $a=0$, $b=1$, $c=2$ (this is for the square part). – André Nicolas May 17 '12 at 22:14
For the $2|x-y|$ part, let's do $3|x-y|$ instead. Alicia measures in yards, and Beti measures in feet. – André Nicolas May 17 '12 at 22:22
André means that changing the distance function from $|x-y|$ to $3|x-y|$ is like changing the units of measurement from yards to feet: it just multiplies everything by $3$. Thus, if one works as a metric, the other must as well. – Brian M. Scott May 17 '12 at 22:32

Clearly the function $d(x,y)=|\arctan(x)-\arctan(y)|$ is symmetric and non-negative. The arctangent function is a bijection from $\Bbb R$ to $\left(-\frac{\pi}2,\frac{\pi}2\right)$, so in particular it’s injective, and $d(x,y)=0$ iff $x=y$. Thus, it only remains to check the triangle inequality, i.e., to check that

$$|\arctan(x)-\arctan(y)|\le|\arctan(x)-\arctan(z)|+|\arctan(z)-\arctan(y)|$$ for all $x,y,z\in\Bbb R$. But this is just the triangle inequality for the absolute value, so it’s true.

-
Thanks, most grateful. In general, if $d(x,y)$ involves just the absolution values and no squares or cubes etc., does the triangle inequality hold property hold? i.e. if $d(x,y) = |x^3|$ or $d(x,y) = |x^3-y^3|$ etc.? And it does not involve for example squares $d(x,y) = |x-y|^2$? – Steven May 17 '12 at 23:16
@Steven: If you just have $d(x,y)=|f(x)-f(y)|$, the triangle inequality will always hold, because it reduces to the ordinary one for absolute value. However, if $f$ is not injective you’ll have distinct points $x$ and $y$ with $d(x,y)=0$, so you won’t have a metric. – Brian M. Scott May 17 '12 at 23:46
Thanks @BrianM.Scott , I didnt realize one could see it in this way. Prior to this I was just substituting in values/fiddling with the algebra. May I ask, is there a 'general' way to see if the triangle inequality does not hold for $d(x,y)$? As in, like a similar way to see it with the property for $d(x,y)=0$ iff $x=y$ as we have discussed above. – Steven May 19 '12 at 0:48
@Steven: I don’t know of a nice general test. With something like $d_2$ in the original problem, I’d notice that $|x-y|^2$ gets big very fast compared with $|x-y|$ and that would make me suspicious. Then I’d probably look either at $-x<0<x$ and see right away that $(2x)^2=4x^2>2x^2$, or at $0<x<y$ and see right away that $x^2+(y-x)^2=y^2+2x^2-2xy=y^2+2x(x-y)<y^2$. I’d look at these because they’re substantially simpler than the general case, since one of the points is $0$, but still general enough that I might find my counterexample. – Brian M. Scott May 19 '12 at 5:53

To check d(x,y)=|arctan(x)-arctan(y)| you can proceed as follows: symmetry follows since arctan is an injective function. To show triangle inequality note that:

$d(x,z) = |arctan(x) - arctan(z)| = |(arctan(x)-arctan(y)) + (arctan(y) - arctan(z))|$.

Apply now triangle inequailty for real numbers:

$d(x,z) \leq |arctan(x)-arctan(y)| + |arctan(y) - arctan(z)| = d(x,y) + d(y,z)$ as desired.

For fun: draw a picture and interpret this metric geometrically.

-
Thanks, I drew a picture of the $\arctan$ and it does help. – Steven May 17 '12 at 23:12