Tutorials › Real Analysis › Stone-Weierstrass Theorem

Approximation Theory · Tutorial 640 of 1000

Stone-Weierstrass Theorem

See how constants, point separation, compactness, and lattice operations combine to make an algebra uniformly dense in the continuous functions.

Advanced 10 min read

What You'll Learn

  • State the real Stone-Weierstrass Theorem for a compact subset of the real line
  • Combine one-sided patches to obtain a uniform approximation
  • Deduce density of polynomial restrictions on any compact subset of the real line
  • Apply the theorem to an algebra generated by the square function on a nonnegative interval
  • Identify how failure to separate points can obstruct approximation

From Local Patches to a Uniform Approximation

The previous tutorial developed the ingredients behind the Stone-Weierstrass argument. A unital algebra that separates points can interpolate a continuous target at two chosen points, and its uniform closure is closed under maxima and minima. Compactness then gives a one-sided patch at a fixed point. The remaining task is to combine patches based at different points so that the resulting function is close to the target everywhere.

Throughout, let \(K\) be a nonempty compact subset of \(\mathbb{R}\), and let \(A\) be a unital subalgebra of \(C(K)\) that separates points. Write \(\overline{A}\) for its closure in the supremum norm. We use the One-Sided Patching at a Fixed Point Theorem from the previous tutorial: for \(f\in C(K)\), \(x\in K\), and \(\delta>0\), there is an \(h_x\in\overline{A}\) such that \(h_x(x)=f(x)\) and \(h_x(z)<f(z)+\delta\) for every \(z\in K\).

Theorem (Real Stone-Weierstrass Theorem): Let \(K\) be a nonempty compact subset of \(\mathbb{R}\). If \(A\) is a unital subalgebra of \(C(K)\) that separates points, then \(A\) is dense in \(C(K)\) in the supremum norm. Equivalently, for every \(f\in C(K)\) and every \(\varepsilon>0\), there is an \(a\in A\) such that \(\|f-a\|_\infty<\varepsilon\).

Proof. Fix \(f\in C(K)\) and \(\varepsilon>0\), and put \(\delta=\varepsilon/3\). For each \(x\in K\), apply the one-sided patching theorem to obtain \(h_x\in\overline{A}\) with \(h_x(x)=f(x)\) and \(h_x(z)<f(z)+\delta\) for every \(z\in K\).

The function \(h_x-f\) is continuous and has value zero at \(x\). Therefore the set

$$ U_x=\{z\in K:h_x(z)>f(z)-\delta\} $$

is open relative to \(K\) and contains \(x\). The sets \(U_x\), as \(x\) varies over \(K\), form an open cover. Compactness supplies a finite subcover \(U_{x_1},\ldots,U_{x_m}\). Define

$$ g=h_{x_1}\vee h_{x_2}\vee\cdots\vee h_{x_m}. $$

Each \(h_{x_i}\) belongs to \(\overline{A}\), and the uniform closure is closed under finite maxima by the Absolute Values in the Uniform Closure Theorem from the previous tutorial. Hence \(g\in\overline{A}\). For any \(z\in K\), the upper bound for each patch gives

$$ g(z)=\max_{1\leq i\leq m}h_{x_i}(z)<f(z)+\delta. $$

Because the sets \(U_{x_i}\) cover \(K\), there is at least one index \(i\) for which \(z\in U_{x_i}\). For that index, \(h_{x_i}(z)>f(z)-\delta\), so

$$ g(z)\geq h_{x_i}(z)>f(z)-\delta. $$

Together these inequalities show \(|g(z)-f(z)|<\delta\) at every \(z\in K\), and therefore \(\|g-f\|_\infty\leq\delta\). Since \(g\in\overline{A}\), choose \(a\in A\) with \(\|a-g\|_\infty<\delta\). The triangle inequality now yields

$$ \|a-f\|_\infty \leq \|a-g\|_\infty+\|g-f\|_\infty <\delta+\delta =\frac{2\varepsilon}{3} <\varepsilon. $$

Thus every continuous \(f\) can be approximated uniformly to any prescribed positive accuracy by an element of \(A\). This is exactly density of \(A\) in \(C(K)\). \(\square\)

Polynomial Restrictions on Compact Sets

The theorem immediately gives a useful conclusion beyond approximation on an interval. If \(K\) is any nonempty compact subset of the real line, a polynomial can be restricted to \(K\), even when \(K\) has gaps or consists of isolated points. These restrictions still have enough algebraic flexibility to approximate every continuous function on \(K\).

Corollary (Polynomial Approximation on Compact Subsets of \(\mathbb{R}\)): Let \(K\subseteq\mathbb{R}\) be nonempty and compact. The restrictions to \(K\) of real polynomials are dense in \(C(K)\).

Proof. Let \(A\) be the set of restrictions to \(K\) of real polynomials. Sums, scalar multiples, and products of polynomial restrictions are again polynomial restrictions, so \(A\) is a subalgebra of \(C(K)\). Constant polynomials show that \(A\) is unital. If \(x,y\in K\) and \(x\neq y\), the polynomial \(p(t)=t\) satisfies \(p(x)=x\neq y=p(y)\); thus \(A\) separates points. The Real Stone-Weierstrass Theorem applies and gives the claimed density. \(\square\)

