[proofplan]
We verify the metric axioms directly from the two possible values of the discrete distance. Nonnegativity and identity of indiscernibles follow from the defining cases $d(x,y)=0$ and $d(x,y)=1$. Symmetry follows because equality and inequality are symmetric relations. For the triangle inequality, we split according to whether the endpoints coincide.
[/proofplan]
[step:Unfold the definition and verify nonnegativity]
Let $x,y\in X$. By definition of $d$, the value $d(x,y)$ is either $0$ or $1$. In both cases $d(x,y)\ge 0$. Hence $d$ is nonnegative on $X\times X$.
[/step]
[step:Verify identity of indiscernibles from the two defining cases]
Let $x,y\in X$. If $x=y$, then the definition gives $d(x,y)=0$. Conversely, if $d(x,y)=0$, then the second defining case cannot hold, because $x\ne y$ would imply $d(x,y)=1$. Therefore $x=y$. Thus, for all $x,y\in X$, $d(x,y)=0 \iff x=y$.
[/step]
[step:Use symmetry of equality to prove symmetry of the distance]
Let $x,y\in X$. If $x=y$, then $y=x$, so $d(x,y)=0=d(y,x)$. If $x\ne y$, then $y\ne x$, so $d(x,y)=1=d(y,x)$. Therefore $d(x,y)=d(y,x)$ for all $x,y\in X$.
[/step]
[step:Split on whether the endpoints coincide to prove the triangle inequality]
Let $x,y,z\in X$. We prove that $d(x,z)\le d(x,y)+d(y,z)$.
If $x=z$, then $d(x,z)=0$, while $d(x,y)\ge 0$ and $d(y,z)\ge 0$ by nonnegativity. Hence $d(x,z)=0\le d(x,y)+d(y,z)$.
Now suppose $x\ne z$. Then $d(x,z)=1$. It is impossible that both $x=y$ and $y=z$, because that would imply $x=z$. Hence at least one of $x\ne y$ or $y\ne z$ holds. If $x\ne y$, then $d(x,y)=1$; if $y\ne z$, then $d(y,z)=1$. In either case, since both summands are nonnegative, $d(x,y)+d(y,z)\ge 1=d(x,z)$.
Thus the triangle inequality holds for all $x,y,z\in X$.
[guided]
Let $x,y,z\in X$. The triangle inequality to prove is $d(x,z)\le d(x,y)+d(y,z)$.
The discrete distance only takes the values $0$ and $1$, so the key question is whether the endpoint distance $d(x,z)$ is $0$ or $1$.
First suppose $x=z$. Then the defining formula for $d$ gives $d(x,z)=0$. From the earlier nonnegativity verification, both $d(x,y)$ and $d(y,z)$ are nonnegative [real numbers](/page/Real%20Numbers). Therefore $d(x,z)=0\le d(x,y)+d(y,z)$.
Now suppose $x\ne z$. Then the defining formula gives $d(x,z)=1$. To make the right-hand side at least $1$, we only need one of the two summands $d(x,y)$ or $d(y,z)$ to equal $1$. At least one must: if both $x=y$ and $y=z$ held, transitivity of equality would give $x=z$, contradicting the present assumption $x\ne z$. Hence either $x\ne y$ or $y\ne z$. In the first case, the definition gives $d(x,y)=1$; in the second case, it gives $d(y,z)=1$. The other summand is nonnegative, so in either case $d(x,y)+d(y,z)\ge 1$. Since $d(x,z)=1$ in the case $x\ne z$, this becomes $d(x,z)\le d(x,y)+d(y,z)$.
The two cases $x=z$ and $x\ne z$ exhaust all possibilities, so the triangle inequality holds for every triple $x,y,z\in X$.
[/guided]
[/step]
[step:Conclude that the discrete distance defines a metric space]
We have verified nonnegativity, identity of indiscernibles, symmetry, and the triangle inequality for $d:X\times X\to\mathbb{R}$. Therefore $d$ is a metric on $X$. Hence $(X,d)$ is a [metric space](/page/Metric%20Space).
[/step]