Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
Mathematics LibreTexts

7.2: Open and Closed Sets

 

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

Topology

It is useful to define a so-called topology. That is we define closed and open sets in a metric space. Before doing so, let us define two special sets.

Let \((X,d)\) be a metric space, \(x \in X\) and \(\delta > 0\). Then define the open ball or simply ball of radius \(\delta\) around \(x\) as \[B(x,\delta) := \{ y \in X : d(x,y) < \delta \} .\] Similarly we define the closed ball as \[C(x,\delta) := \{ y \in X : d(x,y) \leq \delta \} .\]

When we are dealing with different metric spaces, it is sometimes convenient to emphasize which metric space the ball is in. We do this by writing \(B_X(x,\delta) := B(x,\delta)\) or \(C_X(x,\delta) := C(x,\delta)\).

Take the metric space \({\mathbb{R}}\) with the standard metric. For \(x \in {\mathbb{R}}\), and \(\delta > 0\) we get \[B(x,\delta) = (x-\delta,x+\delta) \qquad \text{and} \qquad C(x,\delta) = [x-\delta,x+\delta] .\]

Be careful when working on a subspace. Suppose we take the metric space \([0,1]\) as a subspace of \({\mathbb{R}}\). Then in \([0,1]\) we get \[B(0,\nicefrac{1}{2}) = B_{[0,1]}(0,\nicefrac{1}{2}) = [0,\nicefrac{1}{2}) .\] This is of course different from \(B_

ParseError: invalid DekiScript (click for details)
Callstack:
    at (TextMaps/Analysis/Book:_Introduction_to_Real_Analysis_(Lebl)/7:_Metric_Spaces/7.2:_Open_and_Closed_Sets), /content/body/div[1]/p[5]/span[5]/span, line 1, column 1
(0,\nicefrac{1}{2}) = (-\nicefrac{1}{2},\nicefrac{1}{2})\). The important thing to keep in mind is which metric space we are working in.

Let \((X,d)\) be a metric space. A set \(V \subset X\) is open if for every \(x \in V\), there exists a \(\delta > 0\) such that \(B(x,\delta) \subset V\). See . A set \(E \subset X\) is closed if the complement \(E^c = X \setminus E\) is open. When the ambient space \(X\) is not clear from context we say \(V\) is open in \(X\) and \(E\) is closed in \(X\).

If \(x \in V\) and \(V\) is open, then we say that \(V\) is an open neighborhood of \(x\) (or sometimes just neighborhood).

Intuitively, an open set is a set that does not include its “boundary.” Note that not every set is either open or closed, in fact generally most subsets are neither.

The set \([0,1) \subset {\mathbb{R}}\) is neither open nor closed. First, every ball in \({\mathbb{R}}\) around \(0\), \((-\delta,\delta)\) contains negative numbers and hence is not contained in \([0,1)\) and so \([0,1)\) is not open. Second, every ball in \({\mathbb{R}}\) around \(1\), \((1-\delta,1+\delta)\) contains numbers strictly less than 1 and greater than 0 (e.g. \(1-\nicefrac{\delta}{2}\) as long as \(\delta < 2\)). Thus \({\mathbb{R}}\setminus [0,1)\) is not open, and so \([0,1)\) is not closed.

[prop:topology:open] Let \((X,d)\) be a metric space.

  1. [topology:openi] \(\emptyset\) and \(X\) are open in \(X\).

  2. [topology:openii] If \(V_1, V_2, \ldots, V_k\) are open then \[\bigcap_{j=1}^k V_j\] is also open. That is, finite intersection of open sets is open.

  3. [topology:openiii] If \(\{ V_\lambda \}_{\lambda \in I}\) is an arbitrary collection of open sets, then \[\bigcup_{\lambda \in I} V_\lambda\] is also open. That is, union of open sets is open.

Note that the index set in [topology:openiii] is arbitrarily large. By \(\bigcup_{\lambda \in I} V_\lambda\) we simply mean the set of all \(x\) such that \(x \in V_\lambda\) for at least one \(\lambda \in I\).

The set \(X\) and \(\emptyset\) are obviously open in \(X\).