Worked Example: Approximating on a Set with a Gap

Let \(K=[-2,-1]\cup[1,3]\), and define \(f:K\to\mathbb{R}\) by \(f(x)=|x|\). The two intervals are separated, but their union is compact, and \(f\) is continuous on \(K\). Polynomial restrictions form a unital algebra that separates any distinct points of \(K\). The corollary therefore guarantees that for every \(\varepsilon>0\), a polynomial \(p\) exists with

$$ \sup_{x\in[-2,-1]\cup[1,3]}\bigl|p(x)-|x|\bigr|<\varepsilon. $$

This conclusion concerns both components at once: one polynomial works uniformly on the entire union. The theorem guarantees existence, but does not identify its coefficients or provide an estimate for the degree needed to achieve a given error.

Other Algebras Can Be Dense Too

Polynomials are a familiar example, but the theorem is about algebraic structure rather than a particular formula. A smaller-looking collection of functions can still be dense if it contains constants and can distinguish every pair of points. The next example uses polynomials in the square of the coordinate function.

Worked Example: An Algebra Generated by the Square Function

On \(K=[0,1]\), consider the algebra \(A=\{x\mapsto q(x^2):q\text{ is a real polynomial}\}\). It contains the constant functions and is closed under addition, scalar multiplication, and multiplication. If \(x,y\in[0,1]\) and \(x\neq y\), then

$$ x^2-y^2=(x-y)(x+y)\neq0, $$

because \(x+y>0\) when \(x\neq y\) in this interval. Thus \(A\) separates points, so Stone-Weierstrass says it is dense in \(C[0,1]\). In particular, the continuous function \(f(x)=\sqrt{x}\) can be uniformly approximated by functions \(q(x^2)\). For every \(\varepsilon>0\), some polynomial \(q\) satisfies

$$ \sup_{0\leq x\leq1}\bigl|q(x^2)-\sqrt{x}\bigr|<\varepsilon. $$

The crucial fact is that squaring is one-to-one on \([0,1]\). The same expression \(q(x^2)\) would not distinguish \(x\) from \(-x\) on a symmetric interval.

Why Point Separation Matters

The hypotheses are sufficient conditions, not decoration. In particular, if two different points always receive the same value from every member of an algebra, then no uniform limit of its members can distinguish those points either. A continuous target that does distinguish them cannot be uniformly approximated arbitrarily well. The next example quantifies this obstruction.

Worked Example: A Nonseparating Algebra Cannot Approximate the Coordinate Function

On \(K=[-1,1]\), let \(A=\{x\mapsto q(x^2):q\text{ is a real polynomial}\}\). This is a unital subalgebra, but each \(g\in A\) satisfies \(g(-1)=g(1)\), so it does not separate the points \(-1\) and \(1\). Consider the target \(f(x)=x\). If \(c=g(-1)=g(1)\), then

$$ |c+1|+|c-1|\geq |(c+1)-(c-1)|=2. $$

At least one of the two terms must consequently be at least \(1\), and therefore

$$ \|g-f\|_{\infty,[-1,1]} \geq\max\{|g(-1)-f(-1)|,\ |g(1)-f(1)|\} =\max\{|c+1|,\ |c-1|\} \geq1. $$

No element of this algebra can approximate the coordinate function with uniform error less than \(1\). The failure is not a shortage of polynomial degrees; every function in the algebra identifies the two endpoints, while the target assigns them different values.

What the Theorem Does—and Does Not—Promise

The proof separates the roles of the assumptions. Point separation enables two-point interpolation. The algebra operations and the Weierstrass Approximation Theorem supply maxima and minima in the uniform closure. Continuity turns equality at a point into a useful local inequality, and compactness reduces the resulting neighborhoods to a finite collection. The finite maximum combines the lower bounds from those neighborhoods without losing the upper bound that each patch already satisfies everywhere.

The conclusion is qualitative: for each target and each positive error, at least one algebra element achieves that error. It does not give an explicit approximant, a degree bound, or a rate of convergence. Those questions require additional information about the target and the algebra. Also, the result here concerns real-valued continuous functions and real subalgebras; hypotheses for approximation by complex-valued algebras require separate care.

Takeaway: A unital, point-separating real subalgebra of \(C(K)\) is uniformly dense when \(K\) is nonempty and compact. Local interpolation, lattice operations in the closure, and a finite-cover argument turn the algebraic hypotheses into global approximation.

Check Your Understanding

Use the theorem and its proof to answer the following questions.

  1. Where does point separation enter the hypotheses of the one-sided patching result used in the proof?
  2. Why does the proof take a finite subcover before forming the maximum of the patches?
  3. How does the finite maximum preserve both the lower and upper estimates for the target?
  4. Why do polynomial restrictions separate points of every subset of the real line?
  5. Why can no function in the even algebra on \([-1,1]\) approximate \(f(x)=x\) with error less than \(1\)?