Let \(X\) be a non-empty set. A function \(d\colon X\times X\to \mathbb{R}\) is called metric on \(X\) if it satisfies for all \(x,y,z\in X\)
- \(d(x,x)=0\),
- positivity, i.e. \(d(x,y)> 0\) if \(x\neq y\),
- symmetry, i.e. \(d(x,y)=d(y,x)\),
- triangle inequality, i.e. \(d(x,y)\le d(x,z)+d(z,y)\).
The metric is a notion of a distance.
Remarks
- The tuple \((X,d)\) is called metric space .