Let us prove [topology:openii]. If \(x \in \bigcap_{j=1}^k V_j\), then \(x \in V_j\) for all \(j\). As \(V_j\) are all open, there exists a \(\delta_j > 0\) for every \(j\) such that \(B(x,\delta_j) \subset V_j\). Take \(\delta := \min \{ \delta_1,\ldots,\delta_k \}\) and note that \(\delta > 0\). We have \(B(x,\delta) \subset B(x,\delta_j) \subset V_j\) for every \(j\) and thus \(B(x,\delta) \subset \bigcap_{j=1}^k V_j\). Thus the intersection is open.

Let us prove [topology:openiii]. If \(x \in \bigcup_{\lambda \in I} V_\lambda\), then \(x \in V_\lambda\) for some \(\lambda \in I\). As \(V_\lambda\) is open then there exists a \(\delta > 0\) such that \(B(x,\delta) \subset V_\lambda\). But then \(B(x,\delta) \subset \bigcup_{\lambda \in I} V_\lambda\) and so the union is open.

The main thing to notice is the difference between items [topology:openii] and [topology:openiii]. Item [topology:openii] is not true for an arbitrary intersection, for example \(\bigcap_{n=1}^\infty (-\nicefrac{1}{n},\nicefrac{1}{n}) = \{ 0 \}\), which is not open.

The proof of the following analogous proposition for closed sets is left as an exercise.

[prop:topology:closed] Let \((X,d)\) be a metric space.

  1. [topology:closedi] \(\emptyset\) and \(X\) are closed in \(X\).

  2. [topology:closedii] If \(\{ E_\lambda \}_{\lambda \in I}\) is an arbitrary collection of closed sets, then \[\bigcap_{\lambda \in I} E_\lambda\] is also closed. That is, intersection of closed sets is closed.

  3. [topology:closediii] If \(E_1, E_2, \ldots, E_k\) are closed then \[\bigcup_{j=1}^k E_j\] is also closed. That is, finite union of closed sets is closed.

We have not yet shown that the open ball is open and the closed ball is closed. Let us show this fact now to justify the terminology.

[prop:topology:ballsopenclosed] Let \((X,d)\) be a metric space, \(x \in X\), and \(\delta > 0\). Then \(B(x,\delta)\) is open and \(C(x,\delta)\) is closed.

Let \(y \in B(x,\delta)\). Let \(\alpha := \delta-d(x,y)\). Of course \(\alpha > 0\). Now let \(z \in B(y,\alpha)\). Then \[d(x,z) \leq d(x,y) + d(y,z) < d(x,y) + \alpha = d(x,y) + \delta-d(x,y) = \delta .\] Therefore \(z \in B(x,\delta)\) for every \(z \in B(y,\alpha)\). So \(B(y,\alpha) \subset B(x,\delta)\) and \(B(x,\delta)\) is open.

The proof that \(C(x,\delta)\) is closed is left as an exercise.

Again be careful about what is the ambient metric space. As \([0,\nicefrac{1}{2})\) is an open ball in \([0,1]\), this means that \([0,\nicefrac{1}{2})\) is an open set in \([0,1]\). On the other hand \([0,\nicefrac{1}{2})\) is neither open nor closed in \({\mathbb{R}}\).

A useful way to think about an open set is a union of open balls. If \(U\) is open, then for each \(x \in U\), there is a \(\delta_x > 0\) (depending on \(x\) of course) such that \(B(x,\delta_x) \subset U\). Then \(U = \bigcup_{x\in U} B(x,\delta_x)\).

The proof of the following proposition is left as an exercise. Note that there are other open and closed sets in \({\mathbb{R}}\).

[prop:topology:intervals:openclosed] Let \(a < b\) be two real numbers. Then \((a,b)\), \((a,\infty)\), and \((-\infty,b)\) are open in \({\mathbb{R}}\). Also \([a,b]\), \([a,\infty)\), and \((-\infty,b]\) are closed in \({\mathbb{R}}\).

Connected sets

A nonempty metric space \((X,d)\) is connected if the only subsets that are both open and closed are \(\emptyset\) and \(X\) itself.

When we apply the term connected to a nonempty subset \(A \subset X\), we simply mean that \(A\) with the subspace topology is connected.

In other words, a nonempty \(X\) is connected if whenever we write \(X = X_1 \cup X_2\) where \(X_1 \cap X_2 = \emptyset\) and \(X_1\) and \(X_2\) are open, then either \(X_1 = \emptyset\) or \(X_2 = \emptyset\). So to test for disconnectedness, we need to find nonempty disjoint open sets \(X_1\) and \(X_2\) whose union is \(X\). For subsets, we state this idea as a proposition.

