Chapter 1: Metric Spaces

Before delving into topological spaces in general, we'll look at a special class of particularly nice (and hopefully familiar) spaces: metric spaces. Many of the definitions and properties studied in topology are abstractions from properties shared by all metric spaces and the intuition built from studying them can be helpful when working with and trying to visualize stranger, more abstract spaces. If you've studied analysis, much of this material may be familiar to you, but you're encouraged to skim through this section to fix notation and terminology and to anticipate some of the upcoming results about general topological spaces.

Metrics
Informally, a metric space is a set along with some notion of the distance between each pair of points in the set. Formally,

Definition 1.1: A metric space is a pair $$(X,d)$$ where $$X$$ is a set and $$d: X \times X \rightarrow \mathbb{R}$$ is a function with the following properties:

1. $$d(x,y) \geq 0$$ for any $$x,y \in X$$; $$d(x,y)=0$$ if and only if $$x=y$$

2. $$d(x,y) = d(y,x)$$ for all $$x,y \in X$$

3. $$d(x,y) + d(y,z) \geq d(x,z)$$ for all $$x,y,z \in X$$

We will often say "$$X$$ is a metric space" if the metric $$d$$ is understood from context.

Exercise 1.2: One of the most familiar examples of a metric space is the plane $$\mathbb{R}^2$$ with a metric given by the distance formula $$d((x_1,y_1),(x_2,y_2)) = \sqrt{(x_1-x_2)^2 + (y_1-y_2)^2}$$. Check that $$d$$ statisfies the definition of a metric. This is sometimes called the euclidean or standard metric on the plane.

Exercise 1.3: The line $$\mathbb{R}$$ with $$d(x_1,x_2) = |x_1 - x_2|$$ is also a metric space. Check that this defines a metric. Note that if we consider $$\mathbb{R}$$ as $$\{(x,0) : x \in \mathbb{R}\} \subset \mathbb{R}^2$$, then this is the same metric from Example 1.2.

From now on, if we are considering a metric on $$\mathbb{R}^n$$, we assume it is the standard metric given by the distance between points $$d(a,b)=\sqrt{(b_1-a_1)^2+\dots+(b_n-a_n)^2}$$ where $$a=(a_1,\dots,a_n),b=(b_1,\dots,b_n)$$, unless stated otherwise.

Exercise 1.4: A different metric on $$\mathbb{R}^2$$ is given by $$d((x_1,y_1),(x_2,y_2)) = \max\{|x_1-x_2|,|y_1-y_2|\}$$. Check that $$d$$ is a metric. This is sometimes called the square metric.

Exercise 1.5: For any set $$X$$, we can define $$d$$ by $$d(x,x)=0$$ and $$d(x,y)=1$$ if $$x \neq y$$. Check that $$d$$ is a metric. This metric is called the discrete metric on $$X$$.

Definition 1.6: If $$X$$ is a metric space, the ball of radius $$\epsilon$$ around a point $$x \in X$$ is denoted $$B(x,\epsilon)$$ and defined by:

$$B(x,\epsilon) = \{y \in X : d(x,y) < \epsilon\}$$

We usually think of $$\epsilon$$ as being a small quantity and so $$B(x,\epsilon)$$ consists of the points in $$X$$ that are "close" to $$x$$.

Open and Closed Sets
Next we turn to a fundamental concept in topology, the notion of open or closed sets. You've probably seen an informal definition of open sets in a calculus class, something like "a set is open if it doesn't contain its boundary". We can formulate this idea in terms of a metric as follows:

Definition 1.7:  If $$X$$ is a metric space, $$U \subseteq X$$ is open if for every $$x \in U$$ there is some $$\epsilon > 0$$ so that $$B(x,\epsilon) \subseteq U$$.

Intuitively, this says that a set $$U$$ is open if every point in the set has a small neighborhood of points that are also in the set - that is, none of the points of $$U$$ lie on the "edge" of $$U$$.

We think of a set being closed if it contains all of the points on its "edge". Thus we define:

Definition 1.8: $$C \subseteq X$$ is closed if $$X \setminus C$$ is open.

Exercise 1.9: Show that with the standard metric on $$\mathbb{R}^2$$, $$\{(x,y): x^2+y^2 < 1\}$$ is open.

