# Does the function satisfy the triangle inequality?

Let $f,g:\mathbb{R}^2\times\mathbb{R}^2\rightarrow \mathbb{R}$ with $$f(x,y)=\frac{|x_1-y_1|}{1+|x_1-y_1|}+\frac{|x_2-y_2|}{1+|x_2-y_2|}$$ and $$g(x,y)=\begin{cases}0 & x=y \\ 1& x\neq y\end{cases}$$ I want to check if these function satisfies the triangle inequality, i.e. if $$f(x, y) \leq f(x, z) + f(z, y) \ \ \text{ and } \ \ g(x, y) \leq g(x, z) + g(z, y) , \ \ \ \forall x, y, z$$

• For the function $f$ we have that $$f(x, z) + f(z, y)=\frac{|x_1-z_1|}{1+|x_1-z_1|}+\frac{|x_2-z_2|}{1+|x_2-z_2|}+\frac{|z_1-y_1|}{1+|z_1-y_1|}+\frac{|z_2-y_2|}{1+|z_2-y_2|}$$ I think that the function doesn't satisfy that inequality because we have the absolute value also in the denominator, but how could we show it?

• For the function $g$ we have that $$g(x, z) + g(z, y) =\begin{cases}0 & x=z \\ 1& x\neq z\end{cases}+\begin{cases}0 & z=y \\ 1& z\neq y\end{cases}=\begin{cases}0 & x=z\land z=y \\ 1& x= z\land z\ne y \\ 1 & x\neq z\land z=y \\ 2& x\neq z\land z\neq y\end{cases}\geq g(x,y)$$ Is this correct? Or could we show wit hmore details the last step?

Note that the function $f:\mathbb{R_+}\to\mathbb{R_+}$ given by $$f(t)=\frac{t}{1+t}$$ is increasing. Therefore $$f(x,y)=\frac{|x_1-y_1|}{1+|x_1-y_1|}+\frac{|x_2-y_2|}{1+|x_2-y_2|}\\\leqslant \frac{|x_1-z_1|+|z_1-y_1|}{1+|x_1-z_1|+|z_1-y_1|}+\frac{|x_2-z_2|+|z_2-y_2|}{1+|x_2-z_2|+|z_2-y_2|}\\\leqslant \frac{|x_1-z_1|}{1+|x_1-z_1|}+\frac{|z_1-y_1|}{1+|z_1-y_1|}+\frac{|x_2-z_2|}{1+|x_2-z_2|}+\frac{|z_2-y_2|}{1+|z_2-y_2|}\\=\frac{|x_1-z_1|}{1+|x_1-z_1|}+\frac{|x_2-z_2|}{1+|x_2-z_2|}+\frac{|z_1-y_1|}{1+|z_1-y_1|}+\frac{|z_2-y_2|}{1+|z_2-y_2|}\\=f(x,z)+f(z,y)$$
• Ok! I have shown that these two functions are metric, so $(\mathbb{R}^2,f)$ and $(\mathbb{R}^2,g)$ are metric spaces. Now I want to draw the balls $B_1(0,1):=\{x\in \mathbb{R}^2: f(x,0)<1\}$ and $B_2(0,1):=\{x\in \mathbb{R}^2: g(x,0)<1\}$. We have that $f(x,0)<1\Rightarrow \frac{|x_1|}{1+|x_1|}+\frac{|x_2|}{1+|x_2|}<1$, right? How do we continue? For $B_2$ we have that $g(x,0)<1\Rightarrow \begin{cases}0 & x=0 \\ 1& x\neq 1\end{cases}<1$. What do we get from that? – Mary Star Apr 14 '18 at 22:42