Skip to main content
โ† Back to Topology samples
๐ŸฉTopologyยท20 minยทSample Lesson

Metric Spaces: Defining Distance in Mathematics

Your phone's GPS calculates distance as a straight line through the air -- the Euclidean distance. But a taxi driver in Manhattan can't cut diagonally through a city block; they can only travel along the grid of streets. Mathematically, that's a completely different notion of 'distance,' called the taxicab metric. Both are legitimate ways to measure distance, and both obey the same three rules that define what mathematicians call a metric space.

What You'll Learn

- The formal definition of a metric space and a distance function - The three axioms every valid distance function must satisfy - How to compare the Euclidean metric, the taxicab metric, and the discrete metric - Why metric spaces became the foundation for the topology you'll study next

What Is a Metric Space?

A metric space is a set X paired with a function d: X x X -> R (called a metric, or distance function) that assigns a real number to every pair of points in X. That number represents how far apart the two points are. The idea was formalized by French mathematician Maurice Frechet in 1906, generalizing distance beyond ordinary geometry so it could apply to far stranger spaces, like sets of functions.

The Three Rules Every Distance Must Follow

For d to count as a genuine metric, it must satisfy three axioms for all points x, y, z in X: 1. Non-negativity and identity: d(x,y) >= 0, and d(x,y) = 0 if and only if x = y. 2. Symmetry: d(x,y) = d(y,x). The distance from x to y equals the distance from y to x. 3. Triangle inequality: d(x,z) <= d(x,y) + d(y,z). Going directly can never be longer than going through a detour point y. Let's check the taxicab metric on a grid, d((x1,y1),(x2,y2)) = |x1-x2| + |y1-y2|. Between (0,0) and (3,4): taxicab distance = |0-3| + |0-4| = 7. It's symmetric, it's zero only when the points match, and the triangle inequality holds for any detour point -- so it qualifies as a true metric.

Not All Metrics Look Alike

Compare three metrics on the same two points, (0,0) and (3,4): Euclidean metric (straight-line distance): sqrt(3^2 + 4^2) = sqrt(25) = 5. Taxicab metric (grid distance): |3| + |4| = 7. Discrete metric (defined as d(x,y) = 0 if x = y, otherwise d(x,y) = 1): since (0,0) does not equal (3,4), the distance is simply 1 -- no matter how far apart the points look geometrically. All three are valid metrics because all three satisfy the three axioms, even though they give wildly different numbers for the same pair of points. This is exactly why topology, which grew out of metric space theory, focuses on properties like open sets and continuity rather than exact numeric distance.

Where This Leads

Metric spaces let mathematicians define an 'open ball' around a point (all points within distance r). That single idea is the seed from which general topology grows, eventually letting mathematicians talk about closeness and continuity even in spaces with no distance function at all.

โ“

Using the taxicab metric d((x1,y1),(x2,y2)) = |x1-x2| + |y1-y2|, what is the distance between the points (1,1) and (4,5)?

โ“

A function d is proposed where d(x,y) = -3 for every pair of distinct points x and y. Which metric axiom does this immediately violate?

๐ŸŽฏ

Verify a Metric by Hand

Pick three points on a coordinate grid, such as A(0,0), B(3,0), and C(3,4). Compute the Euclidean distance and the taxicab distance between each pair (AB, BC, AC). Then check whether the triangle inequality d(A,C) <= d(A,B) + d(B,C) holds under each metric, showing your arithmetic for both.

Want to keep learning?

Sign up for free to access the full curriculum โ€” all subjects, all ages.

Start Learning Free