Infinite Index
Scientific claim

Metric Space Definition

Featured image for Metric Space Definition

Claim

A metric space is an ordered pair (X,d)(X,d), where XX is a set and d:X×XRd:X\times X\to\mathbb{R} is a function such that, for all x,y,zXx,y,z\in X:

d(x,y)0d(x,y)\geq0d(x,y)=0    x=yd(x,y)=0 \iff x=yd(x,y)=d(y,x)d(x,y)=d(y,x)d(x,z)d(x,y)+d(y,z).d(x,z)\leq d(x,y)+d(y,z).
Theoretical: Not applicableExperimental: Not applicable

Assumptions

No assumptions recorded.

Proof

This is a definition, so it is not proved from more fundamental propositions within this node.

Its purpose is to formalise the idea of distance in a way that supports rigorous reasoning about points becoming arbitrarily close.

Let XX be a set of objects called points. Let d:X×XRd:X\times X\to\mathbb{R} be a function, where d(x,y)d(x,y) denotes the distance assigned to the ordered pair of points x,yXx,y\in X.

The first condition requires distances to be non-negative:

d(x,y)0.d(x,y)\geq0.

This prevents a separation between two points from being assigned a negative size.

The second condition specifies exactly when the distance is zero:

d(x,y)=0    x=y.d(x,y)=0 \iff x=y.

The implication x=yd(x,y)=0x=y\Rightarrow d(x,y)=0 ensures that a point has zero distance from itself. The reverse implication d(x,y)=0x=yd(x,y)=0\Rightarrow x=y ensures that two distinct points cannot be treated as having no separation.

The third condition requires symmetry:

d(x,y)=d(y,x).d(x,y)=d(y,x).

This ensures that distance depends on the two points being compared, not on the direction in which the comparison is written.

The fourth condition is the triangle inequality:

d(x,z)d(x,y)+d(y,z).d(x,z)\leq d(x,y)+d(y,z).

This ensures that travelling directly from xx to zz cannot be longer than travelling from xx to yy and then from yy to zz. It prevents inconsistent distance assignments in which an indirect route would be shorter than the direct separation.

Together, these conditions ensure that dd provides a coherent notion of closeness. In particular, they allow statements such as d(xn,xm)<εd(x_n,x_m)<\varepsilon to have a stable meaning for every chosen tolerance ε>0\varepsilon>0.

A metric space is any collection of things for which you can consistently say how far apart any two things are.

Examples

  1. (Valid) Real Numbers with Ordinary Distance

    Let X=RX=\mathbb{R} and let x,yXx,y\in X.

    d(x,y)=xy.d(x,y)=|x-y|.

    This is a valid metric because the absolute difference is always non-negative, is zero only when x=yx=y, is symmetric, and satisfies the triangle inequality.

  2. (Valid) Plane with Euclidean Distance

    Let X=R2X=\mathbb{R}^2. For points x=(x1,x2)\mathbf{x}=(x_1,x_2) and y=(y1,y2)\mathbf{y}=(y_1,y_2) in XX:

    d(x,y)=(x1y1)2+(x2y2)2.d(\mathbf{x},\mathbf{y}) = \sqrt{(x_1-y_1)^2+(x_2-y_2)^2}.

    This is a valid metric because it is the ordinary straight-line distance, which satisfies all four metric-space conditions.

  3. (Valid) Plane with Manhattan Distance

    Let X=R2X=\mathbb{R}^2. For points x=(x1,x2)\mathbf{x}=(x_1,x_2) and y=(y1,y2)\mathbf{y}=(y_1,y_2) in XX:

    d(x,y)=x1y1+x2y2.d(\mathbf{x},\mathbf{y}) = |x_1-y_1|+|x_2-y_2|.

    This is a valid metric because it measures the total horizontal and vertical separation between two points and satisfies all four metric-space conditions.

  4. (Valid) Discrete Metric

    Let XX be any set. For x,yXx,y\in X:

    d(x,y)={0,x=y,1,xy.d(x,y) = \begin{cases} 0, & x=y, \\ 1, & x\neq y. \end{cases}

    This is a valid metric because a point is distance 00 from itself, every distinct pair is distance 11 apart, and the triangle inequality always holds.

  5. (Invalid) Signed Difference

    Let X=RX=\mathbb{R} and let x,yXx,y\in X.

    d(x,y)=xy.d(x,y)=x-y.

    This is not a valid metric because a distance cannot be negative. For example:

    d(1,2)=1.d(1,2)=-1.
  6. (Invalid) Squared Distance

    Let X=RX=\mathbb{R} and let x,yXx,y\in X.

    d(x,y)=xy2.d(x,y)=|x-y|^2.

    This is not a valid metric because it violates the triangle inequality. For x=0x=0, y=1y=1, and z=2z=2:

    d(0,2)=4.d(0,2)=4.d(0,1)+d(1,2)=1+1=2.d(0,1)+d(1,2)=1+1=2.

    Therefore:

    d(0,2)>d(0,1)+d(1,2).d(0,2)>d(0,1)+d(1,2).
  7. (Invalid) Zero Distance for Every Pair

    Let XX be a set containing at least two distinct elements. For all x,yXx,y\in X:

    d(x,y)=0.d(x,y)=0.

    This is not a valid metric because two distinct points must have a positive distance from one another. If xyx\neq y, then:

    d(x,y)=0.d(x,y)=0.

    This violates:

    d(x,y)=0    x=y.d(x,y)=0 \iff x=y.
  8. (Invalid) Asymmetric Distance

    Let X=RX=\mathbb{R}. For x,yXx,y\in X:

    d(x,y)={0,x=y,yx,xy.d(x,y) = \begin{cases} 0, & x=y, \\ y-x, & xy. \end{cases}

    This is not a valid metric because distance must be the same in either direction. For example:

    d(1,2)=1.d(1,2)=1.d(2,1)=2.d(2,1)=2.

    Therefore:

    d(1,2)d(2,1).d(1,2)\neq d(2,1).

Evidence

01
metric spaceUrs Schreiber · 2026-01-27 · supporting

Related Concepts

No dependency connections recorded.