# Real Analysis: Local Metric Topology

## Open and Closed Sets

### Motivation

Topology is the study of how objects behave under continuous functions, and metric topology considers the additional impact of distance in this concern. Formally defining the notion of continuity is itself a major goal of topology. To get there, we need to analyze some more fundamental concepts.

The first goal of metric topology is to categorize the points in a metric space with respect to a given set. For example, is a point fully "inside" the set? Or is it perhaps on the boundary? Is the point close to many other points in the set? Or is it all alone? These questions are answered with the definitions of interior point, boundary point, limit point, and isolated point, respectively. Properties that arise out of the relationship between an individual point and a set are called local topological properties. Properties inherent to a set as a whole are called global topological properties.

### Methodology

It is possible to define the local properties in metric topology by using metric functions. However, just as a metric is a generalization of distance, so too is general topology a generalization of metric topology. General topology, also called point set topology, studies these same properties but without concern for distance between points or sets. Instead, it relies on the notion of an abstract open set. Open sets exist in metric topology, too, and can also be used to describe both local and global topological properties. The question arises - which approach is better?

The answer is that there is a tradeoff. Definitions using metrics are easier to visualize and therefore understand. However, this very specificity makes them harder to generalize. In contrast, the most general definitions highlight the core ideas at play and provide maximum reusability, but at the cost of intuition and motivation. To square this circle, our approach is this: provide the general topological definition, then show how it simplifies to a more intuitive definition involving metrics in specific cases. The hope is that this will provide the benefits of both. Thus, we begin by defining open balls in service of defining open sets, which we then use for all subsequent topological definitions.

### Open Balls and Closed Balls

An open ball is a subset $B_r(x)$ of a metric space $(X, d)$ that includes all points of distance less than $r > 0$ from the point $x \in X.$ Formally, $B_{r}(x) = \{ y : d(x, y) < r \}.$ Similarly, a closed ball is a subset $\overline{B}_r(x)$ that includes all points of distance less than or equal to $r > 0$ from the point $x \in X.$ Formally, $\overline{B}_r(x) = \{ y : d(x, y) \leq r \}.$ In $\mathbb{R},$ open balls are intervals. In $\mathbb{R}^2$ with the standard metric, they are disks, and in $\mathbb{R}^3$ with the standard metric they are spheres.

### Open and Closed Sets

A subset $S$ is open if for every point $x \in S$ there exists some $r > 0$ such that $B_r(x) \subseteq S.$ A subset $S$ is closed if its complement is open. Sets that are both open and closed are called clopen (yes, really).

The definition of open set is somewhat inconvenient, since it requires that every point inside pass a test involving an another kind of set, namely an open ball. However, a useful fact to know is that open balls are themselves open sets. Thus, whenever a proof calls for an open set containing a particular point $x,$ we can simply use an open ball containing $x,$ as by definition such a ball will be a subset of any other open set we happen to imagine that contains $x.$ Note that this technique will not work when a proof calls for an arbitrary open set, since open sets are not necessarily open balls.

An equivalent definition of open set states that a set is open if all of its points are a positive distance from the set's complement. Recall that $\text{Dist}(x, A) = \inf(\{d(x, a) : a \in A\}.$ Thus a set $S$ is open if $\text{Dist}(x, S^c) > 0$ for all $x \in S.$ Note that this is not equivalent to saying that $\text{Dist}(S, S^c) > 0.$ For example, $\text{Dist}(x, (1,2)) > 0$ for all $x \in (0,1),$ but $\text{Dist}((0,1), (1,2)) = 0.$

Note on Topological Diagrams: Generic sets like $S$ are usually drawn as blobs rather than recognizable shapes to indicate the fact that they are arbitrarily chosen. Likewise, drawing them as blobs distinguishes them from those sets, such as $B_{r}(x)$,  that are not arbitrary and have particular geometric qualities to them. In this case, open balls like $B_{r}(x)$ are indeed necessarily circles (when using the standard Euclidean metric).

