d(x,y) takes only the values 0 or 1, so d(x,y)≥0. By definition d(x,y)=0 exactly when x=y, and d(x,y)=1 when x=y, so d(x,y)=0⟺x=y.
Symmetry: if x=y then d(x,y)=0=d(y,x), and if x=y then d(x,y)=1=d(y,x), so d(x,y)=d(y,x).
For the triangle inequality, argue by cases. If x=z then the left side is d(x,z)=0≤d(x,y)+d(y,z).
If x=z then the left side is d(x,z)=1. For any y: if y equals x the right side is 0+1=1; if y equals z it is 1+0=1; if y equals neither it is 1+1=2. In every case 1≤d(x,y)+d(y,z).
Hence d(x,z)≤d(x,y)+d(y,z) holds for all x,y,z — the discrete metric satisfies all the metric axioms.