5.7. A GENERALIZATION 123

Theorem 5.7.5 Let M be a closed nonempty subset of a metric space X and letf : M→ [a,b] be continuous at every point of M. Then there exists a function g continuouson all of X which coincides with f on M such that g(X)⊆ [a,b] . If [a,b] is centered on 0,and if X is a normed linear space and f is odd, then we can obtain that g is also odd.

Proof: Let f1 (x) = 1+ 2b−a ( f (x)−b) . Then f1 satisfies the conditions of Lemma

5.7.4 and so there exists g1 : X → [−1,1] such that g is continuous on X and equals f1 onM. Let g(x) = (g1 (x)−1)

( b−a2

)+ b. This works. The last claim follows from the same

arguments which gave Lemma 5.7.4 or the change of variables just given. ■

Corollary 5.7.6 Let M be a closed nonempty subset of a metric space X and let f : M→[a,b] be continuous at every point of M. Also let ∥ f −g∥ ≤ ε. Then there exists continuousf̂ extending f with f̂ (X) ⊆ [a,b] and ĝ extending g such that ĝ(X) ⊆ [a− ε,b+ ε]. Also∥∥ f̂ − ĝ

∥∥≤ ε.

Proof: Let f̂ be the extension of f from the above theorem. Now let F be the extensionof f −g with ∥F∥ ≤ ε . Then let ĝ = f̂ −F. Then for x ∈M, ĝ(x) = f (x)− ( f (x)−g(x)) =g(x). Thus it extends g and clearly ĝ(X)⊆ [a− ε,b+ ε]. ■

With the Tietze extension theorem, here is a better version of the Weierstrass approxi-mation theorem.

Theorem 5.7.7 Let K be a closed and bounded subset of Rp and let f : K→ R becontinuous. Then there exists a sequence of polynomials {pm} such that

limm→∞

(sup{| f (x)− pm (x)| : x ∈ K}) = 0.

In other words, the sequence of polynomials converges uniformly to f on K.

Proof: By the Tietze extension theorem, there exists an extension of f to a continuousfunction g defined on all Rp such that g = f on K. Now since K is bounded, there existintervals, [ak,bk] such that K ⊆∏

pk=1 [ak,bk] = R. Then by the Weierstrass approximation

theorem, Theorem 5.6.1 there exists a sequence of polynomials {pm} converging uniformlyto g on R. Therefore, this sequence of polynomials converges uniformly to g = f on K aswell. This proves the theorem. ■

By considering the real and imaginary parts of a function which has values in C onecan generalize the above theorem.

Corollary 5.7.8 Let K be a closed and bounded subset of Rp and let f : K → F becontinuous. Then there exists a sequence of polynomials {pm} such that

limm→∞

(sup{| f (x)− pm (x)| : x ∈ K}) = 0.

In other words, the sequence of polynomials converges uniformly to f on K.

More generally, the function f could have values in Rp. There is no change in theproof. You just use norm symbols rather than absolute values and nothing at all changesin the theorem where the function is defined on a rectangle. Then you apply the Tietzeextension theorem to each component in the case the function has values in Rp.