### Relatively Open and Relatively Closed Sets

Let $Y$ be a subset of a metric space $(X, d)$. A subset $Z \subseteq Y$ is said to be relatively open in $Y$ if $Z = S \cap Y$ for some open subset $S$ of $X.$ This definition of relatively open is identical to the normal definition of open, except the superset in which we consider other points for the open balls around each point is $Y$ instead of $X$. Likewise, $Z$ is relatively closed in $Y$ if its relative complement in $Y$ is relatively open in $Y$. Again, this definition is identical to the normal definition of closed, except that we consider $Z$ as a subset of $Y$ and ignore everything else in $X.$

### Neighborhoods

A neighborhood of a point $x$ is a set that contains an open set containing $x.$ Formally, a set $N_x$ is a neighborhood of $x$ if there exists an open set $S$ such that $x \in S \subseteq N_x.$ The set of all neighborhoods of $x$ is called the complete system of neighborhoods of $x$ and is denoted $\mathfrak{N}(x).$

Because neighborhoods contain open sets containing $x,$ they are often used instead of open sets in definitions and in proofs. The main advantage of this terminology is that it is slightly easier to ask for "a neighborhood of $x$" rather than "an open set containing $x$." However, we will nonetheless stick to the open set terminology. The definitions of neighborhood and complete system of neighborhoods are included here for completeness.

Note: Some older texts define a neighborhood of a point as an open ball centered at the point, rather than any set that contains an open set containing the point. The difference between using open sets containing points, open balls centered at points, and neighborhoods (so defined here) containing points is typically little more than linguistic, as they all include a ball around a point. Just make sure to account for these differences when reading other texts.

### K-Cells in $\mathbb{R}^n$

While open balls form the basis of metric topology, we can also describe rectangles and prisms for $\mathbb{R}^n$ in particular. An open k-cell is a subset of $\mathbb{R}^n$ that includes all points $\textbf{x}$ where $|x_i - y_i| < z_i$ for some $\textbf{y}$ and $\textbf{z}$, where all the components of $\textbf{z}$ are positive. Open k-cells are intervals in $\mathbb{R}$, rectangles in $\mathbb{R}^2$, and rectangular prisms in $\mathbb{R}^3$. The point $\textbf{y}$ is the center of the k-cell, and the components of $\textbf{z}$ are half the length of each side. A closed k-cell is identical to an open k-cell except that $|x_i - y_i| \leq z_i$.

## Problems

1. Show that for any metric space $(X, d)$, the sets $X$ and $\varnothing$ are both clopen.

For any $x \in X$ and any $r > 0$, $B_{r}(x) \subseteq X$, so $X$ is open. Therefore $X^c = \varnothing$ is closed. Likewise, because $\varnothing$ has no points, it is vacuously true that all of its points are contained within open balls that are themselves subsets of $\varnothing.$ Therefore $\varnothing$ is open, and so $\varnothing^c = X$ is closed.

2. Show that every open ball is an open set.

Let $B_{r}(x)$ be a neighborhood of some point $x \in X$. Consider a point $y \in B_{r}(x)$, and let $p = \dfrac{r - d(x, y)}{2}$. Then for any $z \in B_{p}(y)$, it follows that

$d(x, z) \leq d(x, y) + d(y, z) \\ d(x, z) < d(x, y) + p \\ d(x, z) < d(x,y) + \dfrac{r -d(x,y)}{2} \\ d(x, z) < \dfrac{d(x,y) + r}{2} \\ d(x, z) < \dfrac{r + r}{2} \\ d(x, z) < r$

Therefore $B_{p}(y) \subseteq B_{r}(x)$, so $B_{r}(x)$ is open.

3. Show that every closed ball is a closed set.

Consider a metric space $(X, d),$ a point $x \in X,$ and consider a closed ball $\overline{B_{r}}(x)$ for some $r > 0.$ Consider $y \in \overline{B_{r}}(x)^c.$ Then $d(x, y) > r.$ Set $p = d(x, y) - r.$ For any $z \in \overline{B_{p}}(y),$ it follows that

