As per Wikipedia, a distance metric, metric, or distance function, “is a function that defines a distance between each pair of elements of a set.”
A distance metric requires the following four axioms to be true for all elements , , and in a given set.
- Non-negativity: – The distance must always be greater than zero.
- Identity of indiscernibles: – The distance must be zero for two elements that are the same (i.e. indiscernible from each other).
- Symmetry: – The distances must be the same, no matter which order the parameters are given.
- Triangle inequality: – For three elements in the set, the sum of the distances for any two pairs must be greater than the distance for the remaining pair.