Skip to main content

Section 5.2 The Stone–Weierstrass Theorem

We take a somewhat more abstract point of view here, working with functions in \(C_\bdd(X)\) for a metric space \((X,d)\text{.}\)
For \(f, g \in C_\bdd(X)\text{,}\) define the functions \(f \wedge g\) and \(f \vee g\) by
\begin{align*} (f \wedge g)(x) \amp= \min \{f(x), g(x)\},\\ (f \vee g)(x) \amp= \max \{f(x), g(x)\}\text{,} \end{align*}
for \(x \in X\text{.}\) Observe that for \(f, g \in C_\bdd(X)\text{,}\) the map \(X \to \R^2\text{,}\) \(x \mapsto (f(x), g(x))\text{,}\) is continuous. Moreover, the maps \(\R^2 \to \R\text{,}\) \((a,b) \mapsto \min\{a, b\}\) and \((a,b) \mapsto \max\{a, b\}\text{,}\) are continuous. Therefore, the functions \(f \wedge g\) and \(f \vee g\text{,}\) obtained through compositions of these, are also continuous. They are also bounded, which implies that \(f \wedge g \in C_\bdd(X)\) and \(f \vee g \in C_\bdd(X)\text{.}\) We can therefore think of \(\wedge\) and \(\vee\) as maps \(C_\bdd(X) \times C_\bdd(X) \to C_\bdd(X)\) or as operations on \(C_\bdd(X)\text{.}\) We refer to them as the lattice operations. You are asked to prove in Exercise 5.2.2 that \(\wedge\) and \(\vee\) are continuous as maps \(C_\bdd(X) \times C_\bdd(X) \to C_\bdd(X)\text{.}\)

Definition 5.6.

A set \(S \subseteq C_\bdd(X)\) is called a lattice if it is closed under the lattice operations, that is, if \(f \wedge g \in S\) and \(f \vee g \in S\) for all \(f, g \in S\text{.}\)

Proof.

We can reformulate the condition from Definition 5.6 as follows: \(S \subseteq C_\bdd(X)\) is a lattice if and only if it satisfies \(\wedge(S \times S) \subseteq S\) and \(\vee(S \times S) \subseteq S\text{.}\) If so, then Exercise 1.4.2 implies that \(\overline S\) has the same properties, so it is a lattice.

Proof.

If \(f \in \overline S\text{,}\) then for any \(\varepsilon \gt 0\) we have a function \(g \in S\) such that \(\sup_{x \in X} |f(x) - g(x)| \lt \varepsilon\text{,}\) so this function will satisfy (5.1) for all \(x, y \in X\text{.}\)
To show that the condition is sufficient, assume that for all \(x, y \in X\) and \(\varepsilon \gt 0\) there exists a function \(g \in S\subseteq C_\bdd(X)\) satisfying (5.1). Given \(\varepsilon \gt 0\text{,}\) we want to construct \(f_0 \in S\subseteq C_\bdd(X)\) with \(\|f - f_0\|_{\sup}\le \varepsilon\text{.}\)
For any pair of points \(x, y \in X\text{,}\) we choose a function \(g_{x, y} \in S\subseteq C_\bdd(X)\) with
\begin{equation*} |f(x) - g_{x, y}(x)| \lt \varepsilon \quad \text{and} \quad |f(y) - g_{x, y}(y)| \lt \varepsilon. \end{equation*}
Fix \(x \in X\) and define
\begin{equation*} U_x(y) = \set{z \in X}{g_{x, y}(z) \gt f(z) - \varepsilon}. \end{equation*}
This is an open set with \(y \in U_x(y)\text{.}\) Hence \(\set{U_x(y)}{y \in X}\) is an open cover of \(X\text{.}\) Since \(X\) is compact, there exists a finite subcover. That is, there exist finitely many points in \(X\text{,}\) say \(y_1, \dotsc, y_I\text{,}\) such that
\begin{equation*} X = U_x(y_1) \cup \dotsb \cup U_x(y_I). \end{equation*}
Set
\begin{equation*} h_x = g_{x, y_1} \vee \dotsb \vee g_{x, y_I}. \end{equation*}
Since \(S\) is a lattice, we know that \(h_x \in S\text{.}\) Note that for any \(z \in X\text{,}\) there exists \(i \in \{1, \dotsc, I\}\) with \(z \in U_x(y_i)\text{.}\) Hence
\begin{equation*} h_x(z) \ge g_{x, y_i}(z) \gt f(z) - \varepsilon. \end{equation*}
Moreover, since \(|f(x) - g_{x, y_i}(x)| \lt \varepsilon\) for \(i = 1, \dotsc, I\text{,}\) it also satisfies
\begin{equation*} h_x(x) \lt f(x) + \varepsilon. \end{equation*}
To summarise the construction so far: for any \(x \in X\) we have found \(h_x \in S\) such that
\begin{equation} h_x(x) \lt f(x) + \varepsilon\tag{5.2} \end{equation}
and
\begin{equation} \forall z \in X \maps h_x(z) \gt f(z) - \varepsilon.\tag{5.3} \end{equation}
Now define
\begin{equation*} V(x) = \set{z \in X}{h_x(z) \lt f(z) + \varepsilon} \end{equation*}
for \(x \in X\text{.}\) This is an open set with \(x \in V(x)\) by (5.2). Thus \(\set{V(x)}{x \in X}\) is an open cover of \(X\text{.}\) By compactness, there exist \(x_1, \dotsc, x_J \in X\) with
\begin{equation*} X = V(x_1) \cup \dotsb \cup V(x_J). \end{equation*}
Define
\begin{equation*} f_0 = h_{x_1} \wedge \dotsb \wedge h_{x_J}. \end{equation*}
Since \(S\) is a lattice, we know that \(f_0 \in S\text{.}\) For any \(z \in X\text{,}\) there exists \(j \in \{1, \dotsc, J\}\) such that \(z \in V(x_j)\text{.}\) Hence
\begin{equation*} f_0(z) \le h_{x_j}(z) \lt f(z) + \varepsilon. \end{equation*}
By (5.3), on the other hand,
\begin{equation*} f_0(z) \gt f(z) - \varepsilon. \end{equation*}
So we may conclude that
\begin{equation*} |f_0(z) - f(z)| \lt \varepsilon \end{equation*}
for every \(z \in X\text{.}\) Hence \(\|f - f_0\|_{\sup}\le \varepsilon\text{.}\)