$d(x, y) \leq d(x, z) + d(z, y) \\ d(x, z) \geq d(x, y) - d(z, y) \\ d(x, z) \geq d(x, y) - p \\ d(x, z) \geq d(x, y) - (d(x, y) - r) \\ d(x, z) \geq r$

Therefore $B_{p}(y) \subseteq \overline{B_r}(x)^c.$ Thus $\overline{B_r}(x)^c$ is open, and so $\overline{B_r}(x)$ is closed.

4. Let $(X, d)$ be a metric space where $d$ is the discrete metric. Show that every subset of $X$ is both open and closed.

Consider $A \subseteq X.$ If $A$ is empty, then $A$ is open and closed, as was previously proven. Otherwise, consider some $x \in A.$ Take $r = \frac{1}{2}.$ It follows that $B_{r}(x) = \{x\} \subseteq A.$ Therefore $A$ is open. The same logic shows that $A^c$ is open: If $A^c$ is empty, then it is both open and closed. Otherwise, consider some $y \in A^c.$ It follows that $B_{r}(y) = \{y\} \subseteq A^c.$ Thus $A^c$ is also open, and so $A$ is also closed.

5. Show that every finite subset of $\mathbb{R}$ is closed.

Let $A = \{a_1, \ldots, a_n\}$ be a subset of $\mathbb{R}$. Pick $b \in A^c$ and consider $r = \frac{1}{2} \min\limits_{i} \{d(a_i, b)\}.$ Then $B_{r}(b) \subset A^c$ and so $A^c$ is open. Therefore $A$ is closed.

6. Show that every singleton set is closed.

Consider a metric space $(X, d)$ and a singleton set $\{x\} \subseteq X.$ If $\{x\} = X,$ then $\{x\}$ is closed. Otherwise, pick $y \in \{x\}^c.$ Since $x \neq y,$ it follows that $d(x, y) > 0.$ Set $r = \frac{1}{2}d(x, y).$ Then $x \notin B_{r}(y),$ and so $B_{r}(y) \subseteq \{x\}^c.$ Therefore $\{x\}^c$ is open, and thus $\{x\}$ is closed.

7. Is $\mathbb{Q}$ open, closed, both, or neither in $\mathbb{R}$?

Pick $p \in \mathbb{Q}$ and pick any $r_p > 0.$ Then $B_{r_p}(p)$ contains the point $p + \frac{r_p}{2}.$ Between $p$ and $p + \frac{r_p}{2}$ there exists an irrational number $q,$ and $q \in B_{r_p}(p).$ Therefore $B_{r_p}(p) \not\subseteq \mathbb{Q}.$ Therefore $\mathbb{Q}$ is not open.

Next, pick $s \in \mathbb{R} - \mathbb{Q}$ and pick any $r_s > 0.$ Then $B_{r_s}(s)$ contains the point $s + \frac{r_s}{2}.$ Between $s$ and $s + \frac{r_s}{2}$ there exists a rational number $t,$ and $t \in B_{r_s}(s).$ Therefore $B_{r_s}(s) \not\subseteq \mathbb{R} - \mathbb{Q}.$ Therefore $\mathbb{R} - \mathbb{Q}$ is not open, and so $\mathbb{Q}$ is not closed.

8. Show that for any collection of open sets $\{S_{\alpha}\}$, their union $\bigcup S_{\alpha}$ is open.

Let $x \in \bigcup S_{\alpha}$. Then $x \in S_{\alpha}$ for some $\alpha$. Since $S_{\alpha}$ is open, there is an $r > 0$ such that $B_{r}(x) \subseteq S_{\alpha}$. By transitivity of subsets, $B_{r}(x) \subseteq \bigcup S_{\alpha}$. Therefore $\bigcup S_{\alpha}$ is open.

9. Show that for any collection of closed sets $\{C_{\alpha}\}$, their intersection $\bigcap C_{\alpha}$ is closed.