Let \((X,d)\) be a metric space. A nonempty set \(S \subset X\) is not connected if and only if there exist open sets \(U_1\) and \(U_2\) in \(X\), such that \(U_1 \cap U_2 \cap S = \emptyset\), \(U_1 \cap S \not= \emptyset\), \(U_2 \cap S \not= \emptyset\), and \[S = \bigl( U_1 \cap S \bigr) \cup \bigl( U_2 \cap S \bigr) .\]

If \(U_j\) is open in \(X\), then \(U_j \cap S\) is open in \(S\) in the subspace topology (with subspace metric). To see this, note that if \(B_X(x,\delta) \subset U_j\), then as \(B_S(x,\delta) = S \cap B_X(x,\delta)\), we have \(B_S(x,\delta) \subset U_j \cap S\). The proof follows by the above discussion.

The proof of the other direction follows by using to find \(U_1\) and \(U_2\) from two open disjoint subsets of \(S\).

Let \(S \subset {\mathbb{R}}\) be such that \(x < z < y\) with \(x,y \in S\) and \(z \notin S\). Claim: \(S\) is not connected. Proof: Notice \[\bigl( (-\infty,z) \cap S \bigr) \cup \bigl( (z,\infty) \cap S \bigr) = S .\]

A set \(S \subset {\mathbb{R}}\) is connected if and only if it is an interval or a single point.

Suppose that \(S\) is connected (so also nonempty). If \(S\) is a single point then we are done. So suppose that \(x < y\) and \(x,y \in S\). If \(z\) is such that \(x < z < y\), then \((-\infty,z) \cap S\) is nonempty and \((z,\infty) \cap S\) is nonempty. The two sets are disjoint. As \(S\) is connected, we must have they their union is not \(S\), so \(z \in S\).

Suppose that \(S\) is bounded, connected, but not a single point. Let \(\alpha := \inf S\) and \(\beta := \sup S\) and note that \(\alpha < \beta\). Suppose \(\alpha < z < \beta\). As \(\alpha\) is the infimum, then there is an \(x \in S\) such that \(\alpha \leq x < z\). Similarly there is a \(y \in S\) such that \(\beta \geq y > z\). We have shown above that \(z \in S\), so \((\alpha,\beta) \subset S\). If \(w < \alpha\), then \(w \notin S\) as \(\alpha\) was the infimum, similarly if \(w > \beta\) then \(w \notin S\). Therefore the only possibilities for \(S\) are \((\alpha,\beta)\), \([\alpha,\beta)\), \((\alpha,\beta]\), \([\alpha,\beta]\).

The proof that an unbounded connected \(S\) is an interval is left as an exercise.

On the other hand suppose that \(S\) is an interval. Suppose that \(U_1\) and \(U_2\) are open subsets of \({\mathbb{R}}\), \(U_1 \cap S\) and \(U_2 \cap S\) are nonempty, and \(S = \bigl( U_1 \cap S \bigr) \cup \bigl( U_2 \cap S \bigr)\). We will show that \(U_1 \cap S\) and \(U_2 \cap S\) contain a common point, so they are not disjoint, and hence \(S\) must be connected. Suppose that there is \(x \in U_1 \cap S\) and \(y \in U_2 \cap S\). We can assume that \(x < y\). As \(S\) is an interval \([x,y] \subset S\). Let \(z := \inf (U_2 \cap [x,y])\). If \(z = x\), then \(z \in U_1\). If \(z > x\), then for any \(\delta > 0\) the ball \(B(z,\delta) = (z-\delta,z+\delta)\) contains points that are not in \(U_2\), and so \(z \notin U_2\) as \(U_2\) is open. Therefore, \(z \in U_1\). As \(U_1\) is open, \(B(z,\delta) \subset U_1\) for a small enough \(\delta > 0\). As \(z\) is the infimum of \(U_2 \cap [x,y]\), there must exist some \(w \in U_2 \cap [x,y]\) such that \(w \in [z,z+\delta) \subset B(z,\delta) \subset U_1\). Therefore \(w \in U_1 \cap U_2 \cap [x,y]\). So \(U_1 \cap S\) and \(U_2 \cap S\) are not disjoint and hence \(S\) is connected.

