In topology,Let $X = (0,1) ∪ \{2\}$ and let $d_7: X \times X\to [0,∞)$ be a function defined formulas: $$ d_7(x,y)=\cases{|x-y| & if $x ∈ (0,1)$ and $y ∈ (0,1)$\\7 & if $x=2$ and $y ∈(0,1)$\\ 7& if $x ∈(0,1)$ and $y=2$\\0& if $x=2$ and $y=2$} $$ Please check if $d_7$ is a distance function on $X$.
Does anybody explain and solve this question ?
Yes, $d_7$ is a distance function, because for each $x,y,z\in X$ we have $d_7(x,y)=0$ iff $x=y$, $d_7(x,y)=d_7(y,x)$, and $d_7(x,z)\le d_7(x,y)+d_7 (y,z)$. The first two properties are easy to check while looking at the definition on $d_7$. The last inequality clearly holds when $x,y,z\in (0,1)$, because then it is the triangle inequality for the standard distance on $\Bbb R$. If $d_7(x,y)=7$ or $d_7(y,z)=7$ then the inequality holds, because anyway $d_7(x,z)\le 7$. The remaining case is $x=y=z=2$, in which the inequality holds trivially.
We have to show that $d_7(x,y)+d_7 (y,z)\ge d_7(x,z)$ for each $x,y,z\in X$. The following cases are possible.
1) $x,y,z\in (0,1)$. Then $d_7(x,z)=|x-z|$, $d_7(x,y)=|x-y|$, and $d_7(y,z)=|y-z|$. Then $d_7(x,z)\le d_7(x,y)+d_7 (y,z)$ because $|a|+|b|\ge |a+b| $ for all real $a$ and $b$, so $$|x-y|+|y-z|\ge |(x-y)+(y-z)|=|x-z|.$$
2) $x\in (0,1)$, $y=2$ or $y\in (0,1)$, $x=2$. Then $d_7(x,y)+d_7(y,z)\ge d_7(x,y)=7\ge d_7(x,z)$.
3) $z\in (0,1)$, $y=2$ or $y\in (0,1)$, $z=2$. Then $d_7(x,y)+d_7(y,z)\ge d_7(y,z)=7\ge d_7(x,z)$.
4) $x=y=z=2$. Then $d_7(x,y)+d_7(y,z)=0+0=0=d_7(x,z)$.