Definition 5.10.

We say that a set \(S \subseteq C_\bdd(X)\) separates points in \(X\) if for all \(x, y \in X\) with \(x \ne y\text{,}\) there exists \(f \in S\) such that \(f(x) \ne f(y)\text{.}\)
Consider the operation on \(C_\bdd(X)\) given by pointwise multiplication. That is, we consider the map \(C_\bdd(X) \times C_\bdd(X) \to C_\bdd(X)\text{,}\) \((f, g) \mapsto fg\text{.}\) It is proved in Exercise 5.2.2 that this is a continuous map.

Definition 5.11.

A subset \(S \subseteq C_\bdd(X)\) is called an algebra if
  1. it is a linear subspace of \(C_\bdd(X)\text{,}\) i.e. it is closed under addition and scalar multiplication (by arbitrary scalars \(\alpha \in \R\)); and
  2. it is closed under pointwise multiplication, i.e. for all \(f,g \in S\) we have \(fg \in S\text{.}\)

Example 5.12.

For \(a, b \in \R\) with \(a \lt b\text{,}\) let \(P([a,b])\) be the space of all functions \([a,b] \to \R\) of the form \(t \mapsto p(t)\text{,}\) where \(p\) is a real polynomial. Then \(P([a,b])\) is an algebra.

Proof.

This is proved with the same arguments as Lemma 5.7, using the continuity of the vector space operations and of pointwise multiplication.
We will need the following statements for the proof.

Proof.

By Proposition 5.15, there exists \(N \in \N\) such that the polynomial
\begin{equation*} q(s) = 1 + \sum_{n=1}^N \frac{\frac 12 \left(\frac 12 - 1\right) \cdots \left(\frac 12 - (n - 1)\right)}{n!} s^n \end{equation*}
satisfies the inequality \(|q(s) - \sqrt{1 + s}| \lt \varepsilon/a\) for all \(s \in [-1, 1]\text{.}\) Let \(p\) be the polynomial given by
\begin{equation*} p(t) = a q\Big(\Big(\frac{t}{a}\Big)^2 - 1\Big). \end{equation*}
Fix \(t \in [-a, a]\text{.}\) Set \(s = (t/a)^2 - 1\) and observe that \(s \in [-1, 1]\text{.}\) Hence
\begin{align*} |p(t) - \abs t| \amp= \Big|a q\Big(\Big(\frac{t}{a}\Big)^2 - 1\Big) - a\sqrt{1 + \Big(\frac{t}{a}\Big)^2 - 1}\Big| \\ \amp= a \big|q(s) - \sqrt{1 + s}\big| \\ \amp\lt \varepsilon\text{.} \end{align*}
This completes the proof.

Proof of Theorem 5.14.