In many cases a ball \(B(x,\delta)\) is connected. But this is not necessarily true in every metric space. For a simplest example, take a two point space \(\{ a, b\}\) with the discrete metric. Then \(B(a,2) = \{ a , b \}\), which is not connected as \(B(a,1) = \{ a \}\) and \(B(b,1) = \{ b \}\) are open and disjoint.

Closure and boundary

Sometime we wish to take a set and throw in everything that we can approach from the set. This concept is called the closure.

Let \((X,d)\) be a metric space and \(A \subset X\). Then the closure of \(A\) is the set \[\overline{A} := \bigcap \{ E \subset X : \text{$E$ is closed and $A \subset E$} \} .\] That is, \(\overline{A}\) is the intersection of all closed sets that contain \(A\).

Let \((X,d)\) be a metric space and \(A \subset X\). The closure \(\overline{A}\) is closed. Furthermore if \(A\) is closed then \(\overline{A} = A\).

First, the closure is the intersection of closed sets, so it is closed. Second, if \(A\) is closed, then take \(E = A\), hence the intersection of all closed sets \(E\) containing \(A\) must be equal to \(A\).

The closure of \((0,1)\) in \({\mathbb{R}}\) is \([0,1]\). Proof: Simply notice that if \(E\) is closed and contains \((0,1)\), then \(E\) must contain \(0\) and \(1\) (why?). Thus \([0,1] \subset E\). But \([0,1]\) is also closed. Therefore the closure \(\overline{(0,1)} = [0,1]\).

Be careful to notice what ambient metric space you are working with. If \(X = (0,\infty)\), then the closure of \((0,1)\) in \((0,\infty)\) is \((0,1]\). Proof: Similarly as above \((0,1]\) is closed in \((0,\infty)\) (why?). Any closed set \(E\) that contains \((0,1)\) must contain 1 (why?). Therefore \((0,1] \subset E\), and hence \(\overline{(0,1)} = (0,1]\) when working in \((0,\infty)\).

Let us justify the statement that the closure is everything that we can “approach” from the set.

[prop:msclosureappr] Let \((X,d)\) be a metric space and \(A \subset X\). Then \(x \in \overline{A}\) if and only if for every \(\delta > 0\), \(B(x,\delta) \cap A \not=\emptyset\).

Let us prove the two contrapositives. Let us show that \(x \notin \overline{A}\) if and only if there exists a \(\delta > 0\) such that \(B(x,\delta) \cap A = \emptyset\).

First suppose that \(x \notin \overline{A}\). We know \(\overline{A}\) is closed. Thus there is a \(\delta > 0\) such that \(B(x,\delta) \subset \overline{A}^c\). As \(A \subset \overline{A}\) we see that \(B(x,\delta) \subset A^c\) and hence \(B(x,\delta) \cap A = \emptyset\).

On the other hand suppose that there is a \(\delta > 0\) such that \(B(x,\delta) \cap A = \emptyset\). Then \(B(x,\delta)^c\) is a closed set and we have that \(A \subset B(x,\delta)^c\), but \(x \notin B(x,\delta)^c\). Thus as \(\overline{A}\) is the intersection of closed sets containing \(A\), we have \(x \notin \overline{A}\).

We can also talk about what is in the interior of a set and what is on the boundary.

Let \((X,d)\) be a metric space and \(A \subset X\), then the interior of \(A\) is the set \[A^\circ := \{ x \in A : \text{there exists a $\delta > 0$ such that $B(x,\delta) \subset A$} \} .\] The boundary of \(A\) is the set \[\partial A := \overline{A}\setminus A^\circ.\]

Suppose \(A=(0,1]\) and \(X = {\mathbb{R}}\). Then it is not hard to see that \(\overline{A}=[0,1]\), \(A^\circ = (0,1)\), and \(\partial A = \{ 0, 1 \}\).

Suppose \(X = \{ a, b \}\) with the discrete metric. Let \(A = \{ a \}\), then \(\overline{A} = A^\circ\) and \(\partial A = \emptyset\).

Let \((X,d)\) be a metric space and \(A \subset X\). Then \(A^\circ\) is open and \(\partial A\) is closed.

Given \(x \in A^\circ\) we have \(\delta > 0\) such that \(B(x,\delta) \subset A\). If \(z \in B(x,\delta)\), then as open balls are open, there is an \(\epsilon > 0\) such that \(B(z,\epsilon) \subset B(x,\delta) \subset A\), so \(z\) is in \(A^\circ\). Therefore \(B(x,\delta) \subset A^\circ\) and so \(A^\circ\) is open.

