Tutorials › Real Analysis › Examples of Compact Sets

Compactness · Tutorial 276 of 1000

Examples of Compact Sets

See how familiar and less familiar subsets of the real line become compact, and learn why intersections of compact sets remain compact.

Intermediate 9 min read

What You'll Learn

  • Apply the Heine–Borel theorem to recognize compact intervals and other closed bounded sets.
  • Verify that a sequence’s range together with its limit forms a compact set.
  • Prove compactness of arbitrary nonempty intersections of compact sets in the real line.
  • Construct the Cantor set as an intersection of compact sets.
  • Distinguish compactness from being an interval or being finite.

Recognizing Compact Sets Through Examples

In “Compactness in the Real Line,” the Heine–Borel theorem gave a practical test: a subset of \(\mathbb{R}\) is compact if and only if it is closed and bounded. This tutorial uses that test to examine examples with different shapes. Some are intervals, while others have isolated points or are built from infinitely many stages. The open-cover definition still underlies compactness, but in \(\mathbb{R}\) the closed-and-bounded test often makes verification more direct.

Recall that compactness means every open cover has a finite subcover. The Heine–Borel theorem lets us establish that property by checking two conditions instead: the set contains its limit points, and it fits inside a bounded interval. We will also prove a useful rule for taking intersections of compact sets, then apply it to a standard example.

Worked Example: A Shifted Closed Interval

Consider \(K=\{x\in\mathbb{R}: |x-\sqrt{2}|\leq 1\}\). The absolute-value inequality is equivalent to \(-1\leq x-\sqrt{2}\leq 1\). Adding \(\sqrt{2}\) to all three parts gives \(\sqrt{2}-1\leq x\leq\sqrt{2}+1\). Thus \(K=[\sqrt{2}-1,\sqrt{2}+1]\).

The interval is closed, and it is bounded because both endpoints are real numbers. By the Heine–Borel theorem, \(K\) is compact. The endpoints are included: substituting \(x=\sqrt{2}-1\) gives \(|x-\sqrt{2}|=|-1|=1\), and substituting \(x=\sqrt{2}+1\) gives \(|x-\sqrt{2}|=|1|=1\). This example is a reminder that compactness does not depend on the endpoints being rational or on the interval being centered at zero.

A Compact Set Made from a Sequence

A compact set need not contain an interval. A basic example is the range of a convergent sequence together with its limit. The limit is essential: omitting it can make the set fail to be closed. The following result gives a concrete compact set with infinitely many isolated points and one accumulation point.

Theorem: The set \(S=\{0\}\cup\{1/n:n\geq 1\}\) is compact in \(\mathbb{R}\).

Proof. The set \(S\) is bounded because \(0\leq x\leq 1\) for every \(x\in S\). We show it is closed using the Sequential Criterion for Closedness from “Sequences and Closure.” Let \((x_j)\) be any convergent sequence with \(x_j\in S\) for every \(j\), and write \(x_j\to x\).

If \(x_j=0\) for infinitely many indices \(j\), that subsequence is constant and hence converges to \(0\). Every subsequence of a convergent sequence has the same limit as the original sequence, so \(x=0\in S\).

Suppose instead that only finitely many terms equal zero. After discarding those terms, write \(x_j=1/n_j\), where each \(n_j\) is a positive integer. If the integers \(n_j\) are unbounded, we can choose a subsequence of them, denoted \(n_{j_k}\), such that \(n_{j_k}\geq k\) for every positive integer \(k\). Then \(0\leq x_{j_k}=1/n_{j_k}\leq 1/k\), so \(x_{j_k}\to 0\). Since this subsequence must also converge to \(x\), uniqueness of limits gives \(x=0\in S\).

If the integers \(n_j\) are bounded, all terms in the tail of the sequence belong to a finite set of the form \(\{1,1/2,\ldots,1/N\}\) for some positive integer \(N\). A convergent sequence taking values in a finite set has its limit in that set: if its limit were outside the finite set, the minimum of its finitely many positive distances to those values would be positive, contradicting convergence. Thus \(x\in S\) in this case as well. Every convergent sequence in \(S\) has its limit in \(S\), so \(S\) is closed. The Heine–Borel theorem now implies that \(S\) is compact. \(\square\)

Worked Example: Locating the Accumulation Point

For \(S=\{0\}\cup\{1/n:n\geq1\}\), the points \(1/n\) approach \(0\), since \(1/n\to0\). Thus every neighborhood of \(0\) contains points of \(S\) other than \(0\), and \(0\) is an accumulation point of \(S\).

Each point \(1/m\), for a fixed positive integer \(m\), is isolated in \(S\). To verify this, choose a radius smaller than half the distance from \(1/m\) to its nearest distinct point in the set. For \(m\geq2\), the adjacent values are \(1/(m-1)\) and \(1/(m+1)\), and both distances \(\frac{1}{m-1}-\frac{1}{m}\) and \(\frac{1}{m}-\frac{1}{m+1}\) are positive. A sufficiently small ball around \(1/m\) therefore contains no other point of \(S\). For \(m=1\), the only adjacent value in \(S\) is \(1/2\), also at positive distance. This set is compact despite having infinitely many isolated points: its limit point \(0\) is included, and the set is bounded.

