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 function^{1} *d*: *A*×*A* → **R**^{2} 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

*d*_{2}(*x*, *y*) = [(*x*_{1} - *y*_{1})^{2} + (*x*_{2} - *y*_{2})^{2}]^{½}

where *x* = (*x*_{1}, *x*_{2}) and *y* = (*y*_{1}, *y*_{2}).

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:

*d*_{1}(*x*, *y*) = |*x*_{1} - *y*_{1}| + |*x*_{2} - *y*_{2}|

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 {|*x*_{1} - *y*_{1}|, |*x*_{2} - *y*_{2}|}

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 *d*_{1} 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*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.

*d*(*x*, *y*) = *d*(*y*, *x*) for all *x*, *y* in *A*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.

*d*(*x*, *y*) + *d*(*y*, *z*) ≥ *d*(*x*, *z*) for all *x*, *y*, *z* in *A*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 *d*_{H}: *H*×*H* → **R** be the restriction of *d* to points of *H* (ie *d*_{H}(*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 *d*_{H} satisfies our earlier definition of a metric.

The resultant metric space {*H*, *d*_{H}} is called a subspace of *M*, and *d*_{H} 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 *S*_{1}, *S*_{2} be two bounded subsets of a metric space *M* = {*A*, *d*}, and let *a*_{1}, *a*_{2} in *A* and *K*_{1}, *K*_{2} in **R** be such that *d*(*x*, *a*_{1}) ≤ *K*_{1} for all *x* in *S*_{1}, and *d*(*x*, *a*_{2}) ≤ *K*_{2} for all *x* in *S*_{2}.

Let *a* = *a*_{1}, and *K* = Max {*K*_{1}, *K*_{2} + *d*(*a*_{1}, *a*_{2})}. Then for any *x*in the union of *S*_{1} and *S*_{2} there are two possibilities. Either *x* is in *S*_{1}, in which case *d*(*x*, *a*) ≤ *K*_{1} ≤ *K*, or *x* is in *S*_{2}, in which case

*d*(*x*, *a*) | = | *d*(*x*, *a*_{1}) | | (By substitution) |

| ≤ | *d*(*x*, *a*_{2}) + *d*(*a*_{2}, *a*_{1}) | | (Using the triangle inequality) |

| ≤ | *K*_{2} + *d*(*a*_{2}, *a*_{1}) | | (Since *S*_{2} 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 **R**^{2} 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 **R**^{2} (the plane), **B**_{ε}(*a*) is the interior of a disc of radius ε centred on *a*.

In **R**^{3} (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 **R**^{2}, 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 **R**^{2} with the Euclidean metric, and let *U* be the interior of a rectangle:

*U* = {(*x*_{1}, *x*_{2}) | *a* < *x*_{1} < *b*, *c* < *x*_{2} < *d*}

*U* is not an open ball in the Euclidean metric, but *U* is open in **R**^{2}. This is easy to check: if *x* = (*x*_{1}, *x*_{2}) is in *U* then **B**_{ε}(*x*) is contained in *U*, where ε = Min{*x*_{1} - *a*, *b* - *x*_{1}, *x*_{2} - *c*, *d* - *x*_{2}}.

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 *U*_{i} is open in *M* for every *i* in *I*. Let *x* be in the union of all the sets *U*_{i}. Then *x* must be in *U*_{k} for some *k* in *I*, and since *U*_{k} is open in *M* there exists ε > 0 such that **B**_{ε}(*x*) is contained in *U*_{k}, which is in the union of the *U*_{i} as required.

If *U*_{1}, *U*_{2},..., *U*_{m} 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 *U*_{i} and *U*_{i} is open in *M*, so there exists an ε_{i} > 0 such that **B**_{εi}(*x*) is contained in *U*_{i}.

Now let ε = Min{ε_{1}, ε_{2},..., ε_{m}}. Then **B**_{ε}(*x*) is contained in **B**_{εi}(*x*) which is itself contained in *U*_{i} 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.