Book 2B

© 2026 NeckPinch · www.neckpinch.com · All rights reserved.

Course 2Book 2B: Spaces, Functions and ChangeChapter 1

Metric Spaces

Distance between points, strings, functions and places on Earth, and the topology it defines.

38 min read · Updated Oct 2, 2026

Read with Tao, Analysis II, chapter "Metric spaces": the definitions and examples, "Some point-set topology of metric spaces" and "Relative topology". The sections on Cauchy sequences and compact metric spaces go with chapters 2B.2 and 2B.3.

In this chapter · 7 sections
  1. 1.1Distance, in general
  2. 1.2A zoo of metric spaces
  3. 1.2.1Three metrics on Rn\mathbb{R}^nRn
  4. 1.2.2The sphere
  5. 1.2.3Discrete spaces, codes and strings
  6. 1.2.4Spaces of functions
  7. 1.3Open and closed sets
  8. 1.4Subspaces and relative topology
  9. 1.5Equivalent and inequivalent metrics
  10. 1.6History
  11. 1.7Exercises

Book 2A was about one space, the real line, and one way of measuring distance in it, ∣x−y∣|x - y|. Almost everything proved there used only a few properties of that distance: it is never negative, it is zero only between a point and itself, it is symmetric, and it obeys the triangle inequality. This chapter takes those four properties as a definition. Anything that satisfies them is a metric, and a set with a metric is a metric space.

The gain is enormous. Points on the Earth, strings of letters, binary codewords, continuous functions and (much later) whole geometric shapes all carry natural metrics. Once they do, convergence, continuity, open and closed sets, completeness and compactness all make sense for them, with the same definitions and often the same proofs as on R\mathbb{R}. The route to Perelman runs through several such spaces: spaces of functions in Courses 3, 4 and 6, a Riemannian manifold viewed as a metric space in 9A.3 Geodesics and the Exponential Map, and finally a space whose points are themselves metric spaces, in which limits of Ricci flows are taken (9B.4 Convergence of Manifolds).

By the end of this chapter you will be able to:

  • check the four axioms of a metric, and recognise the standard metrics on Rn\mathbb{R}^n, on spheres, on strings and on function spaces;
  • define open and closed balls, open and closed sets, interior, closure and boundary, and prove the basic facts that connect them to convergent sequences;
  • work with subsets of a metric space, and tell "open in YY" from "open in XX";
  • decide whether two metrics on the same set are equivalent, and show that two natural metrics on continuous functions are not;
  • compute great-circle, taxicab, Hamming and edit distances, and say what the triangle inequality buys in each case.

Distance, in general

In the world Data New York to Hong Kong over the Arctic

John F. Kennedy airport in New York is at about 40.64° N, 73.78° W, and Hong Kong International at about 22.31° N, 113.92° E. On a flat Mercator map the obvious route runs west across North America and the Pacific. But the shortest path along the surface of the Earth is an arc of a great circle, the intersection of the sphere with a plane through its centre. Treating the Earth as a sphere of radius 63716371 km, that arc is about 12,97012{,}970 km long, and it passes within about 6° of the North Pole (Figure 1.3).

Airlines know this. When Cathay Pacific announced its nonstop Hong Kong–New York service in 2001, the announcement said it would fly over the North Polar region, saving more than two hours each way compared with the North Pacific routing. (Real routes also bend to follow winds and airspace, so an actual flight track is close to the great circle, not on it.)

The distance an aircraft cares about is not the distance in any map. It is measured on the sphere, and it differs from the straight-line distance through the Earth and from the distance a ruler measures on a chart. Each of these is a legitimate way of measuring distance between the same pairs of points, and each obeys the same four rules.

Definition 1.1 Metric space

A metric space (X,d)(X, d) is a set XX with a function d:X×X→[0,∞)d : X \times X \to [0, \infty), the metric or distance, such that for all x,y,z∈Xx, y, z \in X:

  1. d(x,x)=0d(x, x) = 0;
  2. (positivity) d(x,y)>0d(x, y) > 0 if x≠yx \neq y;
  3. (symmetry) d(x,y)=d(y,x)d(x, y) = d(y, x);
  4. (triangle inequality) d(x,z)≤d(x,y)+d(y,z)d(x, z) \leq d(x, y) + d(y, z).

The triangle inequality carries nearly all of the weight. It says that a detour through yy can't be shorter than going directly. In every argument of 2A.6 Sequences and 2A.9 Continuous Functions that split ∣a−c∣|a - c| into ∣a−b∣+∣b−c∣|a - b| + |b - c|, the triangle inequality for dd does the same job here, and those arguments carry over word for word.

A useful consequence, the reverse triangle inequality, says that distances to a fixed point change no faster than the point moves:

∣d(x,z)−d(y,z)∣≤d(x,y).|d(x, z) - d(y, z)| \leq d(x, y).

(Apply the triangle inequality twice, once with yy as the detour and once with xx.)

Definition 1.2 Convergence