Since each $C_{\alpha}$ is closed, it follows that each $C_{\alpha}^c$ is open. By De Morgan's Law, $\left(\bigcap\limits_{\alpha} C_{\alpha}\right)^c = \bigcup\limits_{\alpha} C_{\alpha}^c$. The righthand side is a union of open sets, so by the preceding proof is open. It follows that its complement $\bigcap\limits_{\alpha} C_{\alpha}$ is closed.

10. Counterexample: Show that the intersection of an arbitrary collection of open sets is not necessarily open.

Consider the infinite collection of open intervals $\mathcal{C} = \left\{\left(-\frac{1}{n}, \frac{1}{n}\right) : n \in \mathbb{N}^+ \right\}$. Each $C \in \mathcal{C}$ is an open ball of radius $\frac{1}{n}$ centered at $0$ and is therefore an open set. However, $\bigcap \mathcal{C} = \{0\},$ which is finite and therefore closed.

To prove that $\mathcal{C} = \{0\}$, consider the counterfactual where there is some nonzero $c \in \bigcap \mathcal{C}$. Then between $0$ and $c$ there is some rational number $\frac{a}{b}$, which we can assume is in simplest terms. Because $\left|\frac{1}{2b}\right| \leq \left|\frac{a}{2b}\right| \leq \left|\frac{a}{b}\right|$, it follows that $c \notin \left(-\left|\frac{1}{2b}\right|, \left|\frac{1}{2b}\right|\right)$. Therefore $c \notin \bigcap \mathcal{C}$. But $0$ is in every interval in $C$. Thus $C = \{0\}$.

11. Counterexample: Show that the union of an arbitrary collection of closed sets is not necessarily closed.

Consider the set of closed intervals $\mathcal{C} = \{ [-1 + \frac{1}{n}, 1 - \frac{1}{n}] \subset \mathbb{R} : n \in \mathbb{N}^+ \}$. Each $C \in \mathcal{C}$ is a closed ball of radius $\frac{1}{n}$ and is therefore a closed set. However, we show that $\bigcup \mathcal{C} = (-1,1)$ and is therefore open.

Consider some $x \in \bigcup \mathcal{C}$. Then there is some $n \in \mathbb{N}^+$ such that $x \in \left[-1 + \frac{1}{n}, 1 - \frac{1}{n} \right]$. Since $\left[-1 + \frac{1}{n}, 1 - \frac{1}{n} \right] \subset (-1,1)$, it follows that $x \in (-1,1)$.

Conversely, consider $x \in (-1,1)$, and consider the case when $0 < x < 1$. Let $r = \frac{1 - x}{2}.$ Then $x < 1 - r < 1$. By the Archimedean property, there is some $n$ such that $rn > 1$, and thus $\frac{1}{n} < r$. Therefore $1 - r < 1 - \frac{1}{n} < 1$, so $x \in \left[-1 + \frac{1}{n}, 1 - \frac{1}{n}\right]$, and so $x \in \bigcup \mathcal{C}.$ Next, consider the case when $-1 < x < 0.$ Let $r = \frac{1 + x}{2}.$ Then $-1 < -1 + r < x.$ By the Archimedean property, there is some $n$ such that $rn > 1,$ and thus $\frac{1}{n} < r.$ Therefore $-1 < -1 + \frac{1}{n} < -1 + r.$ Therefore $x \in \left[-1 + \frac{1}{n}, 1 - \frac{1}{n}\right]$, and so $x \in \bigcup \mathcal{C}.$ Finally, when $x = 0,$ it is in every set in $\mathcal{C}.$ Therefore $(-1, 1) \subseteq \bigcup\mathcal{C}.$

Thus $\bigcup C = (-1, 1)$ and is therefore open.

12. Show that for any finite collection of subsets $\{S_n\}$, their intersection $\bigcap\limits_{i=1}^n S_i$ is open.