As \(A^\circ\) is open, then \(\partial A = \overline{A} \setminus A^\circ = \overline{A} \cap (A^\circ)^c\) is closed.

The boundary is the set of points that are close to both the set and its complement.

Let \((X,d)\) be a metric space and \(A \subset X\). Then \(x \in \partial A\) if and only if for every \(\delta > 0\), \(B(x,\delta) \cap A\) and \(B(x,\delta) \cap A^c\) are both nonempty.

If \(x \notin \overline{A}\), then there is some \(\delta > 0\) such that \(B(x,\delta) \subset \overline{A}^c\) as \(\overline{A}\) is closed. So \(B(x,\delta)\) contains no points of \(A\).

Now suppose that \(x \in A^\circ\), then there exists a \(\delta > 0\) such that \(B(x,\delta) \subset A\), but that means that \(B(x,\delta)\) contains no points of \(A^c\).

Finally suppose that \(x \in \overline{A} \setminus A^\circ\). Let \(\delta > 0\) be arbitrary. By \(B(x,\delta)\) contains a point from \(A\). Also, if \(B(x,\delta)\) contained no points of \(A^c\), then \(x\) would be in \(A^\circ\). Hence \(B(x,\delta)\) contains a points of \(A^c\) as well.

We obtain the following immediate corollary about closures of \(A\) and \(A^c\). We simply apply .

Let \((X,d)\) be a metric space and \(A \subset X\). Then \(\partial A = \overline{A} \cap \overline{A^c}\).

Exercises

Prove . Hint: consider the complements of the sets and apply .

Finish the proof of by proving that \(C(x,\delta)\) is closed.

Prove .

Suppose that \((X,d)\) is a nonempty metric space with the discrete topology. Show that \(X\) is connected if and only if it contains exactly one element.

Show that if \(S \subset {\mathbb{R}}\) is a connected unbounded set, then it is an (unbounded) interval.

Show that every open set can be written as a union of closed sets.

a) Show that \(E\) is closed if and only if \(\partial E \subset E\). b) Show that \(U\) is open if and only if \(\partial U \cap U = \emptyset\).

a) Show that \(A\) is open if and only if \(A^\circ = A\). b) Suppose that \(U\) is an open set and \(U \subset A\). Show that \(U \subset A^\circ\).

Let \(X\) be a set and \(d\), \(d'\) be two metrics on \(X\). Suppose that there exists an \(\alpha > 0\) and \(\beta > 0\) such that \(\alpha d(x,y) \leq d'(x,y) \leq \beta d(x,y)\) for all \(x,y \in X\). Show that \(U\) is open in \((X,d)\) if and only if \(U\) is open in \((X,d')\). That is, the topologies of \((X,d)\) and \((X,d')\) are the same.

Suppose that \(\{ S_i \}\), \(i \in {\mathbb{N}}\) is a collection of connected subsets of a metric space \((X,d)\). Suppose that there exists an \(x \in X\) such that \(x \in S_i\) for all \(i \in N\). Show that \(\bigcup_{i=1}^\infty S_i\) is connected.

Let \(A\) be a connected set. a) Is \(\overline{A}\) connected? Prove or find a counterexample. b) Is \(A^\circ\) connected? Prove or find a counterexample. Hint: Think of sets in \({\mathbb{R}}^2\).

The definition of open sets in the following exercise is usually called the subspace topology. You are asked to show that we obtain the same topology by considering the subspace metric.

[exercise:mssubspace] Suppose \((X,d)\) is a metric space and \(Y \subset X\). Show that with the subspace metric on \(Y\), a set \(U \subset Y\) is open (in \(Y\)) whenever there exists an open set \(V \subset X\) such that \(U = V \cap Y\).

Let \((X,d)\) be a metric space. a) For any \(x \in X\) and \(\delta > 0\), show \(\overline{B(x,\delta)} \subset C(x,\delta)\). b) Is it always true that \(\overline{B(x,\delta)} = C(x,\delta)\)? Prove or find a counterexample.

Let \((X,d)\) be a metric space and \(A \subset X\). Show that \(A^\circ = \bigcup \{ V : V \subset A \text{ is open} \}\).

Contributors