A sequence (xn)(x_n) in a metric space (X,d)(X, d) converges to x∈Xx \in X if d(xn,x)→0d(x_n, x) \to 0 as a sequence of real numbers; that is, for every ε>0\varepsilon > 0 there is an NN with d(xn,x)≤εd(x_n, x) \leq \varepsilon for all n≥Nn \geq N.

Limits are unique: if xn→xx_n \to x and xn→yx_n \to y, then d(x,y)≤d(x,xn)+d(xn,y)→0d(x, y) \leq d(x, x_n) + d(x_n, y) \to 0, so d(x,y)=0d(x, y) = 0 and x=yx = y by positivity. This is the first place positivity is used. Without it, "the limit" would not make sense.

A zoo of metric spaces

Three metrics on Rn\mathbb{R}^n

For points x=(x1,…,xn)x = (x_1, \dots, x_n) and y=(y1,…,yn)y = (y_1, \dots, y_n) of Rn\mathbb{R}^n there are three standard distances:

dℓ2(x,y)=(∑i=1n(xi−yi)2)1/2,dℓ1(x,y)=∑i=1n∣xi−yi∣,dℓ∞(x,y)=max⁡i∣xi−yi∣.d_{\ell^2}(x, y) = \Big(\sum_{i=1}^n (x_i - y_i)^2\Big)^{1/2}, \quad d_{\ell^1}(x, y) = \sum_{i=1}^n |x_i - y_i|, \quad d_{\ell^\infty}(x, y) = \max_{i} |x_i - y_i|.

The first is the Euclidean metric, the ruler distance. The second is the taxicab metric, the distance travelled along a grid of streets. The third is the sup (or maximum) metric, the largest disagreement in any one coordinate.

For dℓ1d_{\ell^1} and dℓ∞d_{\ell^\infty}, the triangle inequality follows coordinate by coordinate from the one on R\mathbb{R}. For the Euclidean metric it needs one idea.

Lemma 1.3 Cauchy–Schwarz

For u,v∈Rnu, v \in \mathbb{R}^n, ∣∑iuivi∣≤(∑iui2)1/2(∑ivi2)1/2\big|\sum_i u_i v_i\big| \leq \big(\sum_i u_i^2\big)^{1/2}\big(\sum_i v_i^2\big)^{1/2}.

Proof. Write u⋅v=∑uiviu \cdot v = \sum u_i v_i and ∥u∥=(u⋅u)1/2\|u\| = (u \cdot u)^{1/2}. If v=0v = 0 there is nothing to prove. Otherwise, for every real tt,

0≤∥u−tv∥2=∥u∥2−2t (u⋅v)+t2∥v∥2.0 \leq \|u - t v\|^2 = \|u\|^2 - 2t\,(u \cdot v) + t^2\|v\|^2.

A quadratic in tt that is never negative has discriminant at most 00: 4(u⋅v)2−4∥u∥2∥v∥2≤04(u\cdot v)^2 - 4\|u\|^2\|v\|^2 \leq 0.

With u=x−yu = x - y and v=y−zv = y - z, expanding ∥u+v∥2=∥u∥2+2 u⋅v+∥v∥2≤(∥u∥+∥v∥)2\|u + v\|^2 = \|u\|^2 + 2\,u\cdot v + \|v\|^2 \leq (\|u\| + \|v\|)^2 gives dℓ2(x,z)≤dℓ2(x,y)+dℓ2(y,z)d_{\ell^2}(x, z) \leq d_{\ell^2}(x, y) + d_{\ell^2}(y, z).

The three metrics give the same answer on the real line, and different answers in the plane. The clearest way to see the difference is to draw each one's unit ball, the set of points at distance less than 11 from the origin.

Figure 1.1. The unit balls of dℓ1d_{\ell^1} (diamond), dℓ2d_{\ell^2} (disc) and dℓ∞d_{\ell^\infty} (square) in R2\mathbb{R}^2. They are nested because dℓ∞≤dℓ2≤dℓ1d_{\ell^\infty} \leq d_{\ell^2} \leq d_{\ell^1}: a smaller distance means a larger ball.
In the world Model The taxicab metric in Manhattan

On a grid of streets, a pedestrian or a taxi can't cut across blocks, so the distance that matters is the taxicab distance, measured along the grid's two directions. Most of Manhattan is laid out on the grid of the Commissioners' Plan of 1811, whose avenues run about 29° east of true north, roughly along the island. So the taxicab metric that describes Manhattan is dℓ1d_{\ell^1} in coordinates rotated by 29° from north and east, not in map coordinates. Between two corners, the walking distance is between 11 and 2≈1.41\sqrt2 \approx 1.41 times the straight-line distance: equal when both corners are on the same street, and largest when the straight line runs at 45° to the grid (Exercise 1.15). Every shortest walk is a staircase, and there are usually very many of them (Figure 1.2).

Figure 1.2. On a street grid, every staircase path from AA to BB that never doubles back has the same length, dℓ1(A,B)=6+4=10d_{\ell^1}(A, B) = 6 + 4 = 10 blocks. The straight line (dashed) has length 52≈7.2\sqrt{52} \approx 7.2 blocks, but nothing can travel along it.