Intersections of Compact Sets

For a finite intersection, it is natural to expect compactness to persist. In fact, on the real line the same conclusion holds for an arbitrary nonempty family of compact sets. The key is to use two facts already established: compact subsets of \(\mathbb{R}\) are closed, and arbitrary intersections of closed sets are closed. The intersection is also contained in any one member of the family, which supplies boundedness.

Theorem: Let \(\{K_\alpha:\alpha\in A\}\) be a nonempty family of compact subsets of \(\mathbb{R}\). Then \(\bigcap_{\alpha\in A}K_\alpha\) is compact.

Proof. Put \(E=\bigcap_{\alpha\in A}K_\alpha\). Every \(K_\alpha\) is closed by the result that compact subsets of \(\mathbb{R}\) are closed. The Arbitrary Intersections of Closed Sets theorem therefore shows that \(E\) is closed. Since the family is nonempty, choose an index \(\alpha_0\in A\). We have \(E\subseteq K_{\alpha_0}\), and \(K_{\alpha_0}\) is bounded, so \(E\) is bounded as well. By the Heine–Borel theorem, \(E\) is compact. This also covers the possibility \(E=\varnothing\), which is closed and bounded and hence compact. \(\square\)

The nonempty-family hypothesis matters. If the family has no members, the intersection is conventionally \(\mathbb{R}\), which is not bounded and therefore is not compact. When the family does have members, the proof needs only one of them to provide a bounded set containing the intersection. Closedness, by contrast, comes from all the members.

Worked Example: The Cantor Set

Begin with \(C_0=[0,1]\). To form \(C_1\), remove the open middle third \((1/3,2/3)\), leaving \(C_1=[0,1/3]\cup[2/3,1]\). At each later stage, remove the open middle third from every interval remaining at the preceding stage. Thus each \(C_n\) is a finite union of closed intervals, and \(C_{n+1}\subseteq C_n\).

Each \(C_n\) is compact. Indeed, its constituent intervals are closed and bounded, so they are compact by the Heine–Borel theorem; the theorem on finite unions of compact sets then applies. The family \(\{C_n:n\geq0\}\) is nonempty, so the intersection theorem gives that \(C=\bigcap_{n=0}^{\infty}C_n\) is compact. It is also nonempty: \(0\) and \(1\) remain in every \(C_n\), so both belong to \(C\). The set is bounded because \(C\subseteq[0,1]\), and the intersection theorem ensures it is closed.

This construction illustrates why the intersection theorem is useful. Every stage consists of a finite collection of intervals, but the final set is defined by infinitely many restrictions. Compactness follows without trying to analyze an arbitrary open cover of \(C\) directly. The set is not itself an interval: \(1/2\notin C\), since it was removed at the first stage, while \(0\in C\). Compact sets can therefore have gaps and complicated shapes.

What These Examples Show

The examples give several different ways compact sets can appear. A closed interval is compact by Heine–Borel. The sequence set \(S\) is compact because its one accumulation point is included and it is bounded. The Cantor set is compact as an intersection of compact sets, even though it is assembled through infinitely many stages. None of these arguments requires a set to be a single interval or to have only finitely many points.

A common pitfall is to check boundedness and then assume compactness. Boundedness alone is not enough: the set \(\{1/n:n\geq1\}\) lies in \([0,1]\), but it omits its limit \(0\) and so is not closed. By Heine–Borel it is not compact. Adding \(0\) produces the compact set \(S\). Another pitfall is to assume that intersections of compact sets are compact for reasons that work in any setting without checking the hypotheses. Here the proof uses compact sets being closed and the intersection being contained in one bounded member; the nonempty-family condition ensures such a member exists.

Set or constructionWhy it is compactFeature to notice
A closed bounded intervalIt is closed and bounded, so Heine–Borel applies.Its endpoints may be irrational.
\(\{0\}\cup\{1/n:n\geq1\}\)It is closed and bounded.It has infinitely many isolated points and includes their accumulation point.
The Cantor setIt is an intersection of a nonempty family of compact sets.It is compact without being an interval.

When examining a proposed example, first identify its construction, then choose the shortest valid proof. For a directly specified subset of \(\mathbb{R}\), closedness and boundedness are usually the most efficient route. For a set built by successive restrictions, it may be easier to express it as an intersection and use the compact-intersection theorem.

1
Identify the set’s form.
Decide whether it is an interval, a sequence range with a limit, or an intersection of simpler sets.
2
Check the relevant hypotheses.
For Heine–Borel, verify both closedness and boundedness. For the intersection result, ensure the family is nonempty and each member is compact.
3
State the conclusion and its reason.
Apply the appropriate theorem only after verifying its hypotheses, including whether any limiting points have been omitted.

Check Your Understanding

Use the examples and results in this tutorial to answer the following questions.

  1. Why is \(\{1/n:n\geq1\}\) not compact, while adjoining \(0\) makes the set compact?
  2. In the proof that \(S\) is closed, what conclusion follows if the positive integer indices \(n_j\) are unbounded?
  3. Why is the hypothesis that the family of compact sets is nonempty needed in the intersection theorem?
  4. How does the construction of the Cantor set use the compact-intersection theorem?
  5. Give one reason a compact subset of \(\mathbb{R}\) need not be an interval.