Density in a Function Space
Uniform Polynomial Approximation established that every continuous function on a closed interval can be approximated uniformly by polynomials. The next question is about the size of the family needed to make this possible. Are all real-coefficient polynomials necessary, or can a much smaller collection still approximate every continuous function? The answer is yes: polynomials with rational coefficients suffice. In the supremum norm, they form a countable dense subset of the space of continuous functions.
Density is a way to express that a subset comes arbitrarily close to every point of a space, even if it does not contain every point. For function spaces, the meaning of “close” depends on the chosen norm. Here we work with \(C[a,b]\), the continuous real-valued functions on \([a,b]\), equipped with the supremum norm \(\|\cdot\|_{\infty,[a,b]}\).
In \(C[a,b]\), this says that for each \(f\in C[a,b]\) and each positive error tolerance, some member of \(A\) differs from \(f\) by less than that tolerance at every point of the interval. The word “every” is essential: the distance is measured by the supremum norm, not by agreement at a finite number of points or by closeness at each point with an error bound that may vary from point to point.
Proof. Suppose first that \(A\) is dense. Fix \(f\in X\). For every \(\varepsilon>0\), density supplies a \(g\in A\) such that \(\|f-g\|<\varepsilon\). Therefore \(0\leq d(f,A)\leq\|f-g\|<\varepsilon\). Since this holds for every positive \(\varepsilon\), \(d(f,A)=0\).
Conversely, suppose \(d(f,A)=0\) for every \(f\in X\). Fix \(f\in X\) and \(\varepsilon>0\). If there were no \(g\in A\) with \(\|f-g\|<\varepsilon\), then \(\|f-g\|\geq\varepsilon\) for every \(g\in A\), so \(d(f,A)\geq\varepsilon\), contradicting \(d(f,A)=0\). Thus some \(g\in A\) satisfies \(\|f-g\|<\varepsilon\), and \(A\) is dense. \(\square\)
The proposition gives a convenient way to test density: every target must have distance zero from the subset. The infimum need not be attained. Density promises arbitrarily good approximations, not necessarily a best approximation belonging to the subset.
Rational-Coefficient Polynomials Are Dense
Let \(\mathbb{Q}[x]\) denote the polynomials whose coefficients are rational numbers. This set is smaller than the set of all real-coefficient polynomials, but it can still approximate every continuous function uniformly. There are two approximation steps: first approximate the function by a real-coefficient polynomial, and then approximate the finitely many coefficients of that polynomial by rational numbers.
Proof. Let \(f\in C[a,b]\) and \(\varepsilon>0\). By the Weierstrass Approximation Theorem, choose a real-coefficient polynomial
such that \(\|f-p\|_{\infty,[a,b]}<\varepsilon/2\). Put \(M=\max(1,|a|,|b|)\) and \(S=\sum_{k=0}^{m}M^k\). These quantities are finite and \(S\geq1\). For every \(x\in[a,b]\) and every \(k\) between \(0\) and \(m\), \(|x|^k\leq M^k\).
The rational numbers are dense in the real numbers. Thus, for each \(k\), choose \(q_k\in\mathbb{Q}\) such that
Define \(q(x)=\sum_{k=0}^{m}q_kx^k\), which belongs to \(\mathbb{Q}[x]\). For each \(x\in[a,b]\), the triangle inequality gives
Consequently,
For every \(f\) and every \(\varepsilon>0\), we have found \(q\in\mathbb{Q}[x]\) within \(\varepsilon\) of \(f\). This proves the density claim. \(\square\)
The estimate also explains why approximating coefficients is safe on a fixed bounded interval. A small coefficient error is multiplied by a power of \(x\), but each such power has a finite bound there. The finite sum of these bounds determines how accurately the coefficients must be chosen. On an unbounded domain, this argument would not give a uniform estimate.
A Countable Dense Family
A set is called countable if its elements can be listed in a sequence, possibly with repetitions. The set \(\mathbb{Q}[x]\) is countable: for each fixed degree bound \(m\), its polynomials of degree at most \(m\) are specified by \(m+1\) rational coefficients, and the finite tuples of rational numbers form a countable set. Taking the union over the nonnegative integers \(m\) still gives a countable set.
Combining countability with the density theorem yields a new structural conclusion about the whole function space.
Proof. The set \(\mathbb{Q}[x]\) is countable, as shown above, and the Density of Rational-Coefficient Polynomials Theorem shows that it is dense in \(C[a,b]\). It is therefore a countable dense subset of \(C[a,b]\). By definition, \(C[a,b]\) is separable. \(\square\)
Separability means that an uncountable collection of continuous functions can all be approximated, to any prescribed uniform accuracy, using a countable collection of candidates. One can list those candidates as \(q_1,q_2,\ldots\); density then says that for every \(f\in C[a,b]\) and every \(\varepsilon>0\), at least one index \(j\) satisfies \(\|f-q_j\|_{\infty,[a,b]}<\varepsilon\). The listing does not give a single finite list that works for every accuracy. The approximant may depend on both \(f\) and \(\varepsilon\).
Worked Examples
Worked Example: The Constant Functions Are Not Dense in \(C[0,1]\)
Let \(A\) be the subset of constant functions in \(C[0,1]\). Consider \(f(x)=x\). For any constant function \(g(x)=c\), its error at the endpoints is
The triangle inequality gives \(1=|1-0|\leq|c|+|1-c|\), so at least one of \(|c|\) and \(|1-c|\) is at least \(1/2\). Thus every constant function has error at least \(1/2\). This bound is attained by \(c=1/2\), since for \(x\in[0,1]\),
with equality at \(x=0\) and \(x=1\). Therefore \(d(f,A)=1/2\), not zero, and the distance criterion shows that the constants are not dense in \(C[0,1]\).
Worked Example: A Rational Polynomial Approximates the Cosine Uniformly
On \([-1,1]\), take \(f(x)=\cos x\) and the rational-coefficient polynomial
Taylor’s theorem at zero, through degree five, gives a remainder bounded by \(|x|^6/6!\): the sixth derivative of cosine has absolute value at most \(1\), and the degree-five Taylor polynomial is exactly \(q\). Hence, for every \(x\in[-1,1]\),
Taking the supremum gives \(\|\cos-q\|_{\infty,[-1,1]}\leq1/720\). In particular, this one rational polynomial approximates the cosine uniformly to within \(1/700\), because \(1/720<1/700\). The example gives a specific approximant; density asserts the availability of such approximants for every continuous function, not just this smooth one.
Worked Example: Rationalizing the Coefficients of a Polynomial
Let \(p(x)=\sqrt{2}+\pi x\) on \([-1,1]\), and let \(\varepsilon>0\). By density of \(\mathbb{Q}\) in \(\mathbb{R}\), choose \(r,s\in\mathbb{Q}\) such that \(|\sqrt{2}-r|<\varepsilon/2\) and \(|\pi-s|<\varepsilon/2\). Set \(q(x)=r+sx\), a rational-coefficient polynomial. Since \(|x|\leq1\) on this interval,
This holds for every \(x\in[-1,1]\), so \(\|p-q\|_{\infty,[-1,1]}<\varepsilon\). The calculation isolates the coefficient-approximation step used in the density theorem: on this interval, the constant term contributes its coefficient error directly, and the linear term contributes at most its coefficient error.
What Density Does—and Does Not—Say
Density does not mean that the dense subset equals the whole space. For example, \(\mathbb{Q}[x]\) contains only polynomials with rational coefficients, yet it is dense in \(C[a,b]\). More broadly, real-coefficient polynomials are also dense by the Weierstrass Approximation Theorem, but they do not include every continuous function. To see this on \([-1,1]\), suppose a polynomial \(P\) agreed with \(|x|\) throughout the interval. Then \(P(x)-x\) would vanish at every \(x\in(0,1)\), so the polynomial root theorem would force \(P(x)-x\) to be the zero polynomial. That would give \(P(x)=x\) also for \(x<0\), contradicting \(P(x)=|x|=-x\) there. Thus \(|x|\) is not a polynomial, even though it can be uniformly approximated by polynomials.
A different pitfall is to confuse density with pointwise approximation. If \(\|f-g\|_{\infty,[a,b]}<\varepsilon\), then \(|f(x)-g(x)|<\varepsilon\) at every point, with one common error bound. Pointwise closeness at selected locations, or bounds that are not uniform across the interval, do not establish density in the supremum norm.
The choice of norm matters as well. Density is always relative to a particular space and a particular notion of distance. The theorem here says that rational-coefficient polynomials are dense in \(C[a,b]\) under the supremum norm. It makes no claim that they approximate every bounded function uniformly: a uniform limit of continuous functions is continuous, so a discontinuous function cannot be a uniform limit of continuous polynomials.
Check Your Understanding
Use the definitions and arguments in this tutorial to answer the following questions.
- What does it mean for a subset of a normed space to be dense?
- Why does distance zero from every element of \(X\) imply that \(A\subseteq X\) is dense?
- In the proof that rational-coefficient polynomials are dense, why is it important that the interval is bounded?
- How does countability of \(\mathbb{Q}[x]\), together with its density in \(C[a,b]\), imply separability?
- Why do the constant functions fail to be dense in \(C[0,1]\)?
- Does density of polynomials mean every continuous function is itself a polynomial? Explain.