The sphere

Put the Earth's centre at the origin and represent a place by its unit vector x∈S2={x∈R3:∥x∥=1}x \in S^2 = \{x \in \mathbb{R}^3 : \|x\| = 1\}. The great-circle distance on a sphere of radius RR is RR times the angle between the vectors:

dS2(x,y)=R arccos⁡(x⋅y).d_{S^2}(x, y) = R\,\arccos(x \cdot y).

Positivity and symmetry are immediate. The triangle inequality, which says that angles between directions obey ∠(x,z)≤∠(x,y)+∠(y,z)\angle(x, z) \leq \angle(x, y) + \angle(y, z), is Exercise 1.16.

The arccos formula loses precision when xx and yy are close, because arccos⁡\arccos is very steep near 11. Navigation software uses an equivalent form, the haversine formula, which with latitudes φi\varphi_i and longitudes λi\lambda_i reads

d=2Rarcsin⁡sin⁡2φ2−φ12+cos⁡φ1cos⁡φ2sin⁡2λ2−λ12.d = 2R\arcsin\sqrt{\sin^2\tfrac{\varphi_2 - \varphi_1}{2} + \cos\varphi_1\cos\varphi_2\sin^2\tfrac{\lambda_2 - \lambda_1}{2}}.

For New York and Hong Kong this gives the 12,97012{,}970 km above.

Figure 1.3. New York to Hong Kong. The rhumb line (constant compass bearing) is straight on a Mercator chart; the great circle is the shortest path on the sphere, and on the chart it curves up to about 84° N. Seen from above the pole (right), the great circle looks nearly straight. Computed on a sphere of radius 63716371 km: the great circle is 12,97012{,}970 km, the rhumb line about 16,35016{,}350 km.

