Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 36 Β· Projects and Practice

Practice: Compactness and Connectedness

Worked problems on compact and connected subsets of the line and plane, with a runnable interval analyzer and solutions you can check by code.

This practice set pulls together the two big properties of the previous chapters. Work each problem on paper first, then use the code to check your answer. For every problem the reasoning matters more than the verdict: name the theorem you use (Heine–Borel, connected sets of ℝ are intervals, continuous images, and so on).

Warm-up toolkit

Reminders you will need:

  • A subset of ℝⁿ is compact iff it is closed and bounded.
  • A subset of ℝ is connected iff it is an interval.
  • Continuous images of compact (connected) sets are compact (connected).
  • A closed subset of a compact set is compact; a compact subset of a Hausdorff space is closed.

Problem set A: sets of real numbers

Decide whether each set is closed, bounded, compact and connected, and count its connected components.

  1. [0, 1] βˆͺ [2, 3]
  2. [0, 1) βˆͺ (1, 2]
  3. {1/n : n β‰₯ 1} βˆͺ {0}
  4. (0, 1] βˆͺ [2, 5)
  5. [βˆ’3, 3] \ (βˆ’1, 1)

Solutions in words. (1) closed, bounded, compact, 2 components. (2) bounded, not closed (the point 1 is a limit of points in the set but is not in it), not compact, 2 components. (3) closed (contains its limit 0), bounded, compact, infinitely many components (every point is a component). (4) neither closed nor compact (missing 0 and 5), 2 components. (5) [βˆ’3, βˆ’1] βˆͺ [1, 3]: closed, bounded, compact, 2 components.

The code below turns the reasoning into an analyzer for finite unions of intervals. An interval is (lo, hi, lo_closed, hi_closed). The analyzer merges overlapping or touching intervals, then reports closedness, boundedness and components.

Python Analyzer for finite unions of intervals on the real line

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice the case [0, 1) βˆͺ [1, 2]: the pieces touch at 1, one of them contains 1, so they merge into the single interval [0, 2]. An infinite end counts as closed (there is no real number missing there), and unbounded sets are never compact. The set {1/n} βˆͺ {0} is not a finite union of intervals, so the tool does not handle it; reason about it by hand.

Problem set B: functions and compactness

  1. Let f: [0, 1] β†’ ℝ be continuous with f(x) > 0 for all x. Show there is m > 0 with f(x) β‰₯ m.
  2. Is there a continuous surjection from (0, 1) onto [0, 1]? From [0, 1] onto (0, 1)?
  3. Show that [0, 1] and [0, 1) βˆͺ [2, 3] are not homeomorphic by finding one topological property that differs.
  4. A continuous function f: ℝ β†’ ℝ has f(0) = βˆ’1 and f(1) = 4. Must it take the value 0? Must it take the value 10?
  5. Show that every continuous f: [0, 1] β†’ [0, 1] has a fixed point.

Solutions.

  1. [0, 1] is compact, so f attains its minimum m = f(xβ‚€). Because f(xβ‚€) > 0 we get m > 0.
  2. Yes to the first: take x ↦ (1 βˆ’ cos(4Ο€x))/2. On (0, 1) it equals 0 at x = 0.5 and 1 at x = 0.25 and 0.75, and it is continuous, so its image is [0, 1]. No to the second: the continuous image of compact [0, 1] is compact, but (0, 1) is not.
  3. [0, 1] is connected; the other set is not. Or: the first is compact; the second is not (it is missing 1).
  4. It must take 0 (IVT: 0 lies between βˆ’1 and 4). It need not take 10: the function f(x) = βˆ’1 + 5Β·min(max(x, 0), 1) is continuous, has f(0) = βˆ’1 and f(1) = 4, and never exceeds 4.
  5. Apply the IVT to g(x) = f(x) βˆ’ x.

The next program checks problems 7 and 10 numerically.

Python Checking problems 7 and 10 numerically

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Observe that xΒ² has two fixed points (0 and 1) and bisection finds one of them. The theorem guarantees at least one, not exactly one.

Problem set C: the plane

  1. Is the closed unit disk with the origin removed compact? Connected? Path-connected?
  2. Show the graph {(x, 1/x) : x > 0} is closed in ℝ² but not compact.
  3. Every two points of a set S βŠ† ℝ² are joined by a straight segment lying in S (S is convex). Is S connected?
  4. Is the union of the two axes in ℝ² connected? What happens if you remove the origin?
  5. Can a continuous map ℝ² β†’ ℝ be injective? (Hint: look at the image of a circle.)

Solutions. (11) Not compact (not closed), connected and path-connected. (12) The set equals {(x, y) : xy = 1, x β‰₯ 0} (the case x = 0 is impossible), and both {xy = 1} and {x β‰₯ 0} are closed, so the graph is closed. It is unbounded, so not compact. (13) Yes: straight-line paths show S is path-connected, hence connected. (14) The union of the axes is connected (both pieces are connected and share the origin). Removing the origin leaves four open rays: four components. (15) No. If f: ℝ² β†’ ℝ is continuous and injective, restrict it to the unit circle, which is compact and connected, so its image is an interval [m, M] with m < M. Let p and q be points of the circle with f(p) = M and f(q) = m. The two arcs from p to q are connected, so each maps onto all of [m, M]. A value strictly between m and M is then taken on both arcs, at different points, contradicting injectivity.

Check your understanding

Quick check Β· 3 questions

of 3 answered You scored / 3 Β· perfect!

  1. 1. Which set is compact?

    It is closed and bounded. The others are unbounded or fail to be closed.
  2. 2. How many components does ℝ² minus the origin have?

    The punctured plane is path-connected: you can go around the origin.
  3. 3. Why can a continuous f: ℝ β†’ ℝ with f(0) = βˆ’1 and f(1) = 4 take every value in [βˆ’1, 4]?

    f maps [0, 1] continuously, so the image is a connected subset of ℝ, i.e. an interval containing βˆ’1 and 4.

Summary

  • Use Heine–Borel and "connected means interval" as your first checks.
  • Compactness gives attained maxima and positive lower bounds; connectedness gives the IVT.
  • Merging touching intervals is how you compute components of a finite union of intervals.
  • Fixed points of self-maps of [0, 1] exist by the IVT, but need not be unique.

Next: Practice: Products, Quotients and Surfaces