Let $x \in \bigcap\limits_{i=1}^n S_{i}$. Then $x$ is an element of each $S_i.$ Therefore there exists some $r_i > 0$ such that $x \in B_{r_i}(x) \subseteq S_i$ for each $S_i.$ Select $k$ such that $r_k = \text{min}(\{r_1, \ldots, r_n\})$. Then $B_{r_k}(x) \subseteq B_{r_i}$ for all $i \in (1, \ldots, n)$, and so by transitivity $B_{r_k} \subseteq S_i$ as well. Therefore $B_{r_k} \subseteq \bigcap\limits_{i=1}^n S_{i}$, so $\bigcap\limits_{i=1}^n S_{i}$ is open.

13. Show that for any finite collection of closed sets $\{C_n\}$, their union $\bigcup\limits_{i=1}^n C_i$ is closed.

Since each $C_i$ is closed, its complement $C_i^c$ is open. Therefore by the preceding theorem, $\bigcap\limits_{i=1}^n C_i^c$ is open. By De Morgan's Law, $\bigcap\limits_{i=1}^n C_i^c = \left(\bigcup\limits_{i=1}^n C_i\right)^c$. Since the righthand side of the equation is open, its complement, $\bigcup\limits_{i=1}^n C_i$, is closed.

14. Show that every finite set is closed.

Proof by induction. Base case: Singleton sets are closed. Inductive step: Assume sets of cardinality $n$ are closed. Let $S$ be a set such that $|S| = n$ and consider some $x \in S^c.$ Note that $\{x\}$ is a singleton set and therefore closed. Since $S \cap \{x\} = \varnothing,$ it follows that $|S \cup \{x\}| = |S| + |\{x\}| = n + 1.$ Since the finite union of closed sets is closed, it follows that $S \cup \{x\}$ is closed. The result follows by induction.

15. Show that every set is both relatively open in itself and relatively closed in itself.

Consider a metric space $(X, d)$ and a subset $Y$ of $X.$ Since $X$ is open, and $Y = X \cap Y,$ it follows that $Y$ is open relative to itself. Likewise, since $\varnothing$ is open and $\varnothing = \varnothing \cap Y,$ it follows that $\varnothing$ is relatively open in $Y,$ so its relative complement $Y$ is relatively closed in $Y.$

16. Show that if $Z$ is an open subset of $(X, d)$ and $Z \subseteq Y,$ then $Z$ is open relative to $Y.$

Since $Z \subseteq Y,$ it follows that $Z = Z \cap Y.$ Since $Z$ is open, $Z$ is relatively open in $Y.$

Clarifying note: $Z$ plays the role of the open set $S$ in the $S \cap Y$ part used in the definition of relatively open.

17. Show that if $Z$ is a closed subset of $(X,d)$ and $Z \subseteq Y,$ then $Z$ is closed relative to $Y.$

Since $Z$ is closed, its complement $Z^c$ is open. Therefore $Z^c \cap Y$ is relatively open in $Y,$ which means its relative complement in $Y,$ $Z,$ is relatively closed in $Y.$

18. Equivalent definition of relatively open: Consider a metric space $(X, d).$ Let $Z \subseteq Y \subseteq X$. Show that $Z$ is open relative to $Y$ if and only if for every point $x \in Z$ there exists an open set $S$ such that $x \in S \cap Y \subseteq Z.$

Assume $Z$ is open relative to $Y$. Then $Z = S \cap Y$ for some open subset $S$ of $X.$ For each $x \in Z,$ it follows that $x \in S \cap Y \subseteq Z.$

Conversely, assume for every $x \in Z$ there is an open set $S_x$ such that $x \in S_x \cap Y \subseteq Z.$ Set $S = \bigcup\limits_{x \in Z} S_x.$ Because $S$ is a union of open sets, it is open. Since $x \in S_x \cap Y,$ it follows that $x \in S \cap Y,$ and so $Z \subseteq S \cap Y.$ Likewise, it follows from the construction of $S_x$ that $S_x \cap Y \subseteq Z$ for all $x \in Z,$ and so $S \cap Y \subseteq Z.$ Therefore $Z = S \cap Y.$