© 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.
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 · 9 sections
- 1.1Distance, in general
- 1.2A zoo of metric spaces
- 1.2.1Three metrics on Rn\mathbb{R}^nRn
- 1.2.2The sphere
- 1.2.3Discrete spaces, codes and strings
- 1.2.4Networks and distributions
- 1.3Spaces of functions
- 1.4Open and closed sets
- 1.5Continuous maps
- 1.6Subspaces and relative topology
- 1.7Equivalent and inequivalent metrics
- 1.8History
- 1.9Exercises
- ↗Free resources
Book 2A was about one space, the real line, and one way of measuring distance in it, . 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 . 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 , 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;
- compute interior, closure and boundary of concrete sets, and use their basic properties;
- define continuity between metric spaces, and use its four equivalent forms (ε–δ, sequences, open sets, closed sets);
- work with subsets of a metric space, and tell "open in " from "open in ";
- 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
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 km, that arc is about 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.
A metric space is a set with a function , the metric or distance, such that for all :
- ;
- (positivity) if ;
- (symmetry) ;
- (triangle inequality) .
The triangle inequality carries nearly all of the weight. It says that a detour through can't be shorter than going directly. In every argument of 2A.6 Sequences and 2A.9 Continuous Functions that split into , the triangle inequality for 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:
(Apply the triangle inequality twice, once with as the detour and once with .)
What each axiom rules out. Each of the four rules excludes something that occurs in practice, and seeing the exclusions makes the rules less arbitrary.
- Without positivity, distinct points can be at distance . On continuous functions, satisfies every axiom except positivity: it cannot tell apart two functions with the same value at . Such a pseudometric is repaired by declaring points at distance to be the same point, which produces a genuine metric on the classes (2A.2 Sets, Functions and Equivalence). This is exactly how the Lebesgue spaces of Course 3 are built, where functions that differ only on a set of length zero are identified (3A.7 Lᵖ Spaces and Jensen’s Inequality).
- Without symmetry, the distance from to can differ from the distance back. Travel time in a city with one-way streets, or on foot up and down a hill, is like this. Such quasi-metrics are useful, but this guidebook never needs them.
- Without the triangle inequality, almost nothing of this chapter survives. Squared Euclidean distance is positive and symmetric, but on the line the points , , give : a detour through is "shorter" than going directly. The square is a natural quantity, and it appears in least squares and in energies, but it is not a distance. Its square root is.
A sequence in a metric space converges to if as a sequence of real numbers; that is, for every there is an with for all .
Limits are unique: if and , then , so and 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
For points and of there are three standard distances:
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 and , the triangle inequality follows coordinate by coordinate from the one on . For the Euclidean metric it needs one idea.
For , .
Proof. Write and . If there is nothing to prove. Otherwise, for every real ,
A quadratic in that is never negative has discriminant at most : .
With and , expanding gives .
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 from the origin.
Whatever their differences, the three metrics agree about which sequences converge, and convergence turns out to be something you can check one coordinate at a time.
Let be a sequence in and . The following are equivalent: in ; in ; in ; and in for each coordinate .
Proof. For each , . So convergence in implies convergence in , which implies convergence in , which implies convergence of every coordinate. Conversely, suppose every coordinate converges, and let . For each choose with for , and let . For , .
The step "" uses that there are finitely many coordinates. In a space of infinite sequences it fails: the sequences , with a single in position , converge to in every coordinate, yet each is at sup-distance from (Exercise 1.28). This is the first of many places where finite and infinite dimensions part company.
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 in coordinates rotated by 29° from north and east, not in map coordinates. Between two corners, the walking distance is between and 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.22). Every shortest walk is a staircase, and there are usually very many of them (Figure 1.2).
The sphere
Put the Earth's centre at the origin and represent a place by its unit vector . The great-circle distance on a sphere of radius is times the angle between the vectors:
Positivity and symmetry are immediate. The triangle inequality, which says that angles between directions obey , is Exercise 1.23.
The arccos formula loses precision when and are close, because is very steep near . Navigation software uses an equivalent form, the haversine formula, which with latitudes and longitudes reads
For New York and Hong Kong this gives the km above.
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 for (and for ) satisfies the axioms. (For the triangle inequality: if , then differs from at least one of them, so the right side is at least .) It is useful mainly as a test case: it shows what can go wrong when a space has no notion of "nearby". For instance, a sequence converges in the discrete metric only if it is eventually constant: taking in the definition of convergence forces , that is , from some point on.
More interesting discrete spaces come from information.
For two strings of the same length over an alphabet, the Hamming distance is the number of positions in which they differ.
The triangle inequality holds because a position in which and differ must be one in which differs from or differs from . For binary strings of length , the space is the eight corners of a cube, and counts edges along a shortest path between corners (Figure 1.4).
Let be a set of codewords of length whose pairwise Hamming distances are all at least . Then the closed balls of radius around the codewords are disjoint. So if a codeword is sent and at most 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 had and for codewords , the triangle inequality would give , a contradiction.
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.6: 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 , , and 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 : substitute k→s, substitute e→i, insert g. It is a metric. The triangle inequality holds because an edit sequence from to followed by one from to is an edit sequence from to .
A spell checker must find the dictionary words within edit distance 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 is filed under its distance from . To search for words within distance of a query , compute at the root. The reverse triangle inequality says that a word with must have , so only the children filed under distances from to 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.
Networks and distributions
Two more kinds of metric space are worth meeting early, because they are everywhere in applications and both return later in the route.
Shortest paths. In a connected network (a road map, a computer network, a social network) with a positive length attached to each link, let be the length of the shortest route from to . This is a metric. Positivity and symmetry are clear for two-way links, and the triangle inequality holds because following a shortest route from to and then one from to is a route from to , so the shortest one is no longer. Satellite navigation computes this metric, by Dijkstra's algorithm and its refinements, and the triangle inequality is what lets those refinements discard most of the map without looking at it, as the BK-tree above does for words. The great-circle distance on the sphere is the same idea for a continuum of routes: the length of the shortest path, which is how every Riemannian manifold becomes a metric space (9A.3 Geodesics and the Exponential Map).
Distances between distributions. How far apart are two piles of sand of equal mass, or two probability distributions? One answer, going back to Gaspard Monge's 1781 memoir on moving earth for fortifications and made precise by Leonid Kantorovich in 1942, is the least cost of turning one pile into the other, where moving an amount of mass a distance costs . On distributions over a metric space this defines the Wasserstein distance (also called the earth mover's distance). Two piles concentrated at single points and are at Wasserstein distance exactly , so sits inside the space of distributions without any distortion of distances. The triangle inequality holds because a transport from the first pile to the second, followed by one from the second to the third, is a transport from the first to the third. In data science the earth mover's distance compares histograms and images; in geometry it turned out to know about curvature. Lower bounds on Ricci curvature can be characterised by how entropy behaves along shortest paths in this space of distributions, the theory of John Lott, Cédric Villani and Karl-Theodor Sturm, and Robert McCann and Peter Topping showed in 2010 that Ricci flow itself can be recognised by how the heat flow contracts Wasserstein distances (6D.5 Diffusions on Manifolds and Curvature).
Spaces of functions
The most important metric spaces in this guidebook are spaces whose points are functions.
Let be any set, and let be the set of bounded functions . The sup metric is
It is a metric: the supremum is finite because and are bounded, and the triangle inequality holds pointwise and then for the supremum. Two functions are within in this metric exactly when the graph of one lies in a band of height around the graph of the other, everywhere. Convergence in 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 , the continuous functions on , is a metric space with .
On there is another natural metric, the area between the graphs:
The triangle inequality comes from and monotonicity of the integral (2A.11 The Riemann Integral). Positivity is the interesting axiom: if , then is positive at some point, hence (by continuity) at least some on a small interval around it, so the integral is positive. For merely integrable functions this fails. A function that is at one point and elsewhere has integral . 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, is a metric space. The definitions are those of 2A.9 Continuous Functions for the real line, with replaced by .
The open ball of radius about is . The closed ball is .
Balls depend on the metric. In they are diamonds, discs or squares (Figure 1.1). In with , the ball of radius around is the set of continuous functions whose graphs stay inside the band of half-width around the graph of , with some room to spare (the supremum of is attained on , so it must be strictly less than ). In the discrete metric, the ball of radius around is just .
Let and .
- is an interior point of if some ball lies inside ; an exterior point if some ball around misses entirely; and a boundary point if it is neither, that is, if every ball around meets both and its complement.
- is an adherent point of if every ball around meets . The set of adherent points is the closure .
- is open if it contains none of its boundary points (equivalently, every point of is interior). is closed if it contains all of its boundary points (equivalently, ).
The "equivalently" clauses in the definition deserve a check, since they are how openness and closedness are usually tested. Every point is exactly one of interior, exterior or boundary, by definition. A point of can't be exterior (every ball around it contains the point itself, which is in ), so each point of is interior or boundary. Hence contains no boundary points exactly when every point of is interior. Likewise, the adherent points are exactly the points that are not exterior, that is, the interior points together with the boundary points. Since interior points of lie in , exactly when contains its boundary points.
Open balls are open. If , let . Then by the triangle inequality: . So every point of an open ball is an interior point. In the same way, closed balls are closed (Exercise 1.24).
Sets need not be either open or closed: in is neither. And a set can be both: and always are, and in the discrete metric every set is both, since every ball of radius is a single point.
For any , writing for the set of interior points and for the set of boundary points:
- , and .
- is open, and it contains every open set . So it is the largest open subset of .
- is closed, and it is contained in every closed set . So it is the smallest closed set containing .
Proof. (1) An interior point of lies in ; a point of is adherent to . The adherent points are the interior and boundary points (as just shown), and these two kinds don't overlap, so removing the interior points from leaves exactly .
(2) If is interior, with , then every has a ball (open balls are open), so is interior too. Thus , and is open. If is open, each has a ball inside , hence inside , so .
(3) Let be adherent to , and . The ball contains some , and contains some ; then . So every ball around meets , and : the closure is closed. If is closed and , every ball around meets , hence meets , so is adherent to and lies in .
(a) in (Figure 1.5). A point with and has a small disc around it satisfying both strict inequalities (by continuity, below), so it is interior. A point with is in , but every disc around it contains points with , outside : a boundary point. A point with and is not in , but is the limit of with , which are in (when ; for use ): an adherent point. So is the open half-disc, , and is the arc together with the diameter.
(b) in . Every interval contains rationals and irrationals (2A.4 The Real Numbers). So no point is interior (no interval fits inside ), and every real is adherent. Hence , , and : the boundary of a set can be much bigger than the set.
(c) A closed set in the discrete metric: every set. Its boundary is empty, since every set is also open.
The most-used fact connects closedness to sequences. It is what lets us prove a set is closed by taking limits.
Let . A point is in if and only if some sequence in converges to . Hence is closed if and only if every sequence in that converges in has its limit in .
Proof. If , then for each the ball meets ; choose in it. Then . Conversely, if and , then every ball contains for large , so it meets , and . The second sentence follows because is closed exactly when .
is open if and only if its complement 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. and have the same boundary points, by the symmetric definition. So contains none of them exactly when contains all of them. If each is open and , then lies in some , which contains a ball around ; so the union does too. If are open and lies in all of them, with , then the ball of radius lies in all of them. (The minimum of finitely many positive numbers is positive. For infinitely many it may be : is not open.) The statements about closed sets follow by taking complements.
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 that contains and 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.
Continuous maps
Continuity, defined in 2A.9 Continuous Functions for functions of one real variable, makes sense between any two metric spaces, and so do all its equivalent forms. This is the version used for the rest of the guidebook.
Let and be metric spaces. A function is continuous at if for every there is such that whenever . It is continuous if it is continuous at every point.
In terms of balls: every ball around the image point contains the image of some ball around . The next theorem gives three other ways to say the same thing. The third, about open sets, is the one that survives when the metric is thrown away (7A.1 Topological Spaces and Quotients).
For between metric spaces, the following are equivalent:
- is continuous (ε–δ, at every point);
- preserves limits: whenever in , in ;
- for every open , the preimage is open in ;
- for every closed , the preimage is closed in .
Proof. (1 ⇒ 2) Let and . Take from continuity at , then with for ; for those , .
(2 ⇒ 1) Contrapositive. If is not continuous at , then (negating, 2A.5 Quantifiers and the Shape of a Proof) some has, for each , a point with but . Then while .
(1 ⇒ 3) Let be open and . Since and is open, some ball . Continuity gives with , that is, . So every point of is interior.
(3 ⇒ 1) Let and . The ball is open, so is open, and it contains . So some ball lies in , which says whenever .
(3 ⇔ 4) Preimages respect complements (2A.2 Sets, Functions and Equivalence): . A set is closed exactly when its complement is open (Proposition 1.13).
Form 3 explains why 2A.2 Sets, Functions and Equivalence made a point of preimages: they respect unions, intersections and complements, the operations that open sets are built from. Notice that the theorem is about preimages. Images of open sets need not be open: is continuous on and sends the open interval to , which is not open.
is Lipschitz with constant if for all . A Lipschitz map is continuous: take .
(a) Distance to a point. For fixed , the function is Lipschitz with constant , by the reverse triangle inequality. So open balls, the preimages of , are open, and closed balls, the preimages of , are closed: a one-line proof of facts proved by hand above.
(b) Coordinates and arithmetic. On , each coordinate function is -Lipschitz, since . Sums, products and quotients (with nonzero denominator) of continuous real-valued functions on any metric space are continuous, by form 2 and the limit laws of 2A.6 Sequences. So every polynomial in the coordinates is continuous on .
(c) Reading off openness. Now sets defined by strict inequalities between continuous functions are open, and sets defined by non-strict inequalities or equations are closed. The open unit disc is the preimage of under ; the hyperbola region is the preimage of under ; the unit sphere is the preimage of under . In (a) of Example 1.11, the interior points of were found exactly this way.
(d) Continuity depends on the metrics. On , the evaluation map is continuous for , being -Lipschitz: . It is not continuous for : tents of height centred at with base width tend to in , but their values at stay . On the other hand, the integral is -Lipschitz for , and hence also for (which is larger on ).
Compositions of continuous maps are continuous (form 2 makes it a one-line proof: gives gives ). A continuous bijection whose inverse is also continuous is a homeomorphism; homeomorphic spaces have the same open sets, matched by the bijection, and are "the same" for the purposes of topology (7A.1 Topological Spaces and Quotients).
Subspaces and relative topology
Any subset is a metric space with the same distance, restricted to pairs of points of . This is how the sphere inherits the straight-line (chordal) distance from , and how inherits its metric from .
Being open is then a statement relative to the space you are in. In , the set is open: the ball of radius around in is . But is not open in , because no interval around fits inside it.
Let . A set is open in if and only if for some set that is open in . The same holds with "closed" in place of "open".
Proof. A ball in is the intersection of with the ball in of the same centre and radius. If is open in , then for each choose with , and let . This is open in , and . Conversely, if with open in , then each has a ball , so . For closed sets, take complements within .
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 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:
(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 terms by the largest.)
Two metrics and on the same set 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 with for all .
Uniformly equivalent metrics are equivalent: if and only if . By Proposition 1.12, equivalent metrics have the same closed sets, hence the same open sets. So on , one can use whichever of the three is convenient for the problem at hand: to handle coordinates one at a time, for geometry, for counting.
In infinite-dimensional spaces, this freedom disappears.
Let be the "tent" that rises linearly from at to height at , falls back to at , and is on (for ). Then
So in the metric but not in the sup metric. The metrics are not equivalent. The general inequality (on an interval of length ) holds, but no inequality in the other direction can, because a tall narrow tent has small area.
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 , will be needed (3A.7 Lᵖ Spaces and Jensen’s Inequality), and the inequalities that relate them, the Sobolev inequalities of 4A.11 Sobolev Embeddings and Critical Exponents, are among the main tools of geometric analysis.
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 of a metric space, the Hausdorff distance is the least such that each set lies within distance of the other (Exercise 1.32). 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.5 Singularities, 12B.3 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.
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 , 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 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
Decide which of these are metrics on , and for each that isn't, name an axiom that fails: (a) ; (b) ; (c) ; (d) .
Hint
For (b) and (d), use that and are increasing with for .
Solution
(a) Not a metric: , so the triangle inequality fails. (b) A metric: , squaring the last inequality to check it. (c) Not a metric: although , so positivity fails. (d) A metric, by the hint. It is bounded by but has the same convergent sequences as : so every metric is equivalent to a bounded one.
Show that for , , with equality on the right exactly when the segment from to makes an angle of 45° with the axes. What are the best constants in ?
Solution
With and : gives the left inequality, and , which is , gives the right one, with equality when . In , , the right one by Cauchy–Schwarz applied to and .
For unit vectors , let and , both in . Write and with unit vectors perpendicular to . Show that , and deduce that . This proves the triangle inequality for great-circle distance.
Solution
, using (Cauchy–Schwarz) and . If , then since is decreasing on , . If , then anyway.
(a) Show that a closed ball is a closed set, using Proposition 1.12 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 is not the closed ball of radius . (So "closure of the open ball" and "closed ball" can differ.)
Solution
(a) If and , then , so . (b) , which is closed, so its closure is . The closed ball of radius is the whole space.
Let with the metric from . Show that is both open and closed in . (In 2B.4 Connectedness this is exactly what it means for to be disconnected.)
Solution
, the intersection of with an open set of , so it is open in by Proposition 1.18. And , the intersection with a closed set of , so it is closed in . Directly: the ball of radius in around any point of is contained in , because has no points in .
Find the interior, closure and boundary of: (a) in ; (b) in ; (c) in ; (d) the set of rational points in .
Solution
(a) Interior , closure , boundary the two lines and . (b) Interior (no interval fits in ), closure (it is closed), boundary . (c) Interior , closure , boundary the same. (d) Interior , closure , boundary , since every disc contains points with rational and with irrational coordinates.
For a nonempty , let . Show that , so is continuous, and that exactly when . Deduce that every closed set is the zero set of a continuous function.
Solution
For every , . Taking the infimum over , ; swapping and gives the other half. Next, means that for every some has (the -characterisation of the infimum), which is exactly the statement that is adherent to . So a closed is . This function is used constantly later: it measures how far a point is from a set, continuously.
Let be the set of bounded real sequences with , and let have a in position and elsewhere. Show that as for every fixed , but for every . Where does the proof of Proposition 1.4 break?
Solution
For fixed , as soon as . But . In the proof, would be a maximum of infinitely many thresholds, here , which has no maximum. The sequence will reappear in 2B.3 Compactness as a bounded sequence in a complete space with no convergent subsequence.
Use Theorem 1.15 to show: (a) is open; (b) for continuous , the set is closed; (c) the graph of a continuous is closed in .
Solution
(a) It is the intersection of the preimages of under and under , both continuous; a finite intersection of open sets is open. (b) It is the preimage of under . (c) It is the preimage of under , which is continuous as a composition and difference of continuous maps.
A binary code of length has minimum distance . Show that the number of codewords is at most (the Hamming bound), by counting the points in the disjoint balls of Proposition 1.6. For and the bound is ; the Hamming code attains it, so its balls tile the whole cube.
Solution
A closed ball of radius in contains strings (choose which positions to flip). The balls around distinct codewords are disjoint and all lie in a set of strings. For , : .
(a) Show that for , so that uniform convergence implies convergence in . (b) Use Example 1.20 to show that the open ball is open for but not for . (So the two metrics have different open sets, not only different convergent sequences.)
Solution
(a) . (b) The zero function is in the set. Every -ball around , of radius , contains for , since ; but , so is not in the set. Hence is not a -interior point.
For non-empty closed bounded subsets of , let and define . (a) Compute between the unit circle and the closed unit disc in , and between and . (b) Show that satisfies the triangle inequality. (c) Show that a sequence of finite sets can converge in 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 of the circle, and the centre is exactly away, so . For the grid, every point of is within of a grid point, and the midpoint of a gap is exactly that far, so . (b) If and , then by the triangle inequality in ; similarly in the other direction. (c) By (a), the grids converge to .
Free resources for this chapter
Chosen for what this chapter covers, and all free to read or watch. Links checked Nov 6, 2026.
Read
- Book §7.1 Metric spacesJiří Lebl, Basic Analysis I & II (free textbook)Definition and examples of metric spaces.
- Book §7.2 Open and closed setsJiří Lebl, Basic Analysis I & II (free textbook)The topology a metric defines.
- Reference Metric spaceWikipediaA survey of examples, from discrete metrics to function spaces.
Watch 3 lectures and talks
- Video Metric Spaces, Lectures 1 and 2Ben Green, Oxford Mathematics Metric Spaces (2nd year)The first lectures of Ben Green’s Oxford course: the axioms of a metric and first examples.
- Video Lecture 12: Convergence in Metric Spaces; Operations on SetsMIT OpenCourseWare 18.100B Real Analysis (Spring 2025), Tobias ColdingConvergence in a metric space, and operations on sets.
- Video Lecture 10: The Relationship Between Open and Closed SetsFrancis Su, Real Analysis lectures (Harvey Mudd College, 2010)Open and closed sets in a metric space and how they are related.
© 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.