Metric Spaces
Wikipedia (Metric space) · CC BY-SA 4.0
A metric space is a set X equipped with a function d : X × X → [0, ∞) that measures distance. Four axioms: d(x,y) ≥ 0 (non-negativity), d(x,y) = 0 iff x = y (identity of indiscernibles), d(x,y) = d(y,x) (symmetry), and d(x,z) ≤ d(x,y) + d(y,z) (triangle inequality). Every geometry you know is a special case.
The four axioms
A distance function (or metric) must satisfy four properties. These are not optional: drop any one and you get a different, weaker structure (pseudometric, quasimetric, semimetric). The triangle inequality is the one that does the most work. It says detours never shorten the trip.
Open balls
The open ball B(x, r) is the set of all points within distance r of x. Open balls are the building blocks of the topology induced by the metric. In Euclidean space they are circles. In taxicab space they are diamonds. The metric determines the shape of "nearness."
Four metrics on the same set
The same set of points can carry different metrics. Each metric defines a different notion of distance, different open balls, and different convergent sequences. The set does not change. The structure does.
Hausdorff distance
The Hausdorff distance measures how far apart two sets are. It is the greatest distance any point in one set has to travel to reach the other set. If H(A, B) = 0, the closures of A and B are equal. Hausdorff distance turns the collection of compact subsets of a metric space into a metric space itself.
Metric space as enriched category
A metric space is a category enriched over ([0, ∞], ≥, +). Objects are points. The hom-value from x to y is d(x, y). Identity says d(x, x) = 0. Composition says d(x, z) ≤ d(x, y) + d(y, z), which is exactly the triangle inequality. Lawvere noticed this in 1973: a metric space is what you get when you replace "arrows exist or not" (Bool-enriched) with "arrows have a cost" ([0, ∞]-enriched).
Neighbors
Geometry chapters
- △ Chapter 6 — Differential Geometry
- △ Chapter 8 — Convex Geometry
- ∞ Real Analysis Ch.8 — metric spaces are the same objects, analyzed rather than visualized
- 🤖 ML Ch.5 — kernel methods use distance functions in feature space
- ⚙ Algorithms Ch.7 — shortest paths generalize Euclidean distance to discrete graphs
Cross-references
- △ Analysis Ch.8 — metric spaces from the analysis side
- △ Milewski Ch.22 — enriched categories (metric spaces are [0,∞]-enriched)
Foundations (Wikipedia)
Translation notes
The enriched-category perspective comes from Lawvere's 1973 paper "Metric spaces, generalized logic, and closed categories." Milewski covers enriched categories in chapter 22 of Category Theory for Programmers, where the running example is exactly this: Bool-enrichment gives preorders, [0,∞]-enrichment gives metric spaces. The Hausdorff distance example uses finite sets for computability; the general definition uses suprema over arbitrary sets.