Recommended resources
The freely available resources this lesson will direct you to.
Hello! We begin with metric spaces, the setting in which familiar ideas from real analysis—closeness, limits, and continuity—can be studied on sets other than the real numbers. This module starts by asking a foundational question: what makes a proposed “distance” a metric?
The answer is a short list of axioms, but using them well takes care. You will see how to verify them for distances on a grid, on an arbitrary set, and between functions. You will also see how a plausible-looking formula can fail. These examples will give the definitions in later lessons something concrete to attach to.
A distance is a function with obligations
A proposed metric begins with a set and a function . To call a metric space, we must establish, for every :
- Nonnegativity and identity of indiscernibles: , and if and only if .
- Symmetry: .
- Triangle inequality: .
The first condition contains two directions worth checking separately. You need both implies and implies . The latter is easy to overlook: a formula can assign zero distance to distinct points while satisfying the other requirements.
Watch this brief introduction from MIT OpenCourseWare’s Lecture 1: Motivation, Intuition, and Examples. It connects the definition to the distances used in real analysis; pay particular attention to what changes when the familiar absolute value is replaced by an abstract .
Lecture 1: Motivation, Intuition, and Examples
Watch Lecture 1: Motivation, Intuition, and Examples from MIT OpenCourseWare to place the metric axioms in their real-analysis context.
In the definition, focus on the role of X\times X: the two inputs are points of the chosen set X, whatever those points happen to be.
When verifying a metric, begin with arbitrary points and prove all three conditions. When disproving one, a single counterexample to any condition is enough. In particular, the triangle inequality is a claim about every triple, whereas its failure can be witnessed by one carefully chosen triple.
More than one distance on the same plane
For and in , the Euclidean distance is
It is not the only metric on . If movement is constrained to horizontal and vertical streets, a natural choice is the taxicab, or Manhattan, distance:

If each grid block in the image has unit length, the endpoints differ by six units in each coordinate. Each colored street route has taxicab length , while the green straight line has Euclidean length . The street routes look different, but none retraces a block: each must make up the same horizontal and vertical displacement.
That picture suggests a distance; the axioms establish whether it really is one. Nonnegativity and symmetry follow from absolute value. Also, exactly when both nonnegative summands are zero, which happens exactly when . For the triangle inequality, let . Apply the ordinary triangle inequality in to each coordinate:
Notice the proof’s structure: it starts with an arbitrary triple and reduces an unfamiliar inequality to familiar inequalities for real numbers.
A third choice is the maximum, or box, metric,
Here distance records the largest coordinate discrepancy, rather than adding discrepancies. The next portion of the MIT lecture works through its axioms. This is useful proof-reading practice: pause at the triangle inequality and identify exactly where each coordinate bound becomes a bound by a maximum.
Lecture 1: Motivation, Intuition, and Examples
Continue Lecture 1: Motivation, Intuition, and Examples for a worked verification of the maximum metric.
Watch the maximum proof. In the triangle-inequality argument, follow the choice of a coordinate attaining the maximum, the use of the absolute-value inequality at that coordinate, and the subsequent bounds by two maxima.
The important conclusion is not that these metrics assign the same numbers—they generally do not. It is that each meets the same axioms, so each supplies a legitimate notion of distance on the same underlying set.
A metric without geometry
Coordinates are not required. On any set , define the discrete metric by
For example, could be a set of symbols. The definition needs only a way to tell whether two elements are equal.
The Bright Side of Mathematics video Functional Analysis 2 | Examples for Metrics - Euclidean or Discrete Metric? checks the axioms for this construction. Watch how the triangle inequality becomes a statement about equality, not a calculation with coordinates.
Functional Analysis 2 | Examples for Metrics - Euclidean or Discrete Metric?
Watch Functional Analysis 2 | Examples for Metrics - Euclidean or Discrete Metric? from The Bright Side of Mathematics for a verification on an arbitrary set.
In the discrete metric, focus especially on the case x\ne y: why must at least one of d_{\mathrm{disc}}(x,z) and d_{\mathrm{disc}}(z,y) equal 1?
Here is the core of that argument. If , the left side of the triangle inequality is zero. If , its left side is . The two distances through cannot both be zero, because that would give . At least one is therefore , so their sum is at least . This covers every triple in .
The example makes a useful distinction: a metric must obey the rules of distance, but its points need not be positions in a geometric space.
How plausible formulas fail
Consider on . It is nonnegative, symmetric, and zero exactly when . Nevertheless, take , , and . Then
The triangle inequality would require , so is not a metric. Squaring a known distance does not automatically preserve its metric properties.
A different failure occurs with
The ordinary absolute-value triangle inequality shows that satisfies a triangle inequality, and symmetry is immediate. Yet although . This formula measures separation between squared values, so it cannot distinguish points with the same square. It fails the identity requirement.
These examples suggest a reliable reading routine for a proposed distance: first specify its set and check that the formula gives a finite real value for every pair in . Then check both directions of the zero-distance claim, symmetry, and the triangle inequality. If a condition fails, state the points that witness the failure and compute the relevant values.
When the points themselves are functions
Metric spaces can also have functions as points. Let be the set of all bounded real-valued functions on , and propose
Read Example 5 in Notes on Metric Spaces for the definition and its interpretation as the largest—or, more precisely, supremal—vertical separation between two graphs. Keep the choice of in view as you read: boundedness ensures that the proposed distance is finite.
Read Example 5 in Notes on Metric Spaces to see how the same axioms apply when a “point” is a function.
Find Example 5 on pp. 2–3. Begin where it recalls what it means for a function to be bounded, then read through the graph example, ending with the observation about where the example functions differ most. Focus on why the supremum is a finite real number and why zero supremal separation forces equality at every input. Stop before Definition 2 on balls.
We can complete the axiom check without assuming that the supremum is attained. The expression is nonnegative and symmetric. If , then for every ,
Thus at every input, so ; the converse is immediate. For bounded , the pointwise triangle inequality gives, for every ,
Because the right side bounds every value on the left, it also bounds their supremum. That is precisely
This last step is worth retaining: a supremum need not be a maximum for a supremum-metric proof to work.
Takeaways
To verify a metric, prove a universal claim about all pairs and triples in the stated set. To reject one, find a definite failure: an undefined or infinite value, a negative value, zero distance between distinct points, asymmetry, or a triple that violates the triangle inequality. The taxicab, maximum, discrete, and supremum metrics show how widely the axioms apply; the squared-distance formulas show why intuition alone is insufficient.
Next, we will use metric balls to determine which sets are open or closed. Because different metrics can assign different distances to the same points, the metric chosen here will matter for that next step.