An Introduction to Metric Spaces
Created | Updated Feb 1, 2010
Many branches of mathematics are concerned with the continuity and convergence of functions. The study of metric spaces allows mathematicians to put this in a more general setting - the concepts involved in metric spaces are, on the whole, totally abstract. This entry aims to lay the foundations for the study of metric spaces...
What is a Metric Space?
In general terms, a metric space is a space (which could be a plane, the surface of a sphere, three-dimensional space, etc) in which we have a notion of 'distance' which fits in with our geometrical intuition. Formally, we say that:
A metric space M = {A, d} consists of a non-empty set A together with a distance function1 d: A×A → R2 which satisfies:
- d(x, y) ≥ 0; d(x, y) = 0 if and only if x = y
- d(x, y) = d(y, x) for all x, y in A
- d(x, y) + d(y, z) ≥ d(x, z) for all x, y, z in A
So, what does this actually mean? To start with, we must have a non-empty set A - basically a collection of one or more points. We also need a distance function, d, which can be used to calculate the distance between any two points of A. d must also follow certain rules.
The first rule says that we cannot have a negative distance - and the distance between two points can only be zero if the two points are, in fact, in exactly the same place. The second rule states that the distance between two points must be the same whichever direction we measure - going from x to y covers the same distance as going from y to x. Finally, we get the 'triangle inequality' - the combined distance of two sides of a triangle must not be less than the length of the third side.
Examples of Metric Spaces
Let us start with the most familiar metric space - the Euclidean metric in the plane. This is our intuitive distance function on flat surfaces - to measure a distance between two points, we take a straight line between them, and measure its length. Put formally, we use the distance function
d2(x, y) = [(x1 - y1)2 + (x2 - y2)2]½
where x = (x1, x2) and y = (y1, y2).
This is not the only metric space, though. There are some much less intuitive metrics that we can use. For instance, the so-called 'Manhattan metric' on the plane. To measure a distance, we now measure the horizontal and vertical distances, and add the two together. In formal terms:
d1(x, y) = |x1 - y1| + |x2 - y2|
Even more unusual is the 'infinity' metric - again we measure the vertical and horizontal distances, but the overall distance is the maximum of these two. That is:
d∞(x, y) = Max {|x1 - y1|, |x2 - y2|}
Using these different definitions of 'distance', think what a 'circle' would look like in each of them. By 'circle', we mean 'the set of all points lying at a given distance from a fixed point'. Look at the diagram - you should see that using the d1 metric, the circle is in fact a diamond, and with the d∞ metric we get a square.
We can also have 'discrete' metric spaces. Our set A may be any collection of points - as many or few as we wish. We now define our metric d by:
d(x, y) = { 1 if x ≠ y 0 if x = y
We must check that this satisfies our three rules. Clearly rules one and two hold for all points x & y, so it remains only to check rule three, the triangle inequality.
If x = z then d(x, z) = 0, so d(x, y) + d(y, z) ≥ d(x, z). If x ≠ z (and therefore d(x, z) = 1) then at least one of x ≠ y, y ≠ z must be true. Then we must have d(x, y) + d(y, z) = 1 or 2, so the rule holds.
Taking things to extremes, we can have a metric space, which contains just one point. It will not make any difference which metric (d) we use on this space, for reasons which will become apparent. Let us examine the three rules for a metric space:
- d(x, y) ≥ 0; d(x, y) = 0 if and only if x = y
- d(x, y) = d(y, x) for all x, y in A
- d(x, y) + d(y, z) ≥ d(x, z) for all x, y, z in A
Since d is a metric, the first part of this statement must be true. For the second part, we must remember that our set A has only one point - so x = y is always true. Therefore d(x, y) = 0.
Since we only have one point x in our set, this reduces to 'd(x, x) = d(x, x) for all x in A', which is trivially true.
This reduces to 'd(x, x) + d(x, x) ≥ d(x, x) for all x in A' which is again trivially true.
And so our single-point set is indeed a metric space.
Subspaces
Let M = {A, d} be a metric space, and let H be a non-empty subset of A. Let dH: H×H → R be the restriction of d to points of H (ie dH(x, y) = d(x, y) for all points x, y in H).
Since M is a metric space, the three rules for distance functions must hold for all points in A, and therefore for all points in H. Hence dH satisfies our earlier definition of a metric.
The resultant metric space {H, dH} is called a subspace of M, and dH is the metric on H induced by d.
Boundedness
In analysis of metric spaces, the concept of an open space is particularly important. In order to properly define this idea, it is useful to first examine boundedness.
A subset S of a metric space M = {A, d} is said to be bounded if there exist a in A and K in R such that d(x, a) ≤ K for all x in S.
Put simply, if there is a point a in A such that all the points of A are within a circle of radius K, centred on a (remember how different 'circles' can be depending on the metric being used), then A is bounded.
Notice that if S satisfies this definition for some a in A and K in R, then it will also satisfy the definition with a replaced by any other point a' of A, and K replaced by K' = K + d(a, a').
To prove this, let us examine a point x of A. If d(x, a) ≤ K (our first definition of boundedness) then:
d(x, a') ≤ d(x, a) + d(a, a') (By the triangle inequality) ≤ K + d(a, a') (Because A bounded implies d(x, a) ≤ K) = K' (By substitution)
It is interesting to see that the union of any finite number of bounded subsets of a metric space is itself bounded. Note that we only need to prove that the union of two such subsets is bounded, since we may build the union of a finite number of subsets by forming a union of two subsets, then forming a union of our new subset with a third subset, etc.
Let S1, S2 be two bounded subsets of a metric space M = {A, d}, and let a1, a2 in A and K1, K2 in R be such that d(x, a1) ≤ K1 for all x in S1, and d(x, a2) ≤ K2 for all x in S2.
Let a = a1, and K = Max {K1, K2 + d(a1, a2)}. Then for any xin the union of S1 and S2 there are two possibilities. Either x is in S1, in which case d(x, a) ≤ K1 ≤ K, or x is in S2, in which case
d(x, a) = d(x, a1) (By substitution) ≤ d(x, a2) + d(a2, a1) (Using the triangle inequality) ≤ K2 + d(a2, a1) (Since S2 is bounded) ≤ K (By definition of K)
Hence our union is indeed bounded.
Open Balls
Let M = {A, d} be a metric space, let a be in A, and let ε > 0. The ε-ball of a in M is defined to be:
Bε(a) = {x in A | d(x, a) < ε}
That is, the collection of points x in A within distance ε of a.
It is worth emphasising that Bε(a) does not include the boundary. It consists only of the interior of the 'ball'. If we were to include the boundary, it would become a closed ball.
One consequence of the non-inclusion of the boundary of our open balls is the way in which they can be nested. Let Bε(x) be an open ball in a metric space, and let y be a point in Bε(x). Then there is a δ > 0 for which Bδ(y) is contained completely within Bε(x). In R2 this means that we can draw a disc centred on y which lies entirely within the larger disc, centred on x. A look at the diagram should convince you that any δ satisfying δ + d(x, y) ≤ ε will do.
For a formal proof of this, let δ = ε - d(x, y). This must be greater than zero, since y is a point in Bε(x).
If z is in Bδ(y) then d(y, z) < δ, and:
d(x, z) ≤ d(x, y) + d(y, z) (By the triangle inequality) < d(x, y) + δ (Since z is in Bδ(y)) = ε (By definition of δ)
So z is in Bε(x), and hence Bδ(y) must be contained within Bε(x).
Examples of Open Balls
In R, Bε(a) = (a - ε, a + ε). That is, the collection of points x satisfying a - ε < x < a + ε.
In R2 (the plane), Bε(a) is the interior of a disc of radius ε centred on a.
In R3 (three-dimensional space), Bε(a) is the interior of a solid ball of radius ε centred on a.
The previous three examples have all used the Euclidean metric, that is, our intuitive notion of distance. Let us now look at some examples using other metrics.
In R2, using the d∞ metric, Bε(a) is the interior of a square centred on a, with sides of length 2ε parallel to the co-ordinate axes.
In a discrete metric space M = {A, d}, we have
Bε(a) = { {a} if ε ≤ 1 A if ε > 1
In other words, if ε ≤ 1, Bε(a) is just the single point a. If ε > 1, Bε(a) is the whole space A.
Open Sets
Let U be a subset of a metric space M. U is open in M if given any point y in U there is a ε(y) > 0 such that Bε(y)(y) is contained entirely in U. Note that for different points y in U the value of ε(y) is allowed to be different. Also, it is important to specify which metric space we are operating in - the reasons will be explained later.
We have already shown that an open ball in a metric space M is open in M, since we can fit another open ball inside it, centred on any point we choose.
Examples (and Non-examples) of Open Sets
Let us look at the 'real line', R, also known as the number line. An open interval (a, b)3 is open in R - around any point y in the interval we can fit another open interval, of the form (y - ε, y + ε) for some value of ε.
On the other hand, a closed (or half-closed) interval is not open in R. To see this, let [a, b] be a closed interval. We now attempt to find an open interval Bε(a) around point a. By definition, a is in [a, b], but no matter how small we take ε to be, Bε(a) would always include points less than the value of a - so Bε(a) is not contained within [a, b].
It is important to note that not all open sets are open balls. Let our metric space be R2 with the Euclidean metric, and let U be the interior of a rectangle:
U = {(x1, x2) | a < x1 < b, c < x2 < d}
U is not an open ball in the Euclidean metric, but U is open in R2. This is easy to check: if x = (x1, x2) is in U then Bε(x) is contained in U, where ε = Min{x1 - a, b - x1, x2 - c, d - x2}.
It should be becoming clear that open sets do not include any 'boundary' points - from any point in the set, you can move some distance in M without going outside the set. As with open balls, if the set did include the boundary, it would be a closed set.
In any metric space M, the empty set Ø4 and the whole space M are open in M. Ø is open since it contains no points - so there is nowhere to centre our open ball. M is open since any open ball in M can only contain points of M.
In a discrete metric space, any set U is open in M. If x is in U, we can choose ε ≤ 1 to make certain that Bε(x) = {x} which is contained in U.
By the above, a closed interval [a, b] is open in [a, b], although (as we have already seen) it is not open in R.
Unions and Finite Intersections of Open Sets
The union of any collection of open sets in ametric space M is open in M. To prove this, let I be an indexing set, and suppose that Ui is open in M for every i in I. Let x be in the union of all the sets Ui. Then x must be in Uk for some k in I, and since Uk is open in M there exists ε > 0 such that Bε(x) is contained in Uk, which is in the union of the Ui as required.
If U1, U2,..., Um are open in a metric space M, then the intersection of these m sets is also open in M.
To prove this, let x be in the intersection of our m open sets. For each i = 1, 2,..., m we must have x in Ui and Ui is open in M, so there exists an εi > 0 such that Bεi(x) is contained in Ui.
Now let ε = Min{ε1, ε2,..., εm}. Then Bε(x) is contained in Bεi(x) which is itself contained in Ui for i = 1, 2,..., m, so Bε(x) is in the intersecion, as required.
Taking Things Further
This entry is only a brief introduction to the world of metric spaces. Other topics within this subject include the continuity and convergence of functions, the Hausdorff condition, compactness, connectedness and completeness. One excellent book on Metric Spaces is Introduction to Metric and Topological Spaces, by WA Sutherland.