3.7. CONTINUITY AND COMPACTNESS 81

Example 3.6.3 x→ d (x,y) is a continuous function from the metric space to the metricspace of nonnegative real numbers.

This follows from Lemma 3.2.6. You can also define a metric on a Cartesian productof metric spaces.

Proposition 3.6.4 Let (X ,d) be a metric space and consider (X×X ,ρ) where

ρ ((x, x̃) ,(y, ỹ))≡ d (x,y)+d (x̃, ỹ) .

Then this is also a metric space.

Proof: The only condition not obvious is the triangle inequality. However,

ρ ((x, x̃) ,(y, ỹ))+ρ ((y, ỹ) ,(z, z̃))≡ d (x,y)+d (x̃, ỹ)+d (y,z)+d (ỹ, z̃)

≥ d (x,z)+d (x̃, z̃) = ρ ((x, x̃) ,(z, z̃)) ■

Definition 3.6.5 If you have two metric spaces (X ,d) and (Y,ρ) , a function f :X → Y is called a homeomorphism if and only if it is continuous, one to one, onto, and itsinverse is also continuous.

Here is a useful proposition.

Proposition 3.6.6 Let (X ,d) be a metric space and let S be a nonempty subset of X.Define

dist(x,S)≡ inf{d (x,s) : s ∈ S}Then |dist(x,S)−dist(y,S)| ≤ d (x,y) so x→ dist(x,S) is continuous.

Proof: Say dist(x,S)≥ dist(y,S) . Then there is s ∈ S such that dist(y,S)+ ε > d (y,s).Then

|dist(x,S)−dist(y,S)|= dist(x,S)−dist(y,S)≤ d (x,s)− (d (y,s)− ε)

≤ d (x,y)+d (y,s)− (d (y,s)− ε) = d (x,y)+ ε

Since ε > 0 is arbitrary, this shows the claimed result. If dist(x,S) ≤ dist(y,S) , repeatswitching roles of x and y. ■

3.7 Continuity and CompactnessHow does compactness relate to continuity? It turns out that the continuous image of acompact set is always compact. This is an easy consequence of the above major theorem.

Theorem 3.7.1 Let f : X → Y where (X ,d) and (Y,ρ) are metric spaces and f iscontinuous on X. Then if K ⊆ X is compact, it follows that f (K) is compact in (Y,ρ).

Proof: Let C be an open cover of f (K) . Denote by f−1 (C ) the sets of the form{f−1 (U) : U ∈ C

}. Then f−1 (C ) is an open cover of K. It follows there are finitely many

sets of the form{

f−1 (U1) , · · · , f−1 (Un)}

which covers K. It follows that {U1, · · · ,Un} isan open cover for f (K). ■

The following is the important extreme values theorem for a real valued function de-fined on a compact set.