Metric Spaces
What You’ll Learn
Section titled “What You’ll Learn”In this lesson you’ll see distance reduced to four axioms, meet examples ranging from the familiar to the strange, define open sets from open balls, and discover that different metrics can produce identical topologies.
The Concept
Section titled “The Concept”The axioms
Section titled “The axioms”A metric on a set is a function satisfying, for all :
- Non-negativity.
- Identity of indiscernibles. if and only if
- Symmetry.
- Triangle inequality.
The pair is a metric space. That is the entire definition, and it is worth appreciating how little it demands: no coordinates, no algebra, no dimension.
The fourth axiom does almost all the work. The triangle inequality is what makes limits behave and what every convergence proof in analysis eventually appeals to. Without it, “close to ” and “close to ” would carry no information about each other.
Note the “only if” in axiom 2. Dropping it gives a pseudometric, where distinct points can be at distance 0. Dropping symmetry gives a quasimetric, which is how one-way street distances are modelled.
Examples
Section titled “Examples”Euclidean, on . . The default.
Taxicab, on . . The distance a car drives on a rectangular street grid, hence the name.
Maximum, on . . Also called the Chebyshev distance; it is the number of moves a chess king needs.
Discrete. for and 0 otherwise. Valid on any set at all, and it makes every subset open.
Supremum metric on functions. on the continuous functions on . Convergence in this metric is exactly uniform convergence, which is the link back to real analysis.
Hamming distance. On strings of fixed length, the number of positions where they differ. This is the metric coding theory is built on.
The -adic metric. On , two numbers are close when their difference is divisible by a high power of . It satisfies a stronger inequality, , and it is the foundation of a large part of modern number theory.
Open balls and open sets
Section titled “Open balls and open sets”The open ball is .
A set is open if every point of has some ball around it contained in .
That second definition is the bridge to the rest of the section. It converts a numerical notion, distance, into a purely set-theoretic one, openness - and openness is all the next lesson will keep.
Open balls need not look round. The shape depends entirely on the metric.
In the figure, the same “unit ball” is a disc, a diamond, and a square for the three standard metrics on . Each boundary is computed by scaling directions until the norm equals 1, so the shapes come out of the formulas rather than being drawn by hand.
Equivalent metrics
Section titled “Equivalent metrics”Here is the observation that motivates the whole abstraction.
Two metrics on the same set are topologically equivalent if they produce exactly the same open sets.
For , the metrics , , and are all equivalent. The reason is that each ball fits inside a scaled copy of the others:
The figure measures the relevant constants on : over the Euclidean unit circle, ranges between 1 and , and between and 1. Since each is bounded above and below by a multiple of the other, any ball of one metric contains a ball of the other, so the open sets coincide.
Consequence: every topological statement about - continuity, convergence, connectedness, compactness - gives the same answer for all three. Proving a theorem once topologically covers all of them.
The discrete metric on is not equivalent to the usual one, since it makes every singleton open. That is a genuinely different topology.
What metrics still give you that topology does not
Section titled “What metrics still give you that topology does not”Not everything survives the abstraction, and it is worth knowing what is lost:
- Cauchy sequences and completeness need actual distances.
- Uniform continuity and Lipschitz conditions are metric notions, not topological ones.
- Boundedness is metric; the topological substitute is compactness.
- Diameter and any quantitative estimate.
So metric spaces are not superseded. Analysis needs them, and lesson 11 returns to them for the extra results they support.
Worked Examples
Section titled “Worked Examples”Example 1: Verify the discrete metric is a metric.
Solution. Non-negativity and symmetry are clear from the definition. Axiom 2 holds because precisely when .
For the triangle inequality, take any . If then the left side is 0 and there is nothing to prove. If then the left side is 1, and at least one of or must hold, so the right side is at least 1. ✓
In this space , so every singleton is open, hence every subset is open. ∎
Example 2: Show is not a metric on .
Solution. The triangle inequality fails. Take , , :
and . ∎
Squaring breaks the triangle inequality, while square-rooting does not: is a metric.
Example 3: Describe the unit ball of in .
Solution. The condition describes the open diamond with vertices at and .
It is inscribed in the Euclidean unit disc, touching it only at those four vertices. ∎
Example 4: Show in .
Solution. Write and , and suppose without loss of generality , so .
Lower bound: ✓
Upper bound: ✓
So each metric is bounded by a constant times the other, which is exactly what makes the balls nest and the topologies agree. ∎
Example 5: Is open in with the usual metric?
Solution. Yes. Given , set . Then .
Answer: open. ∎
Note is not open, because no ball around 0 stays inside: every contains negative numbers.
Example 6: Show the closed ball need not be the closure of the open ball.
Solution. Use the discrete metric on a set with at least two points, and take .
The open ball is already closed, since every set is, so its closure is , not . ∎
In they do agree, which is why this trap is easy to walk into. The general statement is only that the closure of the open ball is contained in the closed ball.
Example 7: Interpret the supremum metric.
What does mean?
Solution. It says the graphs of and stay within vertical distance of each other at every point of - the entire graph of lies in an -tube around .
Convergence in this metric is therefore uniform convergence, exactly the notion from real analysis, and a ball in this metric is the tube. ∎
The tube picture from uniform convergence was a metric ball all along, which is a good example of topology retroactively explaining an earlier definition.
Real-World Applications
Section titled “Real-World Applications”Route planning. Taxicab distance models grid-based city travel, and real navigation uses graph metrics on road networks. The choice of metric changes which route is optimal but not which places are near each other in the topological sense.
Error-correcting codes. Hamming distance turns strings into a metric space, and a code corrects errors exactly when its codewords are more than apart. Every disk drive and network protocol depends on this.
Machine learning. Nearest-neighbour classification, clustering, and embeddings all require choosing a metric, and the choice determines the results far more than the algorithm does. Cosine, Euclidean and Manhattan distances give different answers on the same data.
Text and DNA comparison. Edit distance is a metric on strings, and it drives spell checkers, plagiarism detection, and sequence alignment in bioinformatics.
Function approximation. The supremum metric measures worst-case error, which is the guarantee engineering needs, while the metric measures average error. Choosing between them is choosing what “close enough” means.
Number theory. The -adic metrics give a completely different notion of nearness on and are central to modern arithmetic geometry, including the proof of Fermat’s Last Theorem.
Retrying will remove your ✅ checkmark until you pass again.