Tutorials › Real Analysis › Combining Compactness and Connectedness

Connectedness · Tutorial 328 of 1000

Combining Compactness and Connectedness

See how compactness supplies endpoints while connectedness fills every gap between them, and apply the same combination to continuous images.

Intermediate 9 min read

What You'll Learn

  • Characterize nonempty compact connected subsets of the real line as closed bounded intervals.
  • Handle singleton intervals and the empty set carefully.
  • Use compactness to obtain attained minimum and maximum values.
  • Prove that a continuous function on a compact connected set takes every value between its minimum and maximum.
  • Distinguish what compactness alone guarantees from what connectedness adds.
  • Apply the combined results to explicit sets and functions.

Compactness and Connectedness Supply Different Pieces

The previous tutorial developed ways to combine connected sets, including cases where one set meets the closure of another. Compactness contributes a different kind of information: it controls the ends of a set and ensures that continuous functions attain their extreme values. When the two properties are used together, a strong conclusion becomes available. A nonempty compact connected subset of the real line has endpoints, and it contains every point between them.

This conclusion depends on both hypotheses. Compactness alone allows gaps, while connectedness alone allows intervals that extend without bound or omit their endpoints. We will first identify exactly what happens when both properties hold, then apply the same reasoning to the range of a continuous function.

The Shape of a Compact Connected Set

Recall the Characterization of Connected Subsets of \(\mathbb{R}\): a subset of \(\mathbb{R}\) is connected if and only if it is an interval. Also recall the Extreme Value Theorem: a continuous real-valued function on a nonempty compact set attains both a minimum and a maximum. Applying that theorem to the identity function will provide the two endpoints we need.

Theorem: A nonempty subset \(K\subseteq\mathbb{R}\) is compact and connected if and only if \(K=[a,b]\) for some real numbers \(a\leq b\).

Proof. Suppose first that \(K\) is nonempty, compact, and connected. The identity function \(i:K\to\mathbb{R}\), defined by \(i(x)=x\), is continuous. By the Extreme Value Theorem, it attains a minimum \(a\in K\) and a maximum \(b\in K\). Thus \(a\leq x\leq b\) for every \(x\in K\). Since \(K\) is connected, the Characterization of Connected Subsets of \(\mathbb{R}\) says that \(K\) is an interval. An interval containing \(a\) and \(b\) contains every real number between them, so \([a,b]\subseteq K\). The inequalities \(a\leq x\leq b\) for all \(x\in K\) give \(K\subseteq[a,b]\). Therefore \(K=[a,b]\).

Conversely, suppose \(K=[a,b]\) for real numbers \(a\leq b\). It is connected because every interval is connected. It is compact by the Heine–Borel Theorem, since it is closed and bounded. This proves both directions. \(\square\)

The case \(a=b\) is included: \([a,a]=\{a\}\), a singleton that is both compact and connected. The theorem is stated for nonempty sets because the empty set is compact and connected under the usual definitions, but it is not of the form \([a,b]\) for real \(a\leq b\).

Worked Example: Identifying a Compact Connected Set

Consider \(K=[-4,2]\). This is a closed bounded interval, so it is compact by the Heine–Borel Theorem; it is connected because it is an interval. Its minimum is \(-4\) and its maximum is \(2\). The theorem also works in the reverse direction: if a set is known to be nonempty, compact, and connected, and its minimum and maximum are \(-4\) and \(2\), then the set must be exactly \([-4,2]\). It cannot omit, for example, \(0\), because connectedness forces it to contain every point between its endpoints.

Why Compactness Alone Does Not Fill Gaps

It is useful to separate the roles of the two hypotheses. A compact subset of \(\mathbb{R}\) need not be connected. The next example is compact and has minimum and maximum, but the interval between those extreme values is not contained in the set.

Worked Example: A Compact Set with a Gap

Let \(K=[-3,-2]\cup[1,2]\). Each interval is closed and bounded, so their finite union is closed and bounded and hence compact. The set is disconnected: its two pieces are disjoint and nonempty, and they give a separation of \(K\). More explicitly, intersecting \(K\) with the open sets \((-\infty,0)\) and \((0,\infty)\) gives \([-3,-2]\) and \([1,2]\), respectively. Both pieces are relatively open in \(K\), and they partition \(K\).

The minimum of \(K\) is \(-3\) and its maximum is \(2\), but \(0\notin K\). Thus having attained endpoints does not by itself imply that a set contains the interval between them. Compactness supplies the endpoints; connectedness is what rules out the gap.

The converse distinction matters as well. A connected subset of \(\mathbb{R}\) is an interval, but it need not be compact: for example, \((0,1)\) is connected and does not contain its endpoints. Compactness prevents this particular failure by ensuring that the extreme values are attained. Together, the hypotheses give a closed bounded interval rather than merely an interval.

Exact Ranges of Continuous Functions