If \(X = \varnothing\text{,}\) then \(C_\bdd(X) = \{0\}\text{.}\) If \(X\) has just one element, then the hypothesis implies that \(S = C_\bdd(X)\text{.}\) Hence we may assume that \(X\) has at least two elements.
We wish to use Corollary 5.9, but we apply it to \(\overline S\text{,}\) not \(S\) (because \(S\) is not a lattice in general). To this end, we now proceed as follows.
  1. Show that for all \(x, y \in X\) with \(x \ne y\) and for all \(a, b \in \R\text{,}\) there exists \(f \in S\) with \(f(x) = a\) and \(f(y) = b\text{.}\) Conclude that \(\overline S\) has the same property. (This is one of the hypotheses of Corollary 5.9.)
  2. Show that \(\overline S\) is a lattice.
Once both steps are complete, we can apply Corollary 5.9, which will imply that \(\overline S\) is dense in \(C_\bdd(X)\text{.}\) Since \(\overline S\) is closed, this means that \(\overline S = C_\bdd(X)\text{,}\) which is exactly the desired statement.

Step 1.

Let \(x, y \in X\) with \(x \ne y\) and let and \(a, b \in \R\text{.}\) Since \(S\) separates points in \(X\text{,}\) there exists \(f \in S\) such that \(f(x) \ne f(y)\text{.}\) We seek \(\alpha, \beta \in \R\) such that the function \(g = \alpha 1 + \beta f\) satisfies \(g(x) = a\) and \(g(y) = b\text{.}\) These conditions give rise to the linear system of equations
\begin{align*} \alpha + \beta f(x) \amp = a, \\ \alpha + \beta f(y) \amp = b. \end{align*}
Since \(f(x) \ne f(y)\text{,}\) this system has a unique solution, namely
\begin{equation*} \alpha = \frac{bf(x) - af(y)}{f(x) - f(y)}, \quad \beta = \frac{a - b}{f(x) - f(y)}. \end{equation*}
Since \(S\) is an algebra, we know that \(g \in S\text{.}\) Therefore, the desired statement is satisfied for \(S\text{.}\) It is then obvious for \(\overline S\) as well.

Step 2.

According to Lemma 5.13, the closure \(\overline S\) is also an algebra. We want to show that \(\overline S\) is a lattice. First we claim that every \(f \in \overline S\) satisfies \(\abs f \in \overline S\) (where \(\abs f\) denotes the function \(x \mapsto |f(x)|\)).
If \(f = 0\text{,}\) then this is evidently true. If \(f \ne 0\text{,}\) define \(a = \n f_{\sup}\gt 0\) and let \(\varepsilon \gt 0\) be arbitrary. By Lemma 5.16, there exists a polynomial \(p\) such that \(|p(t) - \abs t| \lt \frac{\varepsilon}{2}\) for all \(t \in [-a, a]\text{.}\) Therefore,
\begin{equation*} |p(f(x)) - |f(x)|| \lt \frac{\varepsilon}{2} \end{equation*}
for all \(x \in X\text{.}\) That is,
\begin{equation*} \|p \circ f - \abs f\|_{\sup}\le \frac{\varepsilon}{2} \lt \varepsilon. \end{equation*}
Since \(\overline S\) is an algebra, we know that \(p \circ f \in \overline S\text{.}\) It follows that \(\abs f \in \overline S\text{.}\)
Now note that
\begin{align} f \wedge g \amp= \frac 12\left((f + g) - |f - g|\right),\tag{5.4}\\ f \vee g \amp= \frac 12\left((f + g) + |f - g|\right)\tag{5.5} \end{align}
for any \(f, g \in C_\bdd(X)\text{.}\) Hence \(f \wedge g \in \overline S\) and \(f \vee g \in \overline S\) whenever \(f, g \in \overline S\text{.}\) That is, the set \(\overline S\) is a lattice.
We finally show that the two classical approximation theorems at the beginning of this chapter are consequences of the Stone–Weierstrass theorem.

Proof of Theorem 5.1.

Let \(P([a,b])\) be the set of polynomial functions defined in Example 5.12. This is an algebra, and clearly the function \(x \mapsto 1\) belongs to \(P([a,b])\text{.}\) It is obvious that \(P([a,b])\) separates points in \([a,b]\text{.}\) Hence Theorem 5.14 applies, showing that \(P([a,b])\) is dense in \(C^0([a,b])\text{.}\)
The same arguments prove, mutatis mutandis, the following result, where here by a polynomial in \(n\) variables we mean a finite sum of terms of the form \(a x_1^{p_1} \cdots x_n^{p_n}\) with coefficients \(a \in \R\) and powers \(p_1,\ldots,p_n \in \N \cup \{0\}\text{.}\)

