Let K be a compact subset of ℝᵖ and let 𝒜 be a collection of continuous real-valued functions on K such that (a) the constant function e(x) = 1 belongs to 𝒜; (b) f, g ∈ 𝒜 implies αf + βg ∈ 𝒜 for all α, β ∈ ℝ; (c) f, g ∈ 𝒜 implies fg ∈ 𝒜; (d) for any two distinct x, y ∈ K there is f ∈ 𝒜 with f(x) ≠ f(y). Then every continuous real-valued function on K can be uniformly approximated on K by members of 𝒜.
Proof. Given a, b ∈ ℝ and x ≠ y in K, take f ∈ 𝒜 with f(x) ≠ f(y) by (d). Since e(x) = e(y) = 1, the two equations αf(x) + β = a, αf(y) + β = b have a solution, and g = αf + βe lies in 𝒜 by (a) and (b) and satisfies g(x) = a, g(y) = b. Hence ℒ has property 26.1(b).
Now let h ∈ ℒ. Since K is compact, h is bounded, say ‖h‖_K ≤ M. Choose (hₙ) in 𝒜 converging uniformly to h, with ‖hₙ‖_K ≤ M + 1 for every n. Given ε > 0, apply 24.8 to the absolute value function on [−(M + 1), M + 1] to obtain a polynomial p with | |t| − p(t) | < ε/3 for |t| ≤ M + 1.
Then | |hₙ(x)| − p(hₙ(x)) | < ε/3 for every x ∈ K, and p ∘ hₙ ∈ 𝒜 by (a), (b), (c). Since | |h(x)| − |hₙ(x)| | ≤ ‖h − hₙ‖_K, taking n large gives | |h(x)| − p(hₙ(x)) | < ε for x ∈ K. Hence |h| ∈ ℒ.
By the identities of the preceding part, sup {f, g} and inf {f, g} are linear combinations of f, g and |f − g|, so ℒ also has property 26.1(a). Applying 26.1 to ℒ, every continuous function on K can be uniformly approximated by members of ℒ, hence by members of 𝒜.
Let f be continuous with domain a compact set K ⊆ ℝᵖ and values in ℝ^q, and let ε > 0. Then there is a polynomial function p on ℝᵖ to ℝ^q with ‖f(x) − p(x)‖ < ε for all x ∈ K.
Proof. Write f(x) = (f₁(x), ⋯, f_q(x)); each f_j is continuous on K to ℝ. The polynomial functions on ℝᵖ to ℝ satisfy (a)–(d) of 26.2: constants are polynomials, sums and products of polynomials are polynomials, and the coordinate function x ↦ x_i separates any two points differing in the i-th coordinate. So each f_j is uniformly approximated within ε/√q by a polynomial p_j.