# Proof of triangle inequality for $d(x,y)=\sqrt{\lvert x-y\rvert}$

There is this problem that says: show that $d(x,y)=\sqrt{\lvert x-y\rvert}$ is a distance function on $\mathbb{R}$, and I am unable to proof the triangle inequality for this? any suggestion I look forward to. thanks.

Notice $( d(x,y) )^2 = |x-y| \leq |x-z| + |z - y| = (d(x,z))^2 + (d(z,y))^2$

Claim: If $a,b \geq 0$, then $\sqrt{a + b } \leq \sqrt{a} + \sqrt{b}$. This follows from the fact that $2 \sqrt{ab} \geq 0$. Adding $a+b$ in both sides give:

$$a + 2\sqrt{ab} + b \geq a +b \iff (\sqrt{a} + \sqrt{b})^2 \geq a + b \iff \sqrt{a} + \sqrt{b} \geq \sqrt{a+b}$$

Using the claim, we easily see that

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

Hint:

We already have the usual triangle inequality $\lvert x-y\rvert\leq\lvert x-z\rvert+\lvert z-y\rvert$. This tells you that $$\sqrt{\lvert x-y\rvert}\leq\sqrt{\lvert x-z\rvert+\lvert z-y\rvert}.$$ From here, it sufficies to prove that $\sqrt{a+b}\leq\sqrt{a}+\sqrt{b}$ for non-negative $a,b$.

$$|x-y| \le |x-z| + |z-y| \le |x-z| + 2*\sqrt{|x-z||z-y|} +|z-y| = \left(\sqrt{|x-z|} + \sqrt{|z-y|} \right)^2$$

Now take the root again.