A metric space is a pair (X, d), where X is a set and d : X×x→ R is a function called a distance function or metric that satisfies the following conditions: for x, y, z ∈ X,

(M1) d(x, y) = 0 if and only if x = y; (M2) d(x, y) = d(y, x) (: symmetry); (M3) d(x, z) ≤ d(x, y) + d(y, z) (: triangle inequality).