All Posts
Mathematics

The Stone-Weierstrass Theorem: Approximating Continuous Functions

We state and prove the Stone-Weierstrass theorem — the powerful generalization of Weierstrass's classical approximation theorem that characterizes when subalgebras of continuous functions are dense — and explore its wide-ranging applications.

The Theorem

Stone-Weierstrass Theorem (Real Version)

Let XX be a compact Hausdorff space and let AC(X,R)\mathcal{A} \subseteq C(X, \mathbb{R}) be a subalgebra that:

  1. Separates points: for any xyx \neq y in XX, there exists fAf \in \mathcal{A} with f(x)f(y)f(x) \neq f(y).
  2. Vanishes nowhere: for every xXx \in X, there exists fAf \in \mathcal{A} with f(x)0f(x) \neq 0.

Then A\mathcal{A} is dense in C(X,R)C(X, \mathbb{R}) with respect to the supremum norm.

In short: every continuous function on a compact space can be uniformly approximated by functions in any "sufficiently rich" subalgebra.


The Classical Weierstrass Theorem

The original theorem (Weierstrass, 1885) is a special case:

Weierstrass Approximation Theorem

Every continuous function f:[a,b]Rf: [a, b] \to \mathbb{R} can be uniformly approximated by polynomials. That is, for every ε>0\varepsilon > 0 there exists a polynomial pp with:

supx[a,b]f(x)p(x)<ε\sup_{x \in [a,b]} |f(x) - p(x)| < \varepsilon

This follows from Stone-Weierstrass by taking X=[a,b]X = [a,b] and A=R[x]\mathcal{A} = \mathbb{R}[x] (the polynomials), which separate points (the identity xx does) and vanish nowhere (the constant 11 does).


Why It Matters

The Stone-Weierstrass theorem is one of the most widely used results in analysis. Its power lies in reducing questions about all continuous functions to questions about a specific class:

  • To prove a property holds for all continuous functions, prove it for the subalgebra and show it is preserved under uniform limits.
  • To construct approximation schemes, verify the Stone-Weierstrass hypotheses.

Key Lemma: Lattice Closure

The proof hinges on showing that the closure Aˉ\bar{\mathcal{A}} is a lattice: it is closed under max\max and min\min.

Lemma 1. If fAˉf \in \bar{\mathcal{A}}, then fAˉ|f| \in \bar{\mathcal{A}}.

Proof. By the classical Weierstrass theorem, the function t|t| on [f,f][-\|f\|, \|f\|] can be uniformly approximated by polynomials pn(t)p_n(t) with pn(0)=0p_n(0) = 0. Then pnfAˉp_n \circ f \in \bar{\mathcal{A}} (since Aˉ\bar{\mathcal{A}} is an algebra) and pnffp_n \circ f \to |f| uniformly. \square

Corollary. Since max(f,g)=f+g+fg2\max(f, g) = \frac{f+g+|f-g|}{2} and min(f,g)=f+gfg2\min(f, g) = \frac{f+g-|f-g|}{2}, the closure Aˉ\bar{\mathcal{A}} is closed under max\max and min\min.


Proof of the Stone-Weierstrass Theorem

Proof.

Let fC(X,R)f \in C(X, \mathbb{R}) and ε>0\varepsilon > 0. We must find gAˉg \in \bar{\mathcal{A}} with fg<ε\|f - g\|_\infty < \varepsilon.

Step 1 — Interpolation at two points. For any x,yXx, y \in X, there exists hxyAˉh_{xy} \in \bar{\mathcal{A}} with hxy(x)=f(x)h_{xy}(x) = f(x) and hxy(y)=f(y)h_{xy}(y) = f(y).

Proof: Since A\mathcal{A} separates points and vanishes nowhere, for any two points xyx \neq y and any values α,β\alpha, \beta, we can find hAh \in \mathcal{A} with h(x)=αh(x) = \alpha and h(y)=βh(y) = \beta. (Use the separation and non-vanishing properties to build appropriate linear combinations.)

Step 2 — Approximation from below at each point. Fix xXx \in X. For each yXy \in X, let hxyh_{xy} be as above. Since hxy(y)=f(y)h_{xy}(y) = f(y), continuity gives an open set UyyU_y \ni y with hxy(t)>f(t)εh_{xy}(t) > f(t) - \varepsilon for tUyt \in U_y.

By compactness, finitely many Uy1,,UykU_{y_1}, \ldots, U_{y_k} cover XX. Define:

gx=max(hxy1,,hxyk)Aˉg_x = \max(h_{xy_1}, \ldots, h_{xy_k}) \in \bar{\mathcal{A}}

Then gx(t)>f(t)εg_x(t) > f(t) - \varepsilon for all tXt \in X and gx(x)=f(x)g_x(x) = f(x).

Step 3 — Approximation from above. Since gx(x)=f(x)g_x(x) = f(x), continuity gives an open set VxxV_x \ni x with gx(t)<f(t)+εg_x(t) < f(t) + \varepsilon for tVxt \in V_x.