The same combination applies to a continuous function on a compact connected set. The Continuous Images of Compact Sets Theorem gives compactness of the image, and the Continuous Images of Connected Sets Theorem gives connectedness of the image. The result just proved then identifies the image as an interval with endpoints supplied by the Extreme Value Theorem.

Theorem: Let \(K\subseteq\mathbb{R}\) be nonempty, compact, and connected, and let \(f:K\to\mathbb{R}\) be continuous. Then there are points \(x_{\min},x_{\max}\in K\) such that \(f(K)=[f(x_{\min}),f(x_{\max})]\), where \(f(x_{\min})=\min_{x\in K}f(x)\) and \(f(x_{\max})=\max_{x\in K}f(x)\).

Proof. By the Extreme Value Theorem, there are points \(x_{\min},x_{\max}\in K\) at which \(f\) attains its minimum and maximum. Write \(m=f(x_{\min})\) and \(M=f(x_{\max})\), so \(m\leq M\). By the Continuous Images of Compact Sets Theorem, \(f(K)\) is compact. By the Continuous Images of Connected Sets Theorem, \(f(K)\) is connected. Since \(K\) is nonempty, its image \(f(K)\) is nonempty. The theorem on the shape of compact connected subsets of \(\mathbb{R}\) therefore shows that \(f(K)\) is a closed bounded interval. Its minimum is \(m\) and its maximum is \(M\), because these are the minimum and maximum values of \(f\) on \(K\). Consequently \(f(K)=[m,M]\), as claimed. \(\square\)

In particular, for every \(y\) satisfying \(m\leq y\leq M\), there is some \(x\in K\) with \(f(x)=y\). This is the Intermediate Value Theorem applied to the setting of a compact connected domain, with the additional information that both extreme values are attained. The argument uses established results about compactness and connectedness; the new conclusion comes from applying them together.

Worked Example: The Range of a Square Function

Let \(K=[-2,1]\) and \(f(x)=x^2\). The interval \(K\) is nonempty, compact, and connected. For every \(x\in K\), \(0\leq x^2\leq4\), since \(-2\leq x\leq1\) implies \(|x|\leq2\). The lower bound is attained at \(x=0\), because \(f(0)=0^2=0\), and the upper bound is attained at \(x=-2\), because \(f(-2)=(-2)^2=4\). The exact-range theorem gives \(f(K)=[0,4]\). In particular, every value between \(0\) and \(4\) is attained, even though \(f\) is not one-to-one on \(K\).

Worked Example: A Positive Function on a Closed Interval

Let \(K=[-2,2]\) and \(g(x)=1/(1+x^2)\). For \(x\in K\), we have \(0\leq x^2\leq4\), so \(1\leq1+x^2\leq5\). Taking reciprocals of these positive quantities gives \(1/5\leq g(x)\leq1\). The value \(1\) is attained at \(x=0\), since \(g(0)=1/(1+0)=1\). The value \(1/5\) is attained at both endpoints: \(g(-2)=1/(1+4)=1/5\) and \(g(2)=1/(1+4)=1/5\). Therefore the exact range is \(g(K)=[1/5,1]\). The interval conclusion guarantees every intermediate value is attained; the inequalities and endpoint checks identify the two extremes explicitly.

What the Combined Result Does—and Does Not—Say

For a continuous function on a compact connected domain, compactness and connectedness answer complementary questions. Compactness ensures that the function has a smallest and largest value. Connectedness ensures that the image has no gaps between those values. Neither conclusion should be substituted for the other: an image may have extreme values without containing all intermediate values, and an interval-valued image need not have its endpoints attained unless additional hypotheses ensure that it is compact.

A useful proof strategy is to make the two roles explicit:

1
Use compactness for extremes.
Apply the Extreme Value Theorem to obtain points where the minimum and maximum are attained.
2
Use connectedness to fill the range.
Show that the image is connected, so it contains every value between its minimum and maximum.
3
State the exact interval.
Combine the two conclusions to identify the image as a closed interval, including its endpoints.

The same reasoning is special to the real line in its conclusion: connected subsets of \(\mathbb{R}\) are intervals. In other spaces, compactness and connectedness still provide important structure, but the phrase “contains every point between its endpoints” may not apply. Here, the order structure of \(\mathbb{R}\) turns the two properties into a precise description of both the domain and the range.

Check Your Understanding

Use the combined compactness and connectedness results to answer the following questions.

  1. Why does a nonempty compact connected subset of \(\mathbb{R}\) contain its minimum and maximum?
  2. Which hypothesis fails for \(K=[-3,-2]\cup[1,2]\), and how does the gap demonstrate that failure?
  3. If \(f\) is continuous on a nonempty compact connected set \(K\), which established results show that \(f(K)\) is compact and connected?
  4. For \(f(x)=x^2\) on \([-2,1]\), where are the minimum and maximum attained, and what is the exact range?
  5. Why does the theorem describing the exact range require both compactness and connectedness of the domain?