# A metric on $\mathbb R^2$

I’m trying to show that $$d(x,y)= |x_1-x_2|^2 + |y_1-y_2|^2$$ is a metric on $$\mathbb R^2$$ where $$x=(x_1,y_1)$$ and $$y=(x_2,y_2)$$

I have stuck on triangle inequality.

Let $$z=(x_3,y_3)$$

I must show $$d(x,y) \leq d(x,z) + d(z,y)$$ namely $$|x_1-x_2|^2 + |y_1-y_2|^2 \leq |x_1-x_3|^2 + |y_1-y_3|^2 + |x_3-x_2|^2 + |y_3-y_2|^ 2$$

I have tried to use $$|x_1-x_2|=|x_1-x_3+x_3-x_2| \leq |x_1-x_3| + |x_3-x_2|$$ but I couldn’t obtain the triangle inequality. I could get $$|x_1-x_2|^2 + |y_1-y_2|^2 \leq 2|x_1-x_3|^2 + 2|y_1-y_3|^2 + 2|x_3-x_2|^2 + 2|y_3-y_2|^ 2$$ via using $$2ab \leq a^2 + b^2$$ inequality.

I know it is probably a piece of cake but I cannot see it. I need some hints.

Thanks in advance for any help.

• $d$ is not a metric (consider $(0,0),(1,0),(2,0)$) but $\sqrt{d}$ is. – Mindlack Sep 19 '19 at 21:05
• @Mindlack thanks a lot – user519955 Sep 24 '19 at 11:36

I'm afraid @Mindlack is right. Note that $$|x_1-x_2|^2+|x_2-x_3|^2-|x_1-x_3|^2\\=x_1^2+x_2^2-2x_1x_2+x_2^2+x_3^2-2x_2x_3-x_1^2-x_3^2+2x_1x_3\\=2(x_2-x_1)(x_2-x_3)$$can be positive, negative or zero depending on the values of $$x_1,\,x_2,\,x_3$$. A similar result holds for the $$y_i$$. Thus $$|x_1-x_2|^2+|x_2-x_3|^2-|x_1-x_3|^2+x_i\mapsto y_i$$needn't be non-negative, as the triangle inequality would require. In fact, we can also think of this in terms of the cosine rule in planar Euclidean geometry: if $$x_1,\,x_2,\,x_3$$ are the vertices of a triangle with internal angle $$\theta$$ at $$x_2$$,$$|x_1-x_2|^2+|x_2-x_3|^2-|x_1-x_3|^2=2|x_1-x_2||x_2-x_3|\cos\theta$$has the same sign as $$\cos\theta$$.