It is straightforward to define Euclidean distance in . To define a distance function over any , however, certain axioms will have to be satisfied so that it coincides with our expectations based on Euclidean distance.
The following definition and axioms are used to create a function that converts a topological space into a metric space.5.1 A metric space is a topological space equipped with a function such that for any :
The function defines distances between points in the metric space, and each of the four conditions on agrees with our intuitions about distance. The final condition implies that is optimal in the sense that the distance from to will always be less than or equal to the total distance obtained by traveling through an intermediate point on the way from to .