From Fixed-Degree Approximation to Arbitrarily Small Error
In Polynomial Approximation, we studied the best approximation error \(E_n(f;[a,b])\) for each fixed degree \(n\). The errors do not increase when the degree bound grows, but that fact alone does not show that they approach zero. The Weierstrass Approximation Theorem supplies the missing conclusion: every continuous function on a closed interval can be approximated uniformly as closely as desired by a polynomial.
We will prove the result constructively on \([0,1]\), using the Bernstein polynomials of a continuous function. Their coefficients are values of the function at equally spaced points, combined with nonnegative weights that sum to one. The weights concentrate near the point where the polynomial is evaluated, and uniform continuity then controls the approximation error.
The theorem concerns uniform approximation: the same polynomial must approximate \(f\) well at every point of the interval. It does not assert that a polynomial equals \(f\), or that one fixed degree works for every accuracy. The polynomial may depend on both the function and the requested error.
Bernstein Polynomials and Their Weights
Begin with a continuous function \(f\in C[0,1]\). For an integer \(n\geq1\), define its \(n\)th Bernstein polynomial by
For each fixed \(n\), this is a polynomial in \(x\) of degree at most \(n\). Write \(w_{n,k}(x)=\binom{n}{k}x^k(1-x)^{n-k}\) for its weights. The binomial theorem gives \(\sum_{k=0}^{n}w_{n,k}(x)=1\), and every weight is nonnegative when \(x\in[0,1]\). Thus \(B_nf(x)\) is a weighted average of the sampled values \(f(k/n)\).
The key point is that the weights are concentrated around indices \(k\) for which \(k/n\) is close to \(x\). The following moment calculation makes that statement quantitative.
Proof. The binomial identities \(k\binom{n}{k}=n\binom{n-1}{k-1}\) and \(k(k-1)\binom{n}{k}=n(n-1)\binom{n-2}{k-2}\) give, by the binomial theorem,
These identities also hold at \(x=0\) and \(x=1\), either by direct evaluation of the weights or because both sides are polynomial expressions in \(x\). Since \(k^2=k(k-1)+k\), it follows that \(\sum k^2w_{n,k}(x)=n(n-1)x^2+nx\). Dividing the first-moment identity by \(n\) proves the first formula in the lemma. For the second,
This completes the proof. \(\square\)
A Uniform Error Estimate
Continuity on the compact interval \([0,1]\) implies uniform continuity by the Heine–Cantor Theorem. Define the modulus of continuity of \(f\) by \(\omega_f(\delta)=\sup\{|f(u)-f(v)|:u,v\in[0,1],\ |u-v|\leq\delta\}\). Uniform continuity implies that \(\omega_f(\delta)\) tends to zero as \(\delta\) decreases to zero.
Proof. Since the weights are nonnegative and sum to one,
Separate the indices into those for which \(|k/n-x|\leq\delta\) and those for which \(|k/n-x|>\delta\). For the first group, each function difference is at most \(\omega_f(\delta)\), and the sum of the corresponding weights is at most one. For the second group, each difference is at most \(2M\). Also, whenever \(|k/n-x|>\delta\), \(1<(k/n-x)^2/\delta^2\). Therefore the sum of the weights in the second group is at most
Combining the two groups and applying the moment lemma gives the first inequality. Finally, \(x(1-x)\leq1/4\) on \([0,1]\), since \(x(1-x)=1/4-(x-1/2)^2\). This proves the second inequality. \(\square\)
The estimate separates two sources of error. The modulus term controls how much \(f\) varies over distances at most \(\delta\). The remaining term controls the total weight assigned to samples farther than \(\delta\) from \(x\). We can first make the variation small by choosing \(\delta\), then make the distant weight small by choosing \(n\) large.
Proof of the Weierstrass Approximation Theorem
Proof on \([0,1]\). Let \(f\in C[0,1]\) and let \(\varepsilon>0\). By uniform continuity, choose \(\delta>0\) such that \(\omega_f(\delta)<\varepsilon/2\). If \(M=\|f\|_\infty=0\), then \(f\) is identically zero and the zero polynomial gives exact approximation. Otherwise, choose an integer \(n\geq1\) large enough that \(M/(2n\delta^2)<\varepsilon/2\). The error estimate now yields, for every \(x\in[0,1]\),
Taking the supremum over \(x\) gives \(\|B_nf-f\|_\infty<\varepsilon\). Since \(B_nf\) is a polynomial, this proves the theorem on \([0,1]\).
For a general interval \([a,b]\), define \(F(t)=f((a+b)/2+(b-a)t/2)\) on \([-1,1]\). By the affine change of variable from Polynomial Approximation, this is equivalent to working on \([0,1]\): use \(G(s)=F(2s-1)\) for \(s\in[0,1]\). Given \(\varepsilon>0\), the result just proved supplies a polynomial \(q\) such that \(\|G-q\|_{\infty,[0,1]}<\varepsilon\). Then \(r(t)=q((t+1)/2)\) is a polynomial and \(\|F-r\|_{\infty,[-1,1]}<\varepsilon\). Transforming back to \([a,b]\) gives a polynomial approximation to \(f\) with the same error, by affine invariance. This proves the theorem on every closed interval with distinct endpoints. \(\square\)
To obtain the equivalent statement about \(E_n\), the theorem says that for every \(\varepsilon>0\), some polynomial \(p\) of degree \(m\) has error less than \(\varepsilon\). For every \(n\geq m\), the definition of \(E_n\) gives \(0\leq E_n(f;[a,b])\leq\|f-p\|_\infty<\varepsilon\). Hence \(E_n(f;[a,b])\) tends to zero. Conversely, if these errors tend to zero, the existence of a best approximant for each fixed degree, established in Polynomial Approximation, gives a polynomial with error less than any prescribed positive \(\varepsilon\).
Worked Examples
Worked Example: Bernstein Approximation of \(x^2\)
For \(f(x)=x^2\), the Bernstein polynomial can be computed using the first two moments. Since \(k^2=k(k-1)+k\),
Thus \(B_nf(x)-f(x)=x(1-x)/n\), a nonnegative quantity. Because \(x(1-x)\leq1/4\), the uniform error is at most \(1/(4n)\), and equality occurs at \(x=1/2\). Therefore \(\|B_nf-f\|_\infty=1/(4n)\). In particular, these explicit polynomials converge uniformly to \(x^2\).
Worked Example: Bernstein Approximation of \(x^3\)
For \(f(x)=x^3\), use \(k^3=k(k-1)(k-2)+3k(k-1)+k\). The binomial identities give \(\sum k(k-1)(k-2)w_{n,k}(x)=n(n-1)(n-2)x^3\), with the identity valid also for \(n=1,2\) because the corresponding falling factorial vanishes. Consequently,
For verification, expanding the right-hand side gives \(x^3+3x^2/n-3x^3/n+x/n^2-3x^2/n^2+2x^3/n^2\), which is exactly the numerator on the first line divided by \(n^3\). On \([0,1]\), \(x^2(1-x)\leq1\), \(x(1-x)\leq1/4\), and \(|1-2x|\leq1\). Therefore
This bound tends to zero, illustrating the theorem with a second explicit polynomial sequence.
Worked Example: Bernstein Approximation of \(|x-1/2|\)
The function \(f(x)=|x-1/2|\) is continuous and satisfies \(\big||u-1/2|-|v-1/2|\big|\leq|u-v|\). Thus
Apply the finite Cauchy–Schwarz inequality to the weighted sum, using \(\sum w_{n,k}(x)=1\). The moment lemma then gives
The bound holds for every \(x\in[0,1]\), so \(\|B_nf-f\|_\infty\leq1/(2\sqrt n)\). The function is not a polynomial, but its Bernstein polynomials still approximate it uniformly.
What the Theorem Does—and Does Not—Say
The Weierstrass Approximation Theorem guarantees that polynomials are dense in \(C[a,b]\) under the supremum norm: every continuous function lies within any prescribed positive distance of some polynomial. The Bernstein construction also explains why continuity is central. Uniform continuity prevents the function from changing much between nearby sample points, while the moment estimate ensures that the weights on distant sample points become small as \(n\) grows.
The theorem does not give a single degree that works for all continuous functions, nor does continuity alone produce a universal rate of convergence. The explicit rates in the examples come from additional information about the functions. Also, the theorem is about continuous functions on a closed bounded interval; it does not assert uniform polynomial approximation for every function on an arbitrary set. For an individual degree, the best-approximant theorem ensures an optimizer exists, but the Weierstrass theorem is what shows that the optimal errors ultimately become arbitrarily small.
Use the values \(f(k/n)\) as coefficients in a weighted average.
Uniform continuity bounds the change in \(f\) when \(k/n\) is close to \(x\).
The second moment bounds the total weight assigned to sample points farther than a chosen distance.
Check Your Understanding
Use the definitions and proof in this tutorial to answer the following questions.
- What does the Weierstrass Approximation Theorem say in terms of the supremum norm?
- Why are the Bernstein weights a weighted average on \([0,1]\)?
- How does the second-moment identity bound the total weight of samples more than \(\delta\) from \(x\)?
- Why must the choice of \(\delta\) precede the choice of \(n\) in the convergence proof?
- For \(f(x)=x^2\), at which point on \([0,1]\) is the Bernstein approximation error largest, and what is its value?