Proof of Theorem 5.5.

The key idea in this proof is to identify \(2\pi\)-periodic functions with functions on the unit circle in \(\R^2\text{.}\) That is, let
\begin{equation*} D = \set{(x_1, x_2) \in \R^2}{x_1^2 + x_2^2 = 1}. \end{equation*}
Given a continuous \(2\pi\)-periodic function \(f \maps \R \to \R\text{,}\) we can now define a continuous function \(\phi \maps D \to \R\) by the condition \(\phi(\cos t, \sin t) = f(t)\) for \(t \in \R\text{.}\) The \(2\pi\)-periodicity of \(f\) guarantees that \(\phi\) is well-defined.
Let \(\varepsilon \gt 0\text{.}\) Using Theorem 5.17, we find a polynomial \(p\) in \(x_1\) and \(x_2\) such that
\begin{equation*} |\phi(x_1, x_2) - p(x_1, x_2)| \lt \varepsilon \end{equation*}
for all \((x_1, x_2) \in D\text{.}\) Now define \(f_0(t) = p(\cos t, \sin t)\text{.}\) Then \(\|f - f_0\|_{\sup}\lt \varepsilon\text{,}\) and moreover by Exercise 5.2.4 \(f_0\) is a trigonometric polynomial.

Exercises Exercises

1. (PS11) Some non-examples.

(a)
Show that the set of polynomials \(P([0,1]) \subset C^0([0,1])\) is not a lattice.
Hint.
It is enough to look at polynomials with degree \(1\text{.}\)
(b)
Show that the set \(S \subset C^0([0,1])\) of constant functions is not dense in \(C^0([0,1])\text{.}\)
Hint.
Consider, say, the function \(f \in C^0([0,1])\) defined by \(f(x)=x\text{.}\) Show that \(f \notin \overline S\) by either
  1. finding a uniform lower bound on \(\n{f-c}_{C^0([0,1])}\) for \(c \in S\text{;}\) or
  2. assuming that \(\seq sn\) is a sequence in \(S\) converging to \(f\) and deriving a contradiction.
(c)
Consider the set \(S\) of polynomials \(p \in P([0,1])\) with \(p(0)=0\text{.}\) Show that \(S\) is an algebra which separates points, but that it is not dense in \(C^0([0,1])\text{.}\) Why does this not contradict Theorem 5.14?
Hint.
Note that \(S\) being an algebra does not immediately follow from \(P([0,1])\) being an algebra; it requires proof. To show that \(S\) separates points, it is enough to consider the polynomial \(p \in S\) defined by \(p(x)=x\text{.}\)

2. Lattice operations are continuous.

Let \((X,d)\) be a metric space.
(a)
Show that the operation \(C_\bdd(X) \times C_\bdd(X) \to C_\bdd(X)\text{,}\) \((f, g) \mapsto fg\text{,}\) is continuous.
Hint.
Directly verifying the \(\varepsilon\)\(\delta\) definition of continuity is doable but a bit of a pain. By Exercise 1.3.2 and Theorem 1.46, it is enough to instead show that for any two sequences \(\seq fn\) and \(\seq gn\) in \(C_\bdd(X)\) with \(f_n \to f_0\) and \(g_n \to g_0\text{,}\) we have \(f_n g_n \to f_0 g_0\text{.}\)
(b)
Show that the lattice operations \(\wedge, \vee \maps C_\bdd(X) \times C_\bdd(X) \to C_\bdd(X)\) are continuous.
Hint.
One approach is to fix \(x \in X\) and then estimate by breaking things up into a bunch of cases, eventually obtaining a bound which doesn’t depend on \(x\) and taking a supremum. It’s perhaps a bit easier, though, to use the same sort of sequence argument as in the hint to the previous part combined with (5.4) and (5.5).

3. Piecewise linear functions.

Let \(\mathrm{PL}([a,b])\) be the set of all piecewise linear functions in \(C^0([a,b])\text{;}\) that is, \(\mathrm{PL}([a,b])\) consists of all continuous functions \(f \maps [a,b] \to \R\) such that there exist \(t_0, \ldots, t_n \in [a,b]\) with \(a = t_0 \lt t_1 \lt \cdots \lt t_n = b\) and there exist \(m_1, \ldots, m_n, c_1, \ldots, c_n \in \R\) such that \(f(t) = m_j t + c_j\) for all \(t \in [t_{j - 1}, t_j]\) for \(j = 1, \ldots, n\text{.}\) Show that \(\mathrm{PL}([a,b])\) is dense in \(C^0([a,b])\text{.}\)