The Mercator map is a function from (most of) the sphere to the plane, and it does not preserve distance. No map can: there is no way to flatten any piece of a sphere onto the plane while keeping every distance (Gauss's Theorema Egregium, 8A.9 The Curvature of Surfaces). That is the first sign of curvature, the subject of Book 9A.

Discrete spaces, codes and strings

On any set, the discrete metric d(x,y)=1d(x, y) = 1 for x≠yx \neq y (and 00 for x=yx = y) satisfies the axioms. It is useful mainly as a test case: it shows what can go wrong when a space has no notion of "nearby".

More interesting discrete spaces come from information.

Definition 1.4 Hamming distance

For two strings x,yx, y of the same length nn over an alphabet, the Hamming distance dH(x,y)d_H(x, y) is the number of positions in which they differ.

The triangle inequality holds because a position in which xx and zz differ must be one in which xx differs from yy or yy differs from zz. For binary strings of length 33, the space is the eight corners of a cube, and dHd_H counts edges along a shortest path between corners (Figure 1.4).

Proposition 1.5 Error correction is disjointness of balls

Let CC be a set of codewords of length nn whose pairwise Hamming distances are all at least 2t+12t + 1. Then the closed balls of radius tt around the codewords are disjoint. So if a codeword is sent and at most tt symbols are corrupted, the received string is closer to the sent codeword than to any other, and decoding to the nearest codeword recovers it.

Proof. If a string rr had dH(r,c)≤td_H(r, c) \leq t and dH(r,c′)≤td_H(r, c') \leq t for codewords c≠c′c \neq c', the triangle inequality would give dH(c,c′)≤2td_H(c, c') \leq 2t, a contradiction.

Figure 1.4. The Hamming cube {0,1}3\{0,1\}^3. The code {000,111}\{000, 111\} has minimum distance 3=2⋅1+13 = 2\cdot 1 + 1, so the balls of radius 11 around the codewords (shaded) are disjoint and cover the cube: any single flipped bit is corrected by majority vote.
In the world In use QR codes survive damage

A QR code stores its data as bytes protected by Reed–Solomon codes, as specified in the international standard ISO/IEC 18004. The symbols are bytes rather than bits, but the principle is Proposition 1.5: the codewords are chosen far apart in Hamming distance, so a damaged code is still closer to the right message than to any other. The standard offers four error-correction levels, L, M, Q and H, which can recover roughly 7%7\%, 15%15\%, 25%25\% and 30%30\% of the codewords respectively. Higher levels place the codewords farther apart, at the cost of more redundant bytes. That is why a QR code still scans with a logo printed over its middle.

For strings of different lengths, Hamming distance is useless: "kitten" and "sitting" don't even line up. The edit distance (or Levenshtein distance) between two strings is the least number of single-character insertions, deletions and substitutions that turn one into the other. From "kitten" to "sitting" it is 33: substitute k→s, substitute e→i, insert g. It is a metric. The triangle inequality holds because an edit sequence from xx to yy followed by one from yy to zz is an edit sequence from xx to zz.

In the world In use The triangle inequality prunes a search

A spell checker must find the dictionary words within edit distance 22 of a misspelling, without comparing it to every word in the dictionary. A BK-tree (Burkhard and Keller, 1973) stores the dictionary in a tree where each child of a word ww is filed under its distance from ww. To search for words within distance rr of a query qq, compute k=d(q,w)k = d(q, w) at the root. The reverse triangle inequality says that a word vv with d(q,v)≤rd(q, v) \leq r must have ∣d(v,w)−k∣≤r|d(v, w) - k| \leq r, so only the children filed under distances from k−rk - r to k+rk + r need to be explored. The rest of the tree is skipped without being looked at. The same pruning, valid in any metric space, is used in nearest-neighbour search for images, sounds and DNA sequences. It fails for "distances" that violate the triangle inequality, which is one practical reason the axiom matters.

Spaces of functions

The most important metric spaces in this guidebook are spaces whose points are functions.

Definition 1.6 The sup metric

Let XX be any set, and let B(X)B(X) be the set of bounded functions f:X→Rf : X \to \mathbb{R}. The sup metric is

d∞(f,g)=sup⁡x∈X∣f(x)−g(x)∣.d_\infty(f, g) = \sup_{x \in X} |f(x) - g(x)|.

It is a metric: the supremum is finite because ff and gg are bounded, and the triangle inequality holds pointwise and then for the supremum. Two functions are within ε\varepsilon in this metric exactly when the graph of one lies in a band of height ε\varepsilon around the graph of the other, everywhere. Convergence in d∞d_\infty is uniform convergence, the subject of 2B.5 Uniform Convergence and Arzelà–Ascoli. On a compact interval, every continuous function is bounded (2A.9 Continuous Functions), so C([a,b])C([a, b]), the continuous functions on [a,b][a, b], is a metric space with d∞d_\infty.

On C([a,b])C([a, b]) there is another natural metric, the area between the graphs:

d1(f,g)=∫ab∣f(x)−g(x)∣ dx.d_1(f, g) = \int_a^b |f(x) - g(x)|\,dx.

The triangle inequality comes from ∣f−h∣≤∣f−g∣+∣g−h∣|f - h| \leq |f - g| + |g - h| and monotonicity of the integral (2A.11 The Riemann Integral). Positivity is the interesting axiom: if f≠gf \neq g, then ∣f−g∣|f - g| is positive at some point, hence (by continuity) at least some δ>0\delta > 0 on a small interval around it, so the integral is positive. For merely integrable functions this fails. A function that is 11 at one point and 00 elsewhere has integral 00. Course 3 deals with this by agreeing to identify functions that differ on a negligible set (3A.3 The Lebesgue Integral).

Open and closed sets

From here on, (X,d)(X, d) is a metric space. The definitions are those of 2A.9 Continuous Functions for the real line, with ∣x−y∣|x - y| replaced by d(x,y)d(x, y).

Definition 1.7 Balls

The open ball of radius r>0r > 0 about x0x_0 is B(x0,r)={x∈X:d(x,x0)<r}B(x_0, r) = \{x \in X : d(x, x_0) < r\}. The closed ball is {x∈X:d(x,x0)≤r}\{x \in X : d(x, x_0) \leq r\}.

Balls depend on the metric. In R2\mathbb{R}^2 they are diamonds, discs or squares (Figure 1.1). In C([a,b])C([a, b]) with d∞d_\infty, the ball of radius ε\varepsilon around ff is the set of continuous functions whose graphs stay inside the band of half-width ε\varepsilon around the graph of ff, with some room to spare (the supremum of ∣g−f∣|g - f| is attained on [a,b][a, b], so it must be strictly less than ε\varepsilon). In the discrete metric, the ball of radius 12\tfrac12 around xx is just {x}\{x\}.

Definition 1.8 Interior, boundary, open and closed sets

Let E⊆XE \subseteq X and x0∈Xx_0 \in X.

  • x0x_0 is an interior point of EE if some ball B(x0,r)B(x_0, r) lies inside EE; an exterior point if some ball around x0x_0 misses EE entirely; and a boundary point if it is neither, that is, if every ball around x0x_0 meets both EE and its complement.
  • x0x_0 is an adherent point of EE if every ball around x0x_0 meets EE. The set of adherent points is the closure E‾\overline{E}.
  • EE is open if it contains none of its boundary points (equivalently, every point of EE is interior). EE is closed if it contains all of its boundary points (equivalently, E‾=E\overline{E} = E).

Open balls are open. If x∈B(x0,r)x \in B(x_0, r), let s=r−d(x,x0)>0s = r - d(x, x_0) > 0. Then B(x,s)⊆B(x0,r)B(x, s) \subseteq B(x_0, r) by the triangle inequality: d(y,x0)≤d(y,x)+d(x,x0)<s+d(x,x0)=rd(y, x_0) \leq d(y, x) + d(x, x_0) < s + d(x, x_0) = r. So every point of an open ball is an interior point. In the same way, closed balls are closed (Exercise 1.17).

Sets need not be either open or closed: [0,1)[0, 1) in R\mathbb{R} is neither. And a set can be both: XX and ∅\varnothing always are, and in the discrete metric every set is both, since every ball of radius 12\tfrac12 is a single point.

The most-used fact connects closedness to sequences. It is what lets us prove a set is closed by taking limits.

Proposition 1.9 Closed sets contain their limits

Let E⊆XE \subseteq X. A point xx is in E‾\overline{E} if and only if some sequence in EE converges to xx. Hence EE is closed if and only if every sequence in EE that converges in XX has its limit in EE.

Proof. If x∈E‾x \in \overline{E}, then for each nn the ball B(x,1n)B(x, \tfrac1n) meets EE; choose xnx_n in it. Then d(xn,x)<1n→0d(x_n, x) < \tfrac1n \to 0. Conversely, if xn∈Ex_n \in E and xn→xx_n \to x, then every ball B(x,r)B(x, r) contains xnx_n for large nn, so it meets EE, and x∈E‾x \in \overline{E}. The second sentence follows because EE is closed exactly when E‾=E\overline{E} = E.

Proposition 1.10 Open and closed are complementary

EE is open if and only if its complement X∖EX \setminus E is closed. Any union of open sets is open, and any intersection of finitely many open sets is open. Correspondingly, any intersection of closed sets is closed, and any finite union of closed sets is closed.

Proof. EE and X∖EX \setminus E have the same boundary points, by the symmetric definition. So EE contains none of them exactly when X∖EX \setminus E contains all of them. If each UαU_\alpha is open and x∈⋃Uαx \in \bigcup U_\alpha, then xx lies in some UαU_\alpha, which contains a ball around xx; so the union does too. If U1,…,UkU_1, \dots, U_k are open and xx lies in all of them, with B(x,ri)⊆UiB(x, r_i) \subseteq U_i, then the ball of radius min⁡iri\min_i r_i lies in all of them. (The minimum of finitely many positive numbers is positive. For infinitely many it may be 00: ⋂n(−1n,1n)={0}\bigcap_n (-\tfrac1n, \tfrac1n) = \{0\} is not open.) The statements about closed sets follow by taking complements.

Note

These properties of open sets are all that is needed to define continuity and convergence, and they are what survives when the metric is thrown away. A collection of subsets of XX that contains ∅\varnothing and XX and is closed under arbitrary unions and finite intersections is called a topology. Topological spaces are the subject of 7A.1 Topological Spaces and Quotients. Until then, every space we meet has a metric, and the metric is the easiest way to work.

Subspaces and relative topology

Any subset Y⊆XY \subseteq X is a metric space with the same distance, restricted to pairs of points of YY. This is how the sphere S2S^2 inherits the straight-line (chordal) distance from R3\mathbb{R}^3, and how [0,1][0, 1] inherits its metric from R\mathbb{R}.

Being open is then a statement relative to the space you are in. In Y=[0,1]Y = [0, 1], the set [0,12)[0, \tfrac12) is open: the ball of radius 12\tfrac12 around 00 in YY is {y∈[0,1]:∣y∣<12}=[0,12)\{y \in [0, 1] : |y| < \tfrac12\} = [0, \tfrac12). But [0,12)[0, \tfrac12) is not open in R\mathbb{R}, because no interval around 00 fits inside it.

Proposition 1.11 Relatively open sets

Let Y⊆XY \subseteq X. A set E⊆YE \subseteq Y is open in (Y,d)(Y, d) if and only if E=V∩YE = V \cap Y for some set VV that is open in XX. The same holds with "closed" in place of "open".

Proof. A ball in YY is the intersection of YY with the ball in XX of the same centre and radius. If EE is open in YY, then for each y∈Ey \in E choose ryr_y with BY(y,ry)⊆EB_Y(y, r_y) \subseteq E, and let V=⋃y∈EBX(y,ry)V = \bigcup_{y \in E} B_X(y, r_y). This is open in XX, and V∩Y=⋃yBY(y,ry)=EV \cap Y = \bigcup_y B_Y(y, r_y) = E. Conversely, if E=V∩YE = V \cap Y with VV open in XX, then each y∈Ey \in E has a ball BX(y,r)⊆VB_X(y, r) \subseteq V, so BY(y,r)=BX(y,r)∩Y⊆EB_Y(y, r) = B_X(y, r) \cap Y \subseteq E. For closed sets, take complements within YY.

Relative topology will matter as soon as we work on a manifold, which lives inside some larger space but is studied as a space in its own right (8A.1 Smooth Structures).

Equivalent and inequivalent metrics

The three metrics on Rn\mathbb{R}^n give different numbers but, it turns out, the same convergent sequences and the same open sets. The reason is that each is bounded by a constant multiple of each other:

dℓ∞(x,y)≤dℓ2(x,y)≤dℓ1(x,y)≤n dℓ∞(x,y).d_{\ell^\infty}(x, y) \leq d_{\ell^2}(x, y) \leq d_{\ell^1}(x, y) \leq n\, d_{\ell^\infty}(x, y).

(The first two inequalities compare a largest term, a root-sum-of-squares and a sum of non-negative terms; the last bounds each of nn terms by the largest.)

Definition 1.12 Equivalent metrics

Two metrics dd and d′d' on the same set XX are equivalent if they have the same convergent sequences with the same limits. They are uniformly equivalent (or bi-Lipschitz equivalent) if there are constants c,C>0c, C > 0 with c d(x,y)≤d′(x,y)≤C d(x,y)c\,d(x, y) \leq d'(x, y) \leq C\,d(x, y) for all x,yx, y.

Uniformly equivalent metrics are equivalent: d(xn,x)→0d(x_n, x) \to 0 if and only if d′(xn,x)→0d'(x_n, x) \to 0. By Proposition 1.9, equivalent metrics have the same closed sets, hence the same open sets. So on Rn\mathbb{R}^n, one can use whichever of the three is convenient for the problem at hand: ℓ∞\ell^\infty to handle coordinates one at a time, ℓ2\ell^2 for geometry, ℓ1\ell^1 for counting.

In infinite-dimensional spaces, this freedom disappears.

Example 1.13 Two inequivalent metrics on C([0,1])C([0, 1])

Let fnf_n be the "tent" that rises linearly from 00 at x=0x = 0 to height 11 at x=1nx = \tfrac1n, falls back to 00 at x=2nx = \tfrac2n, and is 00 on [2n,1][\tfrac2n, 1] (for n≥2n \geq 2). Then

d1(fn,0)=12⋅2n⋅1=1n→0,d∞(fn,0)=1 for every n.d_1(f_n, 0) = \tfrac12 \cdot \tfrac2n \cdot 1 = \tfrac1n \to 0, \qquad d_\infty(f_n, 0) = 1 \text{ for every } n.

So fn→0f_n \to 0 in the d1d_1 metric but not in the sup metric. The metrics are not equivalent. The general inequality d1(f,g)≤d∞(f,g)d_1(f, g) \leq d_\infty(f, g) (on an interval of length 11) holds, but no inequality in the other direction can, because a tall narrow tent has small area.

Figure 1.5. The tents fnf_n for n=2,4,8n = 2, 4, 8. Their areas 1n\tfrac1n tend to 00, so fn→0f_n \to 0 in the d1d_1 metric. Their heights stay 11, so they don't converge to 00 uniformly. "Close" depends on the metric.

Which metric is right depends on the question. For a sensor that must never exceed a threshold, the worst case matters, and the sup metric is the right one. For the total energy delivered by a signal, the area metric (or its square-integral cousin) is the right one. 2B.5 Uniform Convergence and Arzelà–Ascoli develops the sup metric, and Courses 3 and 4 develop the integral metrics. A whole family of them, one for each exponent pp, will be needed (3A.7 Lᵖ Spaces and Jensen’s Inequality), and the inequalities that relate them, the Sobolev inequalities of 4A.10 Sobolev Embeddings and Critical Exponents, are among the main tools of geometric analysis.

Where this goes Metric spaces of metric spaces

Once a Riemannian manifold is turned into a metric space (9A.3 Geodesics and the Exponential Map), we can ask how far apart two whole spaces are. For two subsets A,BA, B of a metric space, the Hausdorff distance is the least rr such that each set lies within distance rr of the other (Exercise 1.21). Gromov's extension, the Gromov–Hausdorff distance, compares two metric spaces that don't sit inside a common space, by asking how well they can be placed inside one. It makes "the space of all compact metric spaces" into a metric space (9B.4 Convergence of Manifolds). That is the setting in which one says that a sequence of rescaled Ricci flows converges to a limit, and the limits obtained this way, the blow-ups at a singularity, are how Perelman classified singularities (11B.4 Singularities, 12B.2 The Structure of κ-Solutions).

History

The idea of an abstract distance came from analysis, not geometry. Maurice Fréchet's 1906 thesis studied sets of functions and curves on which only a notion of distance was given, and showed that much of the theory of limits carried over to them. Felix Hausdorff named and systematised these "metric spaces" in his Grundzüge der Mengenlehre (1914), the founding text of general topology. The examples that drove both were spaces of functions, exactly the spaces that differential equations need. Hamming distance came from engineering: Richard Hamming introduced it in his 1950 paper on error-detecting and error-correcting codes, written at Bell Labs for computers that had to keep running despite occasional single-bit errors.

Recall Where we stand

A metric space is a set with a distance obeying four axioms, the decisive one being the triangle inequality. Convergence, open and closed sets, closure and boundary are defined exactly as on R\mathbb{R}, and a set is closed precisely when it contains the limits of its convergent sequences. Subsets inherit a metric, and openness is relative to the ambient space. On Rn\mathbb{R}^n the standard metrics are uniformly equivalent, but on spaces of functions natural metrics can disagree about which sequences converge. 2B.2 Completeness and Contraction asks which metric spaces are complete, and proves the theorem that makes completeness pay: the contraction mapping principle.

Exercises

Exercise 1.14 Which are metrics?

Decide which of these are metrics on R\mathbb{R}, and for each that isn't, name an axiom that fails: (a) d(x,y)=(x−y)2d(x, y) = (x - y)^2; (b) d(x,y)=∣x−y∣1/2d(x, y) = |x - y|^{1/2}; (c) d(x,y)=∣x2−y2∣d(x, y) = |x^2 - y^2|; (d) d(x,y)=∣x−y∣1+∣x−y∣d(x, y) = \frac{|x - y|}{1 + |x - y|}.

Hint

For (b) and (d), use that ϕ(t)=t1/2\phi(t) = t^{1/2} and ϕ(t)=t1+t\phi(t) = \frac{t}{1 + t} are increasing with ϕ(s+t)≤ϕ(s)+ϕ(t)\phi(s + t) \leq \phi(s) + \phi(t) for s,t≥0s, t \geq 0.

Solution

(a) Not a metric: d(0,2)=4>2=d(0,1)+d(1,2)d(0, 2) = 4 > 2 = d(0, 1) + d(1, 2), so the triangle inequality fails. (b) A metric: ∣x−z∣1/2≤(∣x−y∣+∣y−z∣)1/2≤∣x−y∣1/2+∣y−z∣1/2|x - z|^{1/2} \leq (|x - y| + |y - z|)^{1/2} \leq |x - y|^{1/2} + |y - z|^{1/2}, squaring the last inequality to check it. (c) Not a metric: d(1,−1)=0d(1, -1) = 0 although 1≠−11 \neq -1, so positivity fails. (d) A metric, by the hint. It is bounded by 11 but has the same convergent sequences as ∣x−y∣|x - y|: so every metric is equivalent to a bounded one.

Exercise 1.15 Walking versus flying

Show that for x,y∈R2x, y \in \mathbb{R}^2, dℓ2(x,y)≤dℓ1(x,y)≤2 dℓ2(x,y)d_{\ell^2}(x, y) \leq d_{\ell^1}(x, y) \leq \sqrt2\, d_{\ell^2}(x, y), with equality on the right exactly when the segment from xx to yy makes an angle of 45° with the axes. What are the best constants in Rn\mathbb{R}^n?

Solution

With a=∣x1−y1∣a = |x_1 - y_1| and b=∣x2−y2∣b = |x_2 - y_2|: (a+b)2=a2+b2+2ab≥a2+b2(a + b)^2 = a^2 + b^2 + 2ab \geq a^2 + b^2 gives the left inequality, and (a+b)2≤2(a2+b2)(a + b)^2 \leq 2(a^2 + b^2), which is (a−b)2≥0(a - b)^2 \geq 0, gives the right one, with equality when a=ba = b. In Rn\mathbb{R}^n, dℓ2≤dℓ1≤n dℓ2d_{\ell^2} \leq d_{\ell^1} \leq \sqrt n\, d_{\ell^2}, the right one by Cauchy–Schwarz applied to (1,…,1)(1, \dots, 1) and (∣xi−yi∣)i(|x_i - y_i|)_i.

Exercise 1.16 The triangle inequality on the sphere

For unit vectors x,y,z∈R3x, y, z \in \mathbb{R}^3, let α=arccos⁡(x⋅y)\alpha = \arccos(x \cdot y) and β=arccos⁡(y⋅z)\beta = \arccos(y \cdot z), both in [0,π][0, \pi]. Write x=cos⁡α y+sin⁡α ux = \cos\alpha\, y + \sin\alpha\, u and z=cos⁡β y+sin⁡β vz = \cos\beta\, y + \sin\beta\, v with u,vu, v unit vectors perpendicular to yy. Show that x⋅z≥cos⁡(α+β)x \cdot z \geq \cos(\alpha + \beta), and deduce that arccos⁡(x⋅z)≤α+β\arccos(x \cdot z) \leq \alpha + \beta. This proves the triangle inequality for great-circle distance.

Solution

x⋅z=cos⁡αcos⁡β+sin⁡αsin⁡β (u⋅v)≥cos⁡αcos⁡β−sin⁡αsin⁡β=cos⁡(α+β)x \cdot z = \cos\alpha\cos\beta + \sin\alpha\sin\beta\,(u \cdot v) \geq \cos\alpha\cos\beta - \sin\alpha\sin\beta = \cos(\alpha + \beta), using u⋅v≥−1u \cdot v \geq -1 (Cauchy–Schwarz) and sin⁡α,sin⁡β≥0\sin\alpha, \sin\beta \geq 0. If α+β≤π\alpha + \beta \leq \pi, then since arccos⁡\arccos is decreasing on [−1,1][-1, 1], arccos⁡(x⋅z)≤arccos⁡(cos⁡(α+β))=α+β\arccos(x \cdot z) \leq \arccos(\cos(\alpha + \beta)) = \alpha + \beta. If α+β>π\alpha + \beta > \pi, then arccos⁡(x⋅z)≤π<α+β\arccos(x \cdot z) \leq \pi < \alpha + \beta anyway.

Exercise 1.17 Closed balls and closures

(a) Show that a closed ball {x:d(x,x0)≤r}\{x : d(x, x_0) \leq r\} is a closed set, using Proposition 1.9 and the reverse triangle inequality. (b) In the discrete metric on a set with at least two points, show that the closure of the open ball B(x0,1)B(x_0, 1) is not the closed ball of radius 11. (So "closure of the open ball" and "closed ball" can differ.)

Solution

(a) If d(xn,x0)≤rd(x_n, x_0) \leq r and xn→xx_n \to x, then ∣d(xn,x0)−d(x,x0)∣≤d(xn,x)→0|d(x_n, x_0) - d(x, x_0)| \leq d(x_n, x) \to 0, so d(x,x0)=lim⁡d(xn,x0)≤rd(x, x_0) = \lim d(x_n, x_0) \leq r. (b) B(x0,1)={x0}B(x_0, 1) = \{x_0\}, which is closed, so its closure is {x0}\{x_0\}. The closed ball of radius 11 is the whole space.

Exercise 1.18 Open relative to what?

Let Y=[0,1]∪[2,3]Y = [0, 1] \cup [2, 3] with the metric from R\mathbb{R}. Show that [0,1][0, 1] is both open and closed in YY. (In 2B.4 Connectedness this is exactly what it means for YY to be disconnected.)

Exercise 1.19 How many codewords fit?

A binary code of length nn has minimum distance 2t+12t + 1. Show that the number of codewords is at most 2n/∑k=0t(nk)2^n \big/ \sum_{k=0}^t \binom{n}{k} (the Hamming bound), by counting the points in the disjoint balls of Proposition 1.5. For n=7n = 7 and t=1t = 1 the bound is 1616; the Hamming (7,4)(7, 4) code attains it, so its balls tile the whole cube.

Solution

A closed ball of radius tt in {0,1}n\{0,1\}^n contains ∑k=0t(nk)\sum_{k=0}^t \binom nk strings (choose which kk positions to flip). The balls around distinct codewords are disjoint and all lie in a set of 2n2^n strings. For n=7n = 7, t=1t = 1: 27/(1+7)=16=242^7/(1 + 7) = 16 = 2^4.

Exercise 1.20 Comparing the function metrics

(a) Show that d1(f,g)≤(b−a) d∞(f,g)d_1(f, g) \leq (b - a)\,d_\infty(f, g) for f,g∈C([a,b])f, g \in C([a, b]), so that uniform convergence implies convergence in d1d_1. (b) Use Example 1.13 to show that the open ball {f:d∞(f,0)<1}\{f : d_\infty(f, 0) < 1\} is open for d∞d_\infty but not for d1d_1. (So the two metrics have different open sets, not only different convergent sequences.)

Solution

(a) ∫ab∣f−g∣≤∫abd∞(f,g)=(b−a) d∞(f,g)\int_a^b |f - g| \leq \int_a^b d_\infty(f, g) = (b - a)\,d_\infty(f, g). (b) The zero function is in the set. Every d1d_1-ball around 00, of radius rr, contains 2fn2f_n for n>2/rn > 2/r, since d1(2fn,0)=2nd_1(2f_n, 0) = \tfrac2n; but d∞(2fn,0)=2d_\infty(2f_n, 0) = 2, so 2fn2f_n is not in the set. Hence 00 is not a d1d_1-interior point.

Exercise 1.21 Rehearsal: the Hausdorff distance

For non-empty closed bounded subsets A,BA, B of Rn\mathbb{R}^n, let Ar={x:d(x,a)≤r for some a∈A}A_r = \{x : d(x, a) \leq r \text{ for some } a \in A\} and define dH(A,B)=inf⁡{r≥0:A⊆Br and B⊆Ar}d_{\mathcal{H}}(A, B) = \inf\{r \geq 0 : A \subseteq B_r \text{ and } B \subseteq A_r\}. (a) Compute dHd_{\mathcal{H}} between the unit circle and the closed unit disc in R2\mathbb{R}^2, and between [0,1][0, 1] and {0,1n,2n,…,1}\{0, \tfrac1n, \tfrac2n, \dots, 1\}. (b) Show that dHd_{\mathcal{H}} satisfies the triangle inequality. (c) Show that a sequence of finite sets can converge in dHd_{\mathcal{H}} to an interval. This is how a sequence of discrete approximations, or of shrinking and rescaled shapes, can converge to a continuum. The Gromov–Hausdorff version of this metric is the one used for limits of Riemannian manifolds in 9B.4 Convergence of Manifolds.

Solution

(a) Every point of the disc is within 11 of the circle, and the centre is exactly 11 away, so dH=1d_{\mathcal{H}} = 1. For the grid, every point of [0,1][0, 1] is within 12n\tfrac1{2n} of a grid point, and the midpoint of a gap is exactly that far, so dH=12nd_{\mathcal{H}} = \tfrac1{2n}. (b) If A⊆BrA \subseteq B_r and B⊆CsB \subseteq C_s, then A⊆Cr+sA \subseteq C_{r+s} by the triangle inequality in Rn\mathbb{R}^n; similarly in the other direction. (c) By (a), the grids converge to [0,1][0, 1].

© 2026 NeckPinch (www.neckpinch.com). All content in the guidebook (text, mathematics, figures and exercises) is protected by copyright. All rights reserved. No part may be copied, republished or redistributed without written permission.