Why does setting y=x work in this proof? The problem in question asks you to show that the non-negativity of a metric follows from the 2nd, 3rd, and 4th metric space axioms i.e.
$\textbf{M2}$ $d(x,y) = 0$ iff $x=y$ 
$\textbf{M3}$ $d(x,y) = d(y,x)$ 
$\textbf{M4}$ $d(x,y) \leq d(x,z) + d(z,y)$
My (kind of longwinded) proof was the following:
We prove by showing that all possible distances on the arbitrary points $x,y,z$ are non-negative.
That $d(x,x), d(y,y), d(z,z)$ are non negative is given by $\textbf{M2}$. For the remainder, let $x=y$, then using $\textbf{M2}$, $\textbf{M3}$, $\textbf{M4}$ we have
\begin{equation}
\begin{split}
    d(x,y)=0 & \leq d(x,z) + d(z,y) \\
             & \leq d(x,z) + d(z,x) \\
             & \leq d(x,z) + d(x,z) \\
             & \leq 2d(x,z)
\end{split}
\end{equation}
dividing both sides by 2 gives
\begin{equation}
    0 \leq d(x,z)
\end{equation}
Thus by $\textbf{M3}$ and using the fact that $y=x$ we have that $d(x,z)$, $d(z,x)$, $d(y,z)$, and $d(z,y)$ are all non-negative. QED.
I've checked some answers setting and y=x in $\textbf{M4}$ seems to be the right strategy. My question is why does setting y=x work in this case? Doesn't this only prove for the case in which y=x? What about when y doesn't equal x? I've a seen similar strategies used in proofs before and I never quite understood how prooving for a limited set of cases prooved all cases.
Many thanks.
 A: The point is that you want to show $d(x,z) \geq 0$ for any $x,z$. This statement is only quantified over $x$ and $z$, so if you decide to introduce $y$ along the way in the proof then you can introduce it however you like. This proof picks it to be the same point as $x$, which is fine.
A different way of framing this proof: if there were some pair of points $(x,z)$ at a negative distance from one another, then the triangle inequality and symmetry would imply that $x$ is at a negative distance from itself, which contradicts M2.
A: You're done, and here's why: you are trying to show that $d(x,y) \ge 0$ for all $x,y$, but you have actually shown that $d(x,z) \ge 0$ for all $x,z$.
But of course, these two statements are equivalent.
You have from M2 that $d(x,x) = d(z,z) = 0$, so the $x = z$ case is covered. Now suppose $x \neq z$.
You showed $0 \le d(x,z)$ by using the triangle inequality and choosing $y = x$. So $d(x,z) \ge 0$ for arbitrary $x$ and $z$.
In other words, $y$ was like a dummy variable that you chose while working with arbitrary variables $x$ and $z$.
A: Pick some ${x}$ from your metric space. So you know that ${d(x,x)=0}$, which is an axiom. Now you also have the triangle inequality. For any three points ${x,y,z}$
$${d(x,y) \leq d(x,z) + d(z,y)}$$
The key thing is it's for any three points. Now you set ${y=x:}$
$${\Rightarrow d(x,x)\leq d(x,z) + d(z,x)}$$
Now by symmetry, because
$${d(x,z)=d(z,x)}$$
we have that
$${d(x,x)\leq 2d(x,z)\Rightarrow d(x,z)\geq d(x,x) = 0}$$
Remember, we still have not chosen what ${z}$ is. It's a free variable. It could be anything. It's some arbitrary point in the metric space. So the distance between ${x}$ and any other point $z$ has to be ${\geq 0}$. ${x}$ was also fixed at the start, but still an arbitrary choice - which proves that ${\forall\ x,z}$ in the metric space you have that
$${d(x,z)\geq 0}$$
which proves non-negativity.
