## Metric Spaces and continuity of real-valued functions

Now that we’ve got the real numbers which correspond to our usual notion of magnitudes like distances, let’s refine our concept of a uniform space to take into account this idea of distance.

A metric space is a set equipped with a notion of “distance” in the set. That is, we have a set and a function , which assigns a real number to every pair of points in . This function will satisfy the following axioms:

- For all , .
- For all , if and only if .
- For all , .
- For all , .

The first says that distances are all nonnegative real numbers. The second says that any point is distance from itself, and *only* from itself. The third says that the distance between two points doesn’t depend on the order in which we take the points. The last is called the triangle inequality, because if we think of the points as the vertices of a triangle then it’s shorter to go from to along the leg connecting those two than to take the detour to .

Notice that these properties line up with those of absolute values. That is, the function defined by will be a distance function on .

Now any metric space is actually a uniform space. We define an entourage for each positive real number . This consists of all the pairs with . Since each of these will contain the diagonal. The intersection is the entourage corresponding to the smaller of and . Each is its own reflection by the symmetry of the distance function. And the triangle inequality gives our half-size entourages — if and then .

For the real numbers themselves we should verify that we get back the same uniform structure as we did before. Remember that the uniform structure we got from completing the uniform structure on the rational numbers had an entourage for each positive , with . Each one of these shows up in the entourages for the metric structure, by considering as a positive real number, but does every basic entourage from the metric structure show up as an entourage in the complete uniform structure? It does! The Archimedean property tells us that for any positive we can find a positive rational number . Then , and so is an entourage in the completion of the uniform structure on the rationals.

Let’s look at the neighborhood structure we get from the entourages of the metric structure. A subset is a neighborhood of if and only if it contains for some . That is, it must contain the “open ball” of all such that .

In this means that we have a neighborhood base for each point consisting of the intervals . Thus a subset of will be open if and only if it contains such a symmetric neighborhood of each of its points, and this will happen if and only if is the union of a collection of open intervals. Then we can take the intervals as a base for our topology.

As a final *coup de grâce*, let’s write down explicitly the condition that a function be a continuous map. We have a neighborhood base of our topology, and we know we only need to check the neighborhood definition of continuity on a neighborhood base.

So, a function will be continuous at if and only if for each neighborhood there is a neighborhood with . Translating this all into our explicit language for the real numbers and restricting to neighborhood bases says that a function is continuous at if and only if for each there is a so that implies . And we’re back to the old definition of continuity from calculus 1! Then, as usual, we say that is continuous if the above condition holds for all .

What about uniform continuity. We can again translate the statements to our special case and check them on the basic entourages. A function will be uniformly continuous if for every there is a so that for all , implies that .

Notice particularly the difference between uniform continuity and continuity. Continuity says that (for all ) (for all there exists a ) such that ( implies ). Uniform continuity says that (for all there exists a ) such that (for all ) ( implies ). The quantifier for shows up *after* the quantifier for in the latter definition. That is, for a uniformly continuous function we can pick the *uniformly* to apply to all points , while for a merely continuous function we may have to use a different for each point . At first it doesn’t seem to be that big a deal, which always causes a certain amount of confusion in an advanced calculus (undergraduate real analysis) class, but it turns out that being able to choose the same at every point makes a lot of nice things work out that don’t otherwise hold.

*[UPDATE]:* I’m feeling a little silly that I didn’t mention this before, but the last two definitions immediately port over to *any* function between metric spaces and by just using the local definitions of “distance” in place of that for . A function is continuous if for all and there is a so that implies . Similarly, is uniformly continuous if for all there is a so that for all implies .