I am learning metric spaces on my own and this is a question from Metric Spaces - Mícheál O'Searcoid, Exercises 1.2.
Suppose that $d$ is a metric on set $X$. Prove that the inequality $|d(x,y)-d(z,w)|\leq d(x,z)+d(y,w)$ holds for all $w,x,y,z\in X$.
My attempt:
Since $d(x,y)\leq d(x,z)+d(z,y)$ and $d(z,w)\leq d(z,y)+d(y,w)$.
Hence, $|d(x,y)-d(z,w)|\leq |d(x,z)-d(y,w)|\leq d(x,z)+d(y,w)$
But my problem with it is I think I am just "fitting" my solution to the final form. Am I missing anything here?
The intermediate step $|d(x,y)-d(z,w)| \leq |d(x,z)-d(y,w)|$ in your argument is not correct. As a counterexample, take $X = \mathbb{R}^2$, let $x=y = (0,0)$, let $z = (0,1)$, and let $w = (2,0)$. Then $|d(x,y)-d(z,w)| = \sqrt{5}$, but $|d(x,z)-d(y,w)| = 1$.
One way to prove the inequality $|d(x,y)-d(z,w)| \leq d(x,z) + d(y,w)$ is as follows: we note that $$ |d(x,y)-d(z,w)|= \begin{cases} d(x,y)-d(z,w), & d(x,y) \geq d(z,w) \\ d(z,w) - d(x,y), & d(z,w) \geq d(x,y). \end{cases} $$ To prove that $|d(x,y)-d(z,w)| \leq d(x,z) + d(y,w)$ for all $x,y,z,w \in X$, it therefore suffices to show that $$ d(x,y)-d(z,w) \leq d(x,z) + d(y,w) \tag{1} $$ and $$ d(z,w) - d(x,y) \leq d(x,z) + d(y,w) \tag{2} $$ both hold for all $x,y,z,w \in X$. For (1), we use the triangle inequality twice to give $$ \begin{split} d(x,y) - d(z,w) &\leq d(x,z)+d(z,y)-d(z,w) \\ &\leq d(x,z) + d(y,w)+d(w,z) - d(z,w) \\ &= d(x,z) + d(y,w). \end{split} $$ Here, we have made use of the reflexive property of $d$ ($d(a,b) = d(b,a)$) without commenting inline.) Similarly, to prove (2), write $$ \begin{split} d(z,w)-d(x,y) &\leq d(w,y) + d(y,z)-d(x,y) \\ &\leq d(w,y)+d(y,x) + d(x,z) - d(x,y) \\ &=d(y,w) + d(x,z). \end{split} $$ Actually, a separate proof of (2) can be evited if one merely relabels (1) to reverse the roles of $x$ and $y$ and then to reverse the roles of $z$ and $w$. (One can do this because if (1) holds for all $x,y,z,w$ and we want to show it holds for -say- a fixed $(x_0, y_0, z_0, w_0)$, then one can take $x=y_0$, $y=x_0$, $w=z_0$ and $z=w_0$.)