4. Trigonometric polynomials and complex numbers.

Let \(p\) be a polynomial in two variables, and define \(f \maps \R \to \R\) by \(f(t) = p(\cos t, \sin t)\text{.}\)
(a)
By writing \(\cos t\) and \(\sin t\) in complex form, show that \(p(\cos t, \sin t)\) can be expressed as a polynomial in \(e^{it}\) and \(e^{-it}\) with complex coefficients.
(b)
Taking the real part of each side and using de Moivre’s formula, conclude that \(f\) is a trigonometric polynomial (with real coefficients).

5. (PS11) Separating points.

(a)
Let \((X,d)\) be a metric space and \(S \subset C_\bdd(X)\text{.}\) If \(S\) does not separate points, show that its closure \(\overline S\) also does not separate points.
Hint.
First write down what it means for \(S\) to not separate points. Then use the fact that \(f \in \overline S\) implies that there exists a sequence \(\seq fn\) in \(S\) with \(f_n \to f\text{.}\)
(b)
Conclude that if \(S \subset C^0([a,b])\) does not separate points, then it cannot be dense in \(C^0([a,b])\text{.}\)
Hint.
Use the previous part to show that the identity function \(t \mapsto t\) does not lie in \(\overline S\text{.}\)

6. A convergence criterion for series.

This exercise and its solution have been included to provide a proof of Proposition 5.15 for interested students. It is not particularly useful for exam revision.
Suppose that \((a_n)_{n \in \N}\) and \((b_n)_{n \in \N}\) are two sequences of positive real numbers. Suppose that there exists a number \(N \in \N\) such that
\begin{equation*} \frac{a_{n + 1}}{a_n} \le \frac{b_{n + 1}}{b_n} \end{equation*}
for all \(n \ge N\text{.}\) Show that \(\sum_{n=1}^\infty a_n\) converges if \(\sum_{n=1}^\infty b_n\) converges.
Hint.
\begin{equation*} a_{N + m} = \frac{a_{N + m}}{a_{N + m - 1}} \frac{a_{N + m - 1}}{a_{N + m - 2}} \cdots \frac{a_{N + 1}}{a_N} a_N \end{equation*}
for every \(m \in \N\text{.}\)

7. Another convergence criterion for series.

This exercise and its solution have been included to provide a proof of Proposition 5.15 for interested students. It is not particularly useful for exam revision.
Let \(\alpha \gt 1\text{.}\) Suppose that \((a_n)_{n \in \N}\) is a sequence of positive real numbers with the property that there exists a number \(N \in \N\) with
\begin{equation*} \frac{a_{n + 1}}{a_n} \le 1 - \frac{\alpha}{n + 1} \end{equation*}
for all \(n \ge N\text{.}\) Let \(\beta \in (1, \alpha)\) and define \(b_n = n^{-\beta}\) for \(n \in \N\text{.}\)
(a)
Show that
\begin{equation*} \frac{a_{n + 1}}{a_n} \le \frac{b_{n + 1}}{b_n} \end{equation*}
for all \(n \ge N\text{.}\)
Hint.
Show that the function \(g \maps (0, \infty) \to \R\text{,}\) \(x \mapsto x^\beta\text{,}\) is convex on \((0, \infty)\text{.}\) Conclude that \(g(x) \ge g(1) + (x - 1) g'(1)\) for all \(x \in (0, \infty)\text{.}\)
(b)
Conclude that \(\sum_{n=1}^\infty a_n\) converges.

8. Proof of Proposition 5.15.

This exercise and its solution have been included to provide a proof of Proposition 5.15 for interested students. It is not particularly useful for exam revision.
Consider the power series
\begin{equation*} 1 + \sum_{n=1}^\infty \binom{\frac 12}{n} t^n. \end{equation*}
where
\begin{equation*} \binom{\frac 12}{n} = \frac{\frac 12\left(\frac 12-1\right)\ldots \left(\frac 12-(n-1)\right)}{n!}\text{.} \end{equation*}
(a)
Show that it converges uniformly on \([-1, 1]\text{.}\)
(b)
Denote \(\phi(t) = 1 + \sum_{n=1}^\infty \binom{\frac 12}{n} t^n\text{.}\) Show that the function \(\phi \maps [-1, 1] \to \R\) thus defined is continuous on \([-1, 1]\) and differentiable in \((-1, 1)\text{.}\) Show that
\begin{equation*} 2(1 + t) \phi'(t) = \phi(t) \end{equation*}
for all \(t \in (-1, 1)\) and conclude that \(\phi(t) = \sqrt{1 + t}\) for all \(t \in [-1, 1]\text{.}\)