7.7. SOME APPLICATIONS OF COMPACTNESS 147

for i ∈ {0,1, · · · ,2p+1 − 1}. Thus S is a collection of(2p+1

)n non overlapping cubeswhose union equals [−r,r)n and whose diameters are all equal to 2−pr

√n. Now choose

p large enough that the diameter of these cubes is less than ε . This yields a contradictionbecause one of the cubes must contain infinitely many points of {ai}. This proves thelemma.

The next theorem is called the Heine Borel theorem and it characterizes the compactsets in Rn.

Theorem 7.6.7 A subset of Rn is compact if and only if it is closed and bounded.

Proof: Since a set in Rn is totally bounded if and only if it is bounded, this theoremfollows from Proposition 7.6.5 and the observation that a subset of Rn is closed if and onlyif it is complete. This proves the theorem.

Proposition 7.6.8 If K is a closed, nonempty subset of a nonempty compact set H, then Kis compact.

Proof: Let C be an open cover for K. Then C ∪{

KC}

is an open cover for H. Thusthere are finitely many sets from this last collection of open sets, U1, · · · ,Um which coversH. Include only those which are in C . These cover K because KC covers no points of K.

7.7 Some Applications Of CompactnessThe following corollary is an important existence theorem which depends on compactness.

Theorem 7.7.1 Let X be a compact metric space and let f : X → R be continuous. Thenmax{ f (x) : x ∈ X} and min{ f (x) : x ∈ X} both exist.

Proof: First it is shown f (X) is compact. Suppose C is a set of open sets whose unioncontains f (X). Then since f is continuous f−1 (U) is open for all U ∈ C . Therefore,{

f−1 (U) : U ∈ C}

is a collection of open sets whose union contains X . Since X is com-pact, it follows finitely many of these,

{f−1 (U1) , · · · , f−1 (Up)

}contains X in their union.

Therefore, f (X)⊆ ∪pk=1Uk showing f (X) is compact as claimed.

Now since f (X) is compact, Theorem 7.6.7 implies f (X) is closed and bounded.Therefore, it contains its inf and its sup. Thus f achieves both a maximum and a mini-mum.

Definition 7.7.2 Let X ,Y be metric spaces and f : X → Y a function. f is uniformly con-tinuous if for all ε > 0 there exists δ > 0 such that whenever x1 and x2 are two points of Xsatisfying d (x1,x2)< δ , it follows that d ( f (x1) , f (x2))< ε .

A very important theorem is the following.

Theorem 7.7.3 Suppose f : X → Y is continuous and X is compact. Then f is uniformlycontinuous.