Discussion 1.9.b: What about the square metric or discrete metric on $$\mathbb{R}^2$$? Is there any metric on $$\mathbb{R}^2$$ which makes $$\{(x,y): x^2+y^2 < 1\}$$ nonopen?

Note that sets need not be open or closed and that, in some cases, sets may be both open and closed.

Exercise 1.10: Show the following: In the standard metric on the line $$[0,1)$$ is neither open nor closed.

Exercise 1.10.b: Show that every subset of a discrete metric space is "clopen" (both open and closed).

Next, note that the arbitrary union and finite intersection of open sets is still open:

Proposition 1.11: If $$U_i$$ is open for each $$i$$ in some indexing set $$I$$, then $$\bigcup_{i \in I} U_i$$ is open.

Proposition 1.12: If $$U_1$$ and $$U_2$$ are open, then $$U_1 \cap U_2$$ is open.

It follows from Proposition 1.12 that any finite intersection of open sets is open.

Exercise 1.12.b: Let $$d$$ be any metric on any set $$X$$. Find an example to show that the intersection of infinitely many open sets may not be open for this arbitrary metric.

Sequences
A key concept in studying metric spaces is the idea of a convergent sequence. The idea is probably familiar to you already from a calculus class, but may look a little different in this setting:

Definition 1.13: If $$x_1, x_2, \dots \in X$$ is a sequence of points in $$X$$ and $$x \in X$$ is a point, we say that the sequence $$x_n$$ converges to $$x$$, written $$\lim_{n \rightarrow \infty} x_n = x$$ or $$x_n \rightarrow x$$ if for every $$\epsilon > 0$$ there is some $$N$$ large enough that for every $$n \geq N$$, $$x_n \in B(x, \epsilon)$$

Intuitively, $$x_n \rightarrow x$$ means that by going far enough out in the sequence, the remaining terms will all stay arbitrarily close to the limit $$x$$.

Exercise 1.14: Show that in the standard metric on the line, $$\frac{1}{n} \rightarrow 0$$ and that the sequence $$x_n = (-1)^n$$ does not converge to any point.

Proposition 1.15: If $$x \neq y \in X$$ for some metric space $$X$$, then there is some $$\epsilon$$ so that $$B(x,\epsilon) \cap B(y,\epsilon) = \emptyset$$.

Corollary 1.16: If $$x_n$$ is a convergent sequence in a metric space, then it cannot converge to two distinct points.

The next two propositions summarize the behavior of sequences with respect to open or closed sets.

Proposition 1.17: If $$U$$ is open, $$x \in U$$ and $$x_n \rightarrow x$$, there is some $$N$$ so that $$x_n \in U$$ for all $$n \geq N$$.

Proposition 1.18: If $$C$$ is closed, $$x_n \in C$$ for each $$n$$ and $$x_n \rightarrow x$$, then $$x \in C$$.

Continuity
Finally, having a notion of distance allows us to define what it means for a function to be continuous. The following definition is likely familiar to you:

Definition 1.19: If $$(X,d_X)$$ and $$(Y,d_Y)$$ are metric spaces, we say a function $$f:X \rightarrow Y$$ is continuous at a point $$x$$ if given any $$\epsilon > 0$$ there is some $$\delta > 0$$ so that

$$d_Y(f(x),f(y)) < \epsilon$$ whenever $$d_X(x,y) < \delta$$

A function which is continuous at every point in its domain is said to be a continuous function.

Informally, the fact that $$f$$ is continuous means that by picking points $$x$$ and $$y$$ sufficiently close together, we can ensure that $$f(x)$$ and $$f(y)$$ remain close together, so $$f$$ doesn't have any sudden jumps or breaks.

In metric spaces, there is a close connection between continuous functions and sequences:

Proposition 1.20: If $$f: X \rightarrow Y$$ is continuous and $$\lim_{n \rightarrow \infty}x_n = x$$ for $$x_1,x_2,\dots\in X$$ and $$x\in X$$, then $$\lim_{n\rightarrow\infty} f(x_n) = f(x)$$.

Finally, there is a close connection between continuity and open sets that can be stated without any reference to the metric:

Proposition 1.21: $$f: X \rightarrow Y$$ is continuous if and only if $$f^{-1}(U)$$ is open in $$X$$ for every open $$U \subseteq Y$$.

We will see shortly that this allows us to make sense of continuity even in more general spaces that do not have a metric.