Why Counterexamples Matter
The previous tutorial used compactness strategically: open covers, closed constraints, and sequences each provide a useful route to a proof. Counterexamples help with the other side of that work. They show what can go wrong when a hypothesis is removed, and they prevent plausible but false extensions of a theorem. In the real line, the Heine–Borel Theorem gives a quick test: a set is compact exactly when it is closed and bounded. Open covers and sequences can then make the failure concrete.
Several results already established in this course describe what compactness guarantees. A compact set is bounded and closed; a continuous image of a compact set is compact; and every sequence in a compact set has a convergent subsequence whose limit belongs to the set. We will use those results by name. Our goal is not to reprove them, but to build examples that reveal the role of their assumptions.
An Explicit Cover of a Half-Open Interval
The Heine–Borel Theorem says that \([0,1)\) is not compact: it is bounded but not closed. An open cover makes the obstruction visible. Each set in the cover reaches a little farther toward \(1\), but no finite collection reaches all the way to points arbitrarily close to \(1\).
Proof. Each \(U_n\) is open. If \(x\in[0,1)\), then \(1-x>0\), so there is an integer \(n\geq2\) with \(1/n<1-x\). This inequality rearranges to \(x<1-1/n\). Also \(x\geq0>-1\), so \(x\in U_n\). Thus the family covers \([0,1)\).
Now take any finite collection \(U_{n_1},\ldots,U_{n_m}\) from the family, and let \(N\) be the largest of its indices. If \(n\leq N\), then \(1-1/n\leq1-1/N\), so \(U_n\subseteq U_N\). Therefore the union of the finite collection is contained in \(U_N\). The point \(x=1-1/(2N)\) lies in \([0,1)\), but \(1-1/(2N)>1-1/N\), so \(x\notin U_N\). The finite collection does not cover \([0,1)\). Since this holds for every finite collection, there is no finite subcover. \(\square\)
The missing endpoint is central to this example. The sets \(U_n\) cover every point below \(1\), but their right endpoints remain below \(1\) for every individual \(n\). A finite subcover has a largest index and therefore a single rightmost endpoint still below \(1\). This is a useful pattern: when a set approaches a missing boundary point, try neighborhoods that exhaust the set in stages.
Worked Example: A Sequence Detects a Missing Limit Point
Let \(E=\{1/n:n\geq1\}\). This is a bounded subset of the compact interval \([0,1]\), but \(E\) is not compact. To see the missing limit directly, consider the sequence \(x_n=1/n\), whose terms all lie in \(E\).
Every subsequence has the form \(x_{n_k}=1/n_k\), where the indices are strictly increasing. Hence \(n_k\geq k\), so \(0<1/n_k\leq1/k\), and \(1/n_k\to0\). Thus every subsequence converges to \(0\), which is not in \(E\). No subsequence converges to a point of \(E\). By the Sequential Characterization of Compactness in \(\mathbb{R}\), \(E\) cannot be compact.
This example illustrates a general diagnostic: a sequence in a set that is forced to converge only to a point outside the set rules out sequential compactness, and therefore compactness in \(\mathbb{R}\). The sequence does not merely fail to converge; the important fact is that none of its subsequences can have a limit inside the set.
Closedness Does Not Replace Boundedness
The opposite failure is also possible. A set may be closed and still fail to be compact if it is unbounded. The compactness theorem for real sets requires both closedness and boundedness; neither condition alone suffices. The following cover verifies the failure without relying only on the theorem.
Proof. Each \(V_n\) is open. Given \(x\in[0,\infty)\), choose a positive integer \(n>x\). Then \(-1<x<n\), so \(x\in V_n\), and the family covers \([0,\infty)\).
For any finite selection of these intervals, let \(N\) be the largest index selected. Because \(V_n\subseteq V_N\) whenever \(n\leq N\), their union is contained in \(V_N=(-1,N)\). But \(N+1\in[0,\infty)\) and \(N+1\notin V_N\). The finite selection does not cover the set. Therefore the cover has no finite subcover, and \([0,\infty)\) is not compact. \(\square\)
Here the obstruction is different from the one for \([0,1)\). There is no missing finite endpoint to approach. Instead, any finite selection of cover members is bounded above, while the set being covered is not. This reflects the Bounded Open-Cover Obstruction established earlier in the course.
Worked Example: An Infinite Union of Compact Sets Need Not Be Compact
For each positive integer \(n\), the singleton \(K_n=\{n\}\) is compact, since every finite subset of \(\mathbb{R}\) is compact. Their union is the positive integers. It is unbounded: given any real \(M\), the Archimedean property provides a positive integer \(n>M\). Since every compact subset of \(\mathbb{R}\) is bounded, \(\bigcup_{n\geq1}K_n\) is not compact.
The contrast with the finite-union theorem is important. A finite union of compact sets is compact, but that conclusion does not extend to arbitrary unions. In this example the individual sets are as small as possible, yet the union spreads without bound.
Continuity Is Essential for Compact Images
The theorem on Continuous Images of Compact Sets requires a continuous function. Without continuity, even a compact domain can have an unbounded image. Define \(f:[0,1]\to\mathbb{R}\) by \(f(0)=0\) and \(f(x)=1/x\) for \(x>0\). The domain \([0,1]\) is compact. For each \(y\geq1\), the point \(x=1/y\) belongs to \((0,1]\), and \(f(x)=y\). Also \(f(x)\geq1\) whenever \(x>0\). Consequently \(f([0,1])=\{0\}\cup[1,\infty)\), which is unbounded and therefore not compact.
The function is discontinuous at \(0\). Indeed, for \(x_n=1/n\), we have \(x_n\to0\) but \(f(x_n)=n\), which does not converge to \(f(0)=0\). This example identifies exactly the failed hypothesis: compactness of the domain alone does not ensure a compact image; continuity is needed.
Worked Example: Continuous on a Noncompact Domain Does Not Ensure Boundedness
Now use the same formula on a different domain: let \(g:(0,1]\to\mathbb{R}\) be \(g(x)=1/x\). This function is continuous at every point of \((0,1]\), since the reciprocal function is continuous wherever its input is nonzero.
For every positive integer \(n\), the input \(1/n\) lies in \((0,1]\) and \(g(1/n)=n\). Thus \(g\) is unbounded. It also does not attain a maximum: for any \(x\in(0,1]\), \(g(x)=1/x\) is finite, and choosing \(y=x/2\in(0,1]\) gives \(g(y)=2/x>1/x=g(x)\). There can be no largest value.
The Extreme Value Theorem promises boundedness and attainment for continuous functions on nonempty compact domains. This example does not contradict that theorem because \((0,1]\) is not compact: it is bounded but not closed. It also shows why continuity by itself is not enough for the conclusion.
How to Read a Counterexample
A counterexample is most useful when it does more than refute a statement. It should identify the precise role of the missing condition. These examples separate several common claims that can otherwise be blurred together:
| Claim being tested | Counterexample | Failure exposed |
|---|---|---|
| Every bounded set is compact. | \([0,1)\) | Boundedness does not supply closedness. |
| Every closed set is compact. | \([0,\infty)\) | Closedness does not supply boundedness. |
| An arbitrary union of compact sets is compact. | \(\bigcup_{n\geq1}\{n\}\) | Finite unions and infinite unions behave differently. |
| A function on a compact set always has compact image. | The discontinuous \(f\) on \([0,1]\) | Continuity cannot be omitted. |
| A continuous function always attains its extrema. | \(g(x)=1/x\) on \((0,1]\) | The domain's compactness cannot be omitted. |
When a proposed argument invokes compactness, check which conclusion is actually available. Compactness does not say that every subset is compact: the set \(E=\{1/n:n\geq1\}\) sits inside the compact interval \([0,1]\), yet it omits its limiting point. Compactness does not turn an infinite union into a finite one, nor does it repair discontinuity. Each theorem has its own hypotheses, and a counterexample often pinpoints the first missing one.
For a subset of \(\mathbb{R}\), the Heine–Borel Theorem reduces compactness to these two checks.
A sequence whose subsequences cannot converge inside the set, or a cover with no finite subcover, gives direct evidence of noncompactness.
Check whether the claim needs compactness of the domain, continuity of a function, or only a finite rather than arbitrary union.
Counterexamples are not exceptions to compactness theory; they clarify its boundaries. The interval \([0,1)\), the ray \([0,\infty)\), and the reciprocal function each fail for a different reason. Keeping those reasons distinct makes it easier to choose the right compactness theorem—and to know when that theorem cannot apply.
Check Your Understanding
Use the examples and results in this tutorial to answer the following questions.
- Why does every finite subcollection of the cover \(U_n=(-1,1-1/n)\) fail to cover \([0,1)\)?
- For the sequence \(1/n\) in \(E=\{1/n:n\geq1\}\), what is the limit of every subsequence, and why does that show \(E\) is not compact?
- Which compactness hypothesis fails for \([0,\infty)\), and how does the cover \(V_n=(-1,n)\) display that failure?
- What is the image of the discontinuous function \(f\) on \([0,1]\), and which hypothesis of the Continuous Images of Compact Sets Theorem is missing?
- Why does \(g(x)=1/x\) on \((0,1]\) not contradict the Extreme Value Theorem?