Any continuous function on a closed and bounded interval can be uniformly approximated as closely as desired by a polynomial: for every and there is a polynomial with . Equivalently, the subspace of polynomials on an interval is dense in the space of continuous functions with the supremum Norm.

This is the Weierstrass approximation theorem. The Stone-Weierstrass theorem is its generalisation:

Let be a compact Hausdorff space and a subalgebra that contains the constant functions and separates points (for there is with ). Then is dense in for the supremum norm. For the same holds if is also closed under complex conjugation.

Polynomials on satisfy these hypotheses ( separates points), recovering the statement above. Other instances: trigonometric polynomials are dense in the continuous -periodic functions (take the circle and spanned by ), and polynomials in variables are dense in for any compact . Compactness is essential: polynomials are not uniformly dense in , since a non-constant polynomial is unbounded.

Proof

We prove the Weierstrass case with Bernstein polynomials. The affine change of variable maps polynomials to polynomials, so it suffices to take . For define

For fixed , is the probability that a Binomial variable equals , so . Since and , this already suggests by the law of large numbers. We make it uniform.

Let and . Since is compact, is uniformly continuous: there is with whenever . Then for every ,

The bound does not depend on , so for . Since each is a polynomial of degree at most , this proves the theorem.

The general Stone-Weierstrass theorem is proved by first using the Weierstrass case to approximate by polynomials, which shows that the closure is closed under and , and then patching together functions in that match a target at pairs of points, using compactness of twice. See Rudin, Principles of Mathematical Analysis, Chapter 7.