156 CHAPTER 7. METRIC SPACES AND TOPOLOGICAL SPACES

Definition 7.10.1 Let (X ,d) be a metric space and suppose f : X → Y is a function where(Y,ρ) is also a metric space. For example, Y = R. Then f is continuous at x ∈ X if forevery ε > 0 there exists δ > 0 such that ρ ( f (x) , f (z)) < ε whenever d (x,z) < δ . As isusual in such definitions, f is said to be continuous if it is continuous at every point of X .

The following lemma gives an important example of a continuous real valued functiondefined on a metric space, (X ,d) .

Lemma 7.10.2 Let (X ,d) be a metric space and let S⊆ X be a nonempty subset. Define

dist(x,S)≡ inf{d (x,y) : y ∈ S} .

Then x→ dist(x,S) is a continuous function satisfying the inequality,

|dist(x,S)−dist(y,S)| ≤ d (x,y) . (7.10.10)

Proof: The continuity of x→ dist(x,S) is obvious if the inequality 7.10.10 is estab-lished. So let x,y ∈ X . Without loss of generality, assume dist(x,S) ≥ dist(y,S) and pickz ∈ S such that d (y,z)− ε < dist(y,S) . Then

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

≤ d (z,y)+d (x,y)−d (y,z)+ ε = d (x,y)+ ε.

Since ε is arbitrary, this proves 7.10.10.

Lemma 7.10.3 Let H,K be two nonempty disjoint closed subsets of a metric space, (X ,d) .Then there exists a continuous function, g : X → [−1,1] such that g(H) = −1/3, g(K) =1/3,g(X)⊆ [−1/3,1/3] .

Proof: Let

f (x)≡ dist(x,H)

dist(x,H)+dist(x,K).

The denominator is never equal to zero because if dist(x,H) = 0, then x ∈ H becasue H isclosed. (To see this, pick hk ∈ B(x,1/k)∩H. Then hk → x and since H is closed, x ∈ H.)Similarly, if dist(x,K) = 0, then x ∈ K and so the denominator is never zero as claimed.Hence, by Lemma 7.10.2, f is continuous and from its definition, f = 0 on H and f = 1 onK. Now let g(x)≡ 2

3

(f (x)− 1

2

). Then g has the desired properties.

Definition 7.10.4 For f a real or complex valued bounded continuous function defined ona metric space, M

|| f ||M ≡ sup{| f (x)| : x ∈M} .

Lemma 7.10.5 Suppose M is a closed set in X where (X ,d) is a metric space and supposef : M→ [−1,1] is continuous at every point of M. Then there exists a function, g which isdefined and continuous on all of X such that || f −g||M < 2

3 .