By compactness, finitely many Vx1,,VxmV_{x_1}, \ldots, V_{x_m} cover XX. Define:

g=min(gx1,,gxm)Aˉg = \min(g_{x_1}, \ldots, g_{x_m}) \in \bar{\mathcal{A}}

Then for all tXt \in X:

  • g(t)>f(t)εg(t) > f(t) - \varepsilon (since each gxi(t)>f(t)εg_{x_i}(t) > f(t) - \varepsilon).
  • g(t)<f(t)+εg(t) < f(t) + \varepsilon (since for some ii, tVxit \in V_{x_i} and gxi(t)<f(t)+εg_{x_i}(t) < f(t) + \varepsilon).

Therefore fg<ε\|f - g\|_\infty < \varepsilon and gAˉg \in \bar{\mathcal{A}}. \square


The Complex Version

Stone-Weierstrass (Complex Version). Let XX be compact Hausdorff. A self-adjoint subalgebra AC(X,C)\mathcal{A} \subseteq C(X, \mathbb{C}) that separates points and vanishes nowhere is dense in C(X,C)C(X, \mathbb{C}).

Here "self-adjoint" means: fA    fˉAf \in \mathcal{A} \implies \bar{f} \in \mathcal{A}.

Without the self-adjoint condition, the theorem fails: on the unit circle S1S^1, the algebra generated by z=eiθz = e^{i\theta} (without zˉ\bar{z}) consists of boundary values of holomorphic functions and is not dense in C(S1,C)C(S^1, \mathbb{C}).


Applications

Trigonometric Approximation

The trigonometric polynomials k=NNckeikθ\sum_{k=-N}^{N} c_k e^{ik\theta} form a self-adjoint subalgebra of C(S1,C)C(S^1, \mathbb{C}) that separates points and vanishes nowhere. By Stone-Weierstrass, they are dense — justifying Fourier analysis.

Polynomial Approximation on Products

On [0,1]n[0,1]^n, the polynomials in nn variables separate points and form an algebra. Stone-Weierstrass gives uniform approximation by multivariate polynomials.

Müntz-Szász Theorem

Which subsets S{0,1,2,}S \subseteq \{0, 1, 2, \ldots\} have the property that span{xn:nS}\operatorname{span}\{x^n : n \in S\} is dense in C[0,1]C[0,1]? The Müntz-Szász theorem answers: if and only if 0S0 \in S and nS,n>01/n=\sum_{n \in S, n > 0} 1/n = \infty. Stone-Weierstrass provides the framework.

Korovkin's Theorem

If a sequence of positive linear operators satisfies Tn(1)1T_n(1) \to 1, Tn(x)xT_n(x) \to x, Tn(x2)x2T_n(x^2) \to x^2 uniformly on [a,b][a,b], then Tn(f)fT_n(f) \to f uniformly for all fC[a,b]f \in C[a,b]. This powerful result, used to prove the Bernstein polynomial approximation, connects to Stone-Weierstrass.


Bernstein's Constructive Proof

While Stone-Weierstrass is an existence result, Bernstein (1912) gave a constructive proof of Weierstrass's theorem using the Bernstein polynomials:

Bn(f)(x)=k=0nf ⁣(kn)(nk)xk(1x)nkB_n(f)(x) = \sum_{k=0}^{n} f\!\left(\frac{k}{n}\right) \binom{n}{k} x^k (1-x)^{n-k}

One can verify Bn(f)fB_n(f) \to f uniformly on [0,1][0,1] using the law of large numbers (or direct estimation). This is an explicit approximation, unlike the abstract Stone-Weierstrass argument.


Failure Without Hypotheses

Without point separation: The constant functions A=R\mathcal{A} = \mathbb{R} on [0,1][0,1] form an algebra but do not separate points. The closure is just R\mathbb{R}, not all of C[0,1]C[0,1].

Without non-vanishing: The algebra {fC[0,1]:f(0)=0}\{f \in C[0,1] : f(0) = 0\} separates points but vanishes at 00. Its closure is itself — it misses all functions with f(0)0f(0) \neq 0.

Without compactness: On R\mathbb{R}, polynomials separate points and vanish nowhere, but they are not dense in the bounded continuous functions (a polynomial that is close to a bounded function on all of R\mathbb{R} must itself be bounded, hence constant).


Summary

AC(X,R),    X compact HausdorffA subalgebra, separates points, vanishes nowhereA=C(X,R)(uniform closure)Special case: R[x]=C[a,b](Weierstrass)\begin{aligned} &\mathcal{A} \subseteq C(X, \mathbb{R}), \;\; X \text{ compact Hausdorff} \\[6pt] &\mathcal{A} \text{ subalgebra, separates points, vanishes nowhere} \\[6pt] &\Downarrow \\[6pt] &\overline{\mathcal{A}} = C(X, \mathbb{R}) \quad \text{(uniform closure)} \\[8pt] &\text{Special case: } \overline{\mathbb{R}[x]} = C[a,b] \quad \text{(Weierstrass)} \end{aligned}

References