Bernstein Polynomial Approximation
Approximate continuous functions with nonnegative Bernstein weights and compare the approximation error as degree grows.
By Riano · Published · Updated · Report a correction
Introduction to Bernstein Polynomials
The Bernstein polynomial approximation provides a constructive way to prove the Weierstrass Approximation Theorem. For any continuous function f on the interval [0, 1], we can construct a sequence of polynomials that converges uniformly to f. The n-th Bernstein polynomial for f is defined as:
Bn(f)(x) = Σj=0n f(j/n) C(n, j) xj(1-x)n-j
These polynomials use combinations of nonnegative weights based on the binomial distribution to approximate the target function. An important property is that the basis functions always sum to 1 across the interval.
Worked Example: Approximating a Square Function
Let us manually calculate the Bernstein polynomial approximation of degree 2 for the functionf(x) = x2. We will evaluate it at the midpoint x = 0.5.
- First, identify the samples f(j/n) for n = 2 and j = 0, 1, 2:
- j = 0: f(0) = 0
- j = 1: f(0.5) = 0.25
- j = 2: f(1) = 1
- Calculate the Bernstein basis polynomials bj,n(x) = C(n, j) xj(1-x)n-j at x = 0.5:
- b0,2(0.5) = 1 × (0.5)0 × (0.5)2 = 0.25
- b1,2(0.5) = 2 × (0.5)1 × (0.5)1 = 0.5
- b2,2(0.5) = 1 × (0.5)2 × (0.5)0 = 0.25
- Multiply the samples by the weights and sum:
B2(f)(0.5) = (0 × 0.25) + (0.25 × 0.5) + (1 × 0.25) = 0 + 0.125 + 0.25 = 0.375
The exact target is f(0.5) = 0.25, giving an absolute approximation error of |0.375 - 0.25| = 0.125. Notice that the sum of the weights is 0.25 + 0.5 + 0.25 = 1.
Experimenting with the Approximation
You can investigate how the degree and target function affect the approximation in the interactive module: Bernstein Polynomial Approximation.
Try the following steps to observe the convergence properties:
- Select the V-shape target function, which has a sharp cusp at x = 0.5.
- Set the Degree n to a low value (like 2) and observe the large absolute error at the Probe x of 0.5.
- Gradually increase the Degree n up to 12. You will see the red approximation curve become tighter around the cusp, reducing the absolute error, even though Bernstein polynomials converge slowly for non-smooth functions.
- Check the boundary points by setting Probe x to 0 or 1. Notice that the approximation is exact at the endpoints because the basis weights cleanly resolve to 1 and 0.
Limitations of Bernstein Polynomials
While Bernstein polynomials elegantly prove uniform convergence and possess excellent shape-preserving properties, they are rarely used in practical numerical approximation. A standard uniform error bound isO(1/n) for functions with a bounded second derivative; individual targets may converge faster or be reproduced exactly. For smooth targets, methods like Chebyshev interpolation or spline approximations achieve much faster convergence with lower degrees.
References
Heitzinger, C. Simulation and Optimization of the Manufacturing of Semiconductor Devices. Available at: https://www.iue.tuwien.ac.at/phd/heitzinger/node16.html.
Experience it interactively
Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Bernstein Polynomial Approximation module.
Try Bernstein Polynomial Approximation on Riano →