1. Home
  2. Explore
  3. Mathematics
  4. Introduction to Metric Spaces

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Metric Spaces

Metric Spaces

Definition of a Metric Space

A metric space consists of:

  1. A set MMM whose elements are the objects being studied.

  2. A distance function DDD that assigns a real number to every pair of elements in MMM.

The distance function is written as

D:M×M→R.D : M \times M \to \mathbb{R}.D:M×M→R.

For elements X,Y∈MX,Y \in MX,Y∈M, the value D(X,Y)D(X,Y)D(X,Y) represents the distance between XXX and YYY.

The elements of MMM do not have to be real numbers or points in the plane. They could be:

  • Real numbers

  • Complex numbers

  • Vectors

  • Functions

  • Points in R2\mathbb{R}^2R2

  • A finite collection of physical objects, such as markers

The set MMM and distance function DDD form a metric space only when DDD satisfies four properties.


The Four Metric Properties

1. Positivity

For every X,Y∈MX,Y \in MX,Y∈M,

D(X,Y)≥0.D(X,Y) \geq 0.D(X,Y)≥0.

Distances cannot be negative. The distance between two objects may be zero or positive, but never negative.

2. Non-degeneracy

The distance between two elements is zero if and only if the elements are identical:

D(X,Y)=0  ⟺  X=Y.D(X,Y)=0 \iff X=Y.D(X,Y)=0⟺X=Y.

This property ensures that the distance function distinguishes different elements. If two distinct elements had distance zero, the distance function would fail to separate them and would be considered degenerate.

The two directions of this statement are:

  • If X=YX=YX=Y, then D(X,Y)=0D(X,Y)=0D(X,Y)=0.

  • If D(X,Y)=0D(X,Y)=0D(X,Y)=0, then X=YX=YX=Y.

3. Symmetry

For every X,Y∈MX,Y \in MX,Y∈M,

D(X,Y)=D(Y,X).D(X,Y)=D(Y,X).D(X,Y)=D(Y,X).

The distance from XXX to YYY is the same as the distance from YYY to XXX.

4. Triangle Inequality

For every X,Y,Z∈MX,Y,Z \in MX,Y,Z∈M,

D(X,Y)≤D(X,Z)+D(Z,Y).D(X,Y) \leq D(X,Z)+D(Z,Y).D(X,Y)≤D(X,Z)+D(Z,Y).

The direct distance from XXX to YYY cannot be greater than the distance obtained by traveling from XXX to an intermediate point ZZZ and then from ZZZ to YYY.

The triangle inequality formalizes the idea that taking a detour cannot make a journey shorter.

In Euclidean space, this corresponds to the fact that the length of one side of a triangle is less than or equal to the sum of the lengths of the other two sides.


The Discrete Metric

Definition

Let MMM be any set. The discrete metric on MMM is defined by

D(X,Y)={0,X=Y,1,X≠Y.D(X,Y)= \begin{cases} 0, & X=Y,\\ 1, & X\neq Y. \end{cases}D(X,Y)={0,1,​X=Y,X=Y.​

Thus, the discrete metric assigns:

  • Distance 000 to an element and itself

  • Distance 111 to every pair of distinct elements

For example, if MMM is a set of colored markers:

D(orange,orange)=0D(\text{orange},\text{orange})=0D(orange,orange)=0

and

D(orange,green)=1.D(\text{orange},\text{green})=1.D(orange,green)=1.

Every pair of different markers is exactly one unit apart, regardless of their physical locations.


Verifying the Discrete Metric

Positivity

The only possible values of the discrete metric are 000 and 111. Both are nonnegative, so

D(X,Y)≥0.D(X,Y)\geq 0.D(X,Y)≥0.

Therefore, positivity holds by construction.

Non-degeneracy

The definition directly gives

D(X,Y)=0  ⟺  X=Y.D(X,Y)=0 \iff X=Y.D(X,Y)=0⟺X=Y.

If two elements are the same, their distance is zero. If their distance is zero, they must be the same element.

Symmetry

If X=YX=YX=Y, then both D(X,Y)D(X,Y)D(X,Y) and D(Y,X)D(Y,X)D(Y,X) equal 000.

If X≠YX\neq YX=Y, then both values equal 111.

Therefore,

D(X,Y)=D(Y,X).D(X,Y)=D(Y,X).D(X,Y)=D(Y,X).

Triangle Inequality

The triangle inequality requires

D(X,Y)≤D(X,Z)+D(Z,Y).D(X,Y)\leq D(X,Z)+D(Z,Y).D(X,Y)≤D(X,Z)+D(Z,Y).

For the discrete metric:

  • The left-hand side is either 000 or 111.

  • Each term on the right-hand side is either 000 or 111.

  • Therefore, the right-hand side can be 000, 111, or 222.

The only possible way for the inequality to fail would be

D(X,Y)=1andD(X,Z)+D(Z,Y)=0.D(X,Y)=1 \quad\text{and}\quad D(X,Z)+D(Z,Y)=0.D(X,Y)=1andD(X,Z)+D(Z,Y)=0.

However, if the right-hand side equals zero, then both terms must equal zero:

D(X,Z)=0andD(Z,Y)=0.D(X,Z)=0 \quad\text{and}\quad D(Z,Y)=0.D(X,Z)=0andD(Z,Y)=0.

By non-degeneracy,

X=ZandZ=Y.X=Z \quad\text{and}\quad Z=Y.X=ZandZ=Y.

By transitivity of equality, X=YX=YX=Y, which implies

D(X,Y)=0.D(X,Y)=0.D(X,Y)=0.

This contradicts the assumption that D(X,Y)=1D(X,Y)=1D(X,Y)=1. Hence, the only possible failure cannot occur, and the triangle inequality holds.

Therefore, every set equipped with the discrete metric is a metric space.


Geometry in the Discrete Metric

Changing the metric changes the geometry of the space. Familiar geometric objects, such as circles and discs, may look very different under different distance functions.

Circles in a Metric Space

A circle of radius rrr centered at a point PPP is the set

{X∈M:D(X,P)=r}.\{X\in M : D(X,P)=r\}.{X∈M:D(X,P)=r}.

This consists of all points whose distance from the center is exactly rrr.

A closed disc of radius rrr centered at PPP is the set

{X∈M:D(X,P)≤r}.\{X\in M : D(X,P)\leq r\}.{X∈M:D(X,P)≤r}.

This consists of all points whose distance from the center is at most rrr.


Discrete-Metric Circles

Suppose MMM is a finite set of markers with the discrete metric, and let PPP be one particular marker.

Circle of Radius 111

Every element different from PPP has distance 111 from PPP. Therefore,

{X∈M:D(X,P)=1}=M∖{P}.\{X\in M : D(X,P)=1\}=M\setminus\{P\}.{X∈M:D(X,P)=1}=M∖{P}.

The unit circle centered at PPP consists of every other marker in the set.

Circle of Radius 222

No element has discrete distance 222 from PPP, because the only possible distances are 000 and 111. Therefore,

{X∈M:D(X,P)=2}=∅.\{X\in M : D(X,P)=2\}=\varnothing.{X∈M:D(X,P)=2}=∅.

The circle of radius 222 is empty.

Closed Disc of Radius 111

Every element of MMM has distance at most 111 from PPP:

  • D(P,P)=0D(P,P)=0D(P,P)=0

  • D(X,P)=1D(X,P)=1D(X,P)=1 for every X≠PX\neq PX=P

Thus,

{X∈M:D(X,P)≤1}=M.\{X\in M : D(X,P)\leq 1\}=M.{X∈M:D(X,P)≤1}=M.

The closed disc of radius 111 is the entire metric space.

This differs greatly from Euclidean geometry, where a circle of radius 111 and a disc of radius 111 do not contain the entire plane.


The Taxi-Cab Metric

Definition

Let

M=R2.M=\mathbb{R}^2.M=R2.

For points

U=(U1,U2)andV=(V1,V2),U=(U_1,U_2) \quad\text{and}\quad V=(V_1,V_2),U=(U1​,U2​)andV=(V1​,V2​),

the taxi-cab metric, also called the Manhattan metric, is defined by

D(U,V)=∣U1−V1∣+∣U2−V2∣.D(U,V)=|U_1-V_1|+|U_2-V_2|.D(U,V)=∣U1​−V1​∣+∣U2​−V2​∣.

This distance adds:

  1. The horizontal distance between the points

  2. The vertical distance between the points

It does not measure the length of the straight-line segment between the points.


Example Calculation

Consider

U=(−3,1)andV=(2,3).U=(-3,1) \quad\text{and}\quad V=(2,3).U=(−3,1)andV=(2,3).

The horizontal difference is

∣−3−2∣=∣−5∣=5,|-3-2|=|-5|=5,∣−3−2∣=∣−5∣=5,

and the vertical difference is

∣1−3∣=∣−2∣=2.|1-3|=|-2|=2.∣1−3∣=∣−2∣=2.

Therefore,

D(U,V)=∣−3−2∣+∣1−3∣=5+2=7.D(U,V)=|-3-2|+|1-3|=5+2=7.D(U,V)=∣−3−2∣+∣1−3∣=5+2=7.

The taxi-cab distance is 777.

In Euclidean distance, the straight-line distance would instead be

(U1−V1)2+(U2−V2)2.\sqrt{(U_1-V_1)^2+(U_2-V_2)^2}.(U1​−V1​)2+(U2​−V2​)2​.

The two metrics generally produce different distances.


Interpretation

The taxi-cab metric models movement through a city arranged in a rectangular grid. A taxi cannot travel directly through buildings, so it must move along horizontal and vertical streets.

For example, traveling from one point to another might require:

  • Five blocks east

  • Two blocks north

The total distance is

5+2=75+2=75+2=7

blocks.

This is analogous to the number of horizontal and vertical movements required to reach the destination.


Verifying the Taxi-Cab Metric

Positivity

Absolute values are always nonnegative:

∣U1−V1∣≥0and∣U2−V2∣≥0.|U_1-V_1|\geq 0 \quad\text{and}\quad |U_2-V_2|\geq 0.∣U1​−V1​∣≥0and∣U2​−V2​∣≥0.

Therefore, their sum is nonnegative:

D(U,V)=∣U1−V1∣+∣U2−V2∣≥0.D(U,V)=|U_1-V_1|+|U_2-V_2|\geq 0.D(U,V)=∣U1​−V1​∣+∣U2​−V2​∣≥0.

Non-degeneracy

First, if U=VU=VU=V, then U1=V1U_1=V_1U1​=V1​ and U2=V2U_2=V_2U2​=V2​. Therefore,

D(U,V)=∣U1−U1∣+∣U2−U2∣=0+0=0.D(U,V)=|U_1-U_1|+|U_2-U_2|=0+0=0.D(U,V)=∣U1​−U1​∣+∣U2​−U2​∣=0+0=0.

Conversely, suppose

D(U,V)=0.D(U,V)=0.D(U,V)=0.

Then

∣U1−V1∣+∣U2−V2∣=0.|U_1-V_1|+|U_2-V_2|=0.∣U1​−V1​∣+∣U2​−V2​∣=0.

Both terms are nonnegative. A sum of nonnegative numbers can equal zero only if both terms equal zero:

∣U1−V1∣=0and∣U2−V2∣=0.|U_1-V_1|=0 \quad\text{and}\quad |U_2-V_2|=0.∣U1​−V1​∣=0and∣U2​−V2​∣=0.

Thus,

U1=V1andU2=V2,U_1=V_1 \quad\text{and}\quad U_2=V_2,U1​=V1​andU2​=V2​,

so U=VU=VU=V.

Therefore,

D(U,V)=0  ⟺  U=V.D(U,V)=0 \iff U=V.D(U,V)=0⟺U=V.

Symmetry

Using the fact that ∣a−b∣=∣b−a∣|a-b|=|b-a|∣a−b∣=∣b−a∣,

D(V,U)=∣V1−U1∣+∣V2−U2∣=∣U1−V1∣+∣U2−V2∣=D(U,V).\begin{aligned} D(V,U) &=|V_1-U_1|+|V_2-U_2|\\ &=|U_1-V_1|+|U_2-V_2|\\ &=D(U,V). \end{aligned}D(V,U)​=∣V1​−U1​∣+∣V2​−U2​∣=∣U1​−V1​∣+∣U2​−V2​∣=D(U,V).​

Therefore, the taxi-cab metric is symmetric.

Triangle Inequality

Let

U=(U1,U2),V=(V1,V2),W=(W1,W2).U=(U_1,U_2), \quad V=(V_1,V_2), \quad W=(W_1,W_2).U=(U1​,U2​),V=(V1​,V2​),W=(W1​,W2​).

The distance from UUU to VVV is

D(U,V)=∣U1−V1∣+∣U2−V2∣.D(U,V)=|U_1-V_1|+|U_2-V_2|.D(U,V)=∣U1​−V1​∣+∣U2​−V2​∣.

Insert the coordinates of WWW:

U1−V1=(U1−W1)+(W1−V1),U_1-V_1=(U_1-W_1)+(W_1-V_1),U1​−V1​=(U1​−W1​)+(W1​−V1​),

and

U2−V2=(U2−W2)+(W2−V2).U_2-V_2=(U_2-W_2)+(W_2-V_2).U2​−V2​=(U2​−W2​)+(W2​−V2​).

Therefore,

D(U,V)=∣(U1−W1)+(W1−V1)∣+∣(U2−W2)+(W2−V2)∣.\begin{aligned} D(U,V) &=|(U_1-W_1)+(W_1-V_1)|\\ &\quad + |(U_2-W_2)+(W_2-V_2)|. \end{aligned}D(U,V)​=∣(U1​−W1​)+(W1​−V1​)∣+∣(U2​−W2​)+(W2​−V2​)∣.​

Applying the triangle inequality for absolute values, ∣a+b∣≤∣a∣+∣b∣|a+b|\leq |a|+|b|∣a+b∣≤∣a∣+∣b∣, gives

D(U,V)≤∣U1−W1∣+∣W1−V1∣+∣U2−W2∣+∣W2−V2∣.\begin{aligned} D(U,V) &\leq |U_1-W_1|+|W_1-V_1|\\ &\quad +|U_2-W_2|+|W_2-V_2|. \end{aligned}D(U,V)​≤∣U1​−W1​∣+∣W1​−V1​∣+∣U2​−W2​∣+∣W2​−V2​∣.​

Rearranging the terms,

D(U,V)≤(∣U1−W1∣+∣U2−W2∣)+(∣W1−V1∣+∣W2−V2∣).\begin{aligned} D(U,V) &\leq \bigl(|U_1-W_1|+|U_2-W_2|\bigr)\\ &\quad+\bigl(|W_1-V_1|+|W_2-V_2|\bigr). \end{aligned}D(U,V)​≤(∣U1​−W1​∣+∣U2​−W2​∣)+(∣W1​−V1​∣+∣W2​−V2​∣).​

The first group is D(U,W)D(U,W)D(U,W) and the second group is D(W,V)D(W,V)D(W,V). Hence,

D(U,V)≤D(U,W)+D(W,V).D(U,V)\leq D(U,W)+D(W,V).D(U,V)≤D(U,W)+D(W,V).

Therefore, R2\mathbb{R}^2R2 equipped with the taxi-cab metric is a metric space.


Geometric Features of the Taxi-Cab Metric

Multiple Shortest Paths

In Euclidean space, two points have a unique shortest path: the straight-line segment connecting them.

Under the taxi-cab metric, there may be many shortest paths. Any path that:

  • Moves the required total distance horizontally

  • Moves the required total distance vertically

  • Avoids unnecessary movement in the opposite direction

has the same minimum length.

For example, if one point is five units east and two units north of another, a shortest path may:

  • Move all five units east, then two units north

  • Move two units north, then five units east

  • Alternate between horizontal and vertical movements

Every such route has length 777.

Detours involving movement west or south increase the total distance.


Circles in the Taxi-Cab Metric

A circle of radius rrr centered at the origin consists of all points (x,y)(x,y)(x,y) satisfying

∣x∣+∣y∣=r.|x|+|y|=r.∣x∣+∣y∣=r.

For radius 222,

∣x∣+∣y∣=2.|x|+|y|=2.∣x∣+∣y∣=2.

In each quadrant, this equation describes a line segment. The four line segments join to form a diamond shape with vertices

(2,0),(0,2),(−2,0),(0,−2).(2,0),\quad (0,2),\quad (-2,0),\quad (0,-2).(2,0),(0,2),(−2,0),(0,−2).

Thus, a taxi-cab circle centered at the origin is a diamond rather than the usual Euclidean circle.

The diamond includes points such as:

(2,0),(1.5,0.5),(0.5,1.5),(0,2),(2,0),\quad (1.5,0.5),\quad (0.5,1.5),\quad (0,2),(2,0),(1.5,0.5),(0.5,1.5),(0,2),

because each satisfies

∣x∣+∣y∣=2.|x|+|y|=2.∣x∣+∣y∣=2.

The coordinates need not be integers; the taxi-cab metric applies to all points in R2\mathbb{R}^2R2.


Norms Induce Metrics

The Induced Metric

Let VVV be a normed vector space with norm ∥⋅∥\|\cdot\|∥⋅∥. Define a distance function by

D(V,W)=∥V−W∥.D(V,W)=\|V-W\|.D(V,W)=∥V−W∥.

More generally, if the vectors are denoted by v,w∈Vv,w\in Vv,w∈V, then

D(v,w)=∥v−w∥.D(v,w)=\|v-w\|.D(v,w)=∥v−w∥.

This is called the metric induced by the norm.

The set of the metric space is the vector space itself, and the distance between two vectors is the norm of their difference.

Every normed vector space automatically becomes a metric space when distance is defined by D(v,w)=∥v−w∥D(v,w)=\|v-w\|D(v,w)=∥v−w∥.

The proof follows from the four norm properties.


Positivity of the Induced Metric

A norm is nonnegative, so

∥v−w∥≥0.\|v-w\|\geq 0.∥v−w∥≥0.

Since

D(v,w)=∥v−w∥,D(v,w)=\|v-w\|,D(v,w)=∥v−w∥,

it follows immediately that

D(v,w)≥0.D(v,w)\geq 0.D(v,w)≥0.

Thus, positivity of the metric is inherited from positivity of the norm.


Non-degeneracy of the Induced Metric

The norm is non-degenerate, meaning

∥x∥=0  ⟺  x=0,\|x\|=0 \iff x=\mathbf{0},∥x∥=0⟺x=0,

where 0\mathbf{0}0 is the zero vector.

Therefore,

D(v,w)=0  ⟺  ∥v−w∥=0  ⟺  v−w=0  ⟺  v=w.\begin{aligned} D(v,w)=0 &\iff \|v-w\|=0\\ &\iff v-w=\mathbf{0}\\ &\iff v=w. \end{aligned}D(v,w)=0​⟺∥v−w∥=0⟺v−w=0⟺v=w.​

Hence,

D(v,w)=0  ⟺  v=w.D(v,w)=0 \iff v=w.D(v,w)=0⟺v=w.

Non-degeneracy of the metric is inherited from non-degeneracy of the norm.


Symmetry of the Induced Metric

Consider the distance from www to vvv:

D(w,v)=∥w−v∥.D(w,v)=\|w-v\|.D(w,v)=∥w−v∥.

Since

w−v=(−1)(v−w),w-v=(-1)(v-w),w−v=(−1)(v−w),

the absolute homogeneity property of the norm gives

∥w−v∥=∥(−1)(v−w)∥=∣−1∣ ∥v−w∥.\|w-v\| =\|(-1)(v-w)\| =|-1|\,\|v-w\|.∥w−v∥=∥(−1)(v−w)∥=∣−1∣∥v−w∥.

Because ∣−1∣=1|-1|=1∣−1∣=1,

∥w−v∥=∥v−w∥.\|w-v\|=\|v-w\|.∥w−v∥=∥v−w∥.

Therefore,

D(w,v)=D(v,w).D(w,v)=D(v,w).D(w,v)=D(v,w).

Symmetry follows from:

  • Vector addition and scalar multiplication in the vector space

  • The identity w−v=−(v−w)w-v=-(v-w)w−v=−(v−w)

  • The norm property ∥αx∥=∣α∣∥x∥\|\alpha x\|=|\alpha|\|x\|∥αx∥=∣α∣∥x∥


Triangle Inequality of the Induced Metric

For vectors v,w,u∈Vv,w,u\in Vv,w,u∈V,

v−w=(v−u)+(u−w).v-w=(v-u)+(u-w).v−w=(v−u)+(u−w).

Therefore,

D(v,w)=∥v−w∥=∥(v−u)+(u−w)∥.D(v,w)=\|v-w\| =\|(v-u)+(u-w)\|.D(v,w)=∥v−w∥=∥(v−u)+(u−w)∥.

Applying the triangle inequality for the norm,

∥(v−u)+(u−w)∥≤∥v−u∥+∥u−w∥.\|(v-u)+(u-w)\| \leq \|v-u\|+\|u-w\|.∥(v−u)+(u−w)∥≤∥v−u∥+∥u−w∥.

Using the definition of the induced metric,

∥v−u∥=D(v,u)and∥u−w∥=D(u,w).\|v-u\|=D(v,u) \quad\text{and}\quad \|u-w\|=D(u,w).∥v−u∥=D(v,u)and∥u−w∥=D(u,w).

Thus,

D(v,w)≤D(v,u)+D(u,w).D(v,w)\leq D(v,u)+D(u,w).D(v,w)≤D(v,u)+D(u,w).

Therefore, the induced metric satisfies the triangle inequality.


Relationship Between Inner Products, Norms, and Metrics

The constructions form a one-way hierarchy:

inner product⟶norm⟶metric.\text{inner product} \longrightarrow \text{norm} \longrightarrow \text{metric}.inner product⟶norm⟶metric.

Inner Product Induces a Norm

In a real inner product space, an inner product can define a norm by

∥v∥=⟨v,v⟩.\|v\|=\sqrt{\langle v,v\rangle}.∥v∥=⟨v,v⟩​.

The inner product supplies the notion of vector magnitude.

Norm Induces a Metric

A norm then supplies a distance:

D(v,w)=∥v−w∥.D(v,w)=\|v-w\|.D(v,w)=∥v−w∥.

The distance is obtained by taking the norm of the displacement vector from www to vvv.

The Implication Does Not Generally Reverse

A metric space does not necessarily come from a normed vector space.

For example, a set of markers equipped with the discrete metric is a metric space, but it does not have:

  • A distinguished origin

  • Vector addition

  • Additive inverses

  • Scalar multiplication

  • A vector-space structure

Since it is not a vector space, it cannot be a normed vector space or an inner product space.

Therefore, the existence of a metric does not imply the existence of a norm or inner product.


Metrics on a Normed Vector Space

The norm-induced metric is a valid and natural metric on a normed vector space, but it is not necessarily the only possible metric.

For example, even if a vector space already has a norm-induced metric, the same underlying set can also be equipped with the discrete metric.

Thus:

  • A normed vector space always provides at least one natural metric through D(v,w)=∥v−w∥D(v,w)=\|v-w\|D(v,w)=∥v−w∥.

  • Other metrics may also be defined on the same set.

  • The norm-induced metric is a particular choice, not a unique one.

The essential distinction is that a norm automatically produces a metric, whereas an arbitrary metric does not automatically produce a vector space, norm, or inner product.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent