On this page
Polynomials are the easy functions: a computer evaluates them with nothing but multiplication and addition. The surprise is that on a closed interval they can stand in for any continuous function, corners and all, as closely as you like.
What does the Weierstrass approximation theorem say?
The Weierstrass approximation theorem states that every continuous function on a closed interval [a, b] can be uniformly approximated as closely as desired by a polynomial (Stone–Weierstrass theorem). Karl Weierstrass established it in 1885 (same source).
"Uniformly" is the word that matters. Pick any tolerance, say 0.001. There is a polynomial p with |f(x) − p(x)| < 0.001 for every x in [a, b] at the same time, not just near one point. The interval must be closed and bounded: on the whole real line a non-constant polynomial runs off to infinity, so none can track sin x everywhere. The proof leans on uniform continuity: one δ for every point, worth reading first.
Why are Taylor series not enough?
A Taylor polynomial is built from derivatives at one point, so it needs a function that has them. Three examples break it:
|x − ½| has a corner at x = ½, so it has no Taylor series there at all.
Weierstrass's own function, published in 1872, is continuous everywhere and differentiable nowhere (Weierstrass function), so there is no point to expand around.
Even an infinitely smooth function can fail: f(x) = e^(−1/x) for x > 0 and 0 otherwise has every derivative equal to 0 at the origin, so its Taylor series there is the zero function, which does not equal f for x > 0 (non-analytic smooth function).
When Taylor works, it is very accurate near its centre (how accurate is a Taylor polynomial). Weierstrass promises accuracy over the whole interval, with no derivatives required.
How do Bernstein polynomials approximate a function?
Sergei Bernstein introduced these polynomials around 1911 to 1912 to give a constructive proof of Weierstrass's theorem, an actual recipe rather than a proof that some polynomial exists (MacTutor biography of Bernstein; Bernstein polynomial). For f on [0, 1] and degree n:
Bn(f)(x) = sum over k = 0 to n of f(k/n) · C(n, k) · x^k · (1 − x)^(n − k).
You sample f at the n + 1 equally spaced points k/n and blend the samples with binomial weights. For a general [a, b], substitute x = (t − a)/(b − a) first. Unlike Lagrange interpolation, which passes exactly through its points, a Bernstein polynomial usually misses its own samples: it smooths them.
How close do Bernstein polynomials get to |x − ½|?
Take f(x) = |x − ½|. At degree 4 the samples f(0), f(¼), f(½), f(¾), f(1) are ½, ¼, 0, ¼, ½, and at x = ½ the binomial weights are 1, 4, 6, 4, 1 out of 16. So:
B4(½) = (½·1 + ¼·4 + 0·6 + ¼·4 + ½·1)/16 = 3/16 = 0.1875.
The true value is 0, and the gap is largest at the corner. The same sum at higher degrees gives these worst-case errors (our calculation):
Degree 4: 3/16 = 0.1875.
Degree 10: 126/1024, about 0.123.
Degree 40: C(40, 20)/2^41, about 0.063.
The method works, since the error keeps shrinking. But it is slow: quadrupling the degree from 10 to 40 only about halves the error.
Why is the proof really about probability?
Toss a coin n times with heads probability x; the chance of exactly k heads is C(n, k) x^k (1 − x)^(n − k). So Bn(f)(x) is the expected value of f(K/n), where K/n is the fraction of heads. This is the heart of Bernstein's original argument (Bernstein polynomial, probabilistic proof).
The fraction of heads has mean x and variance x(1 − x)/n, which is never more than 1/(4n). By Chebyshev's inequality, K/n lands far from x only rarely when n is large. Because f is uniformly continuous on [0, 1], whenever K/n is close to x, f(K/n) is close to f(x), with one δ that works for every x. So the expected error has a small part (K/n near x, where f barely moves) and a rare part (K/n far from x, where f is still bounded). Both shrink to 0 for every x at once: that is the theorem.
How can you practise this idea?
A three-step plan for one evening:
Compute B2(f)(x) for f(x) = x² by hand. You should get x² + x(1 − x)/2, so the error is exactly the variance of K/n.
Check B4(½) = 3/16 for |x − ½| without looking at the working above.
Rewrite the probability proof in your own words, naming where uniform continuity and Chebyshev's inequality are used.
If uniform continuity or Chebyshev's inequality feels shaky, the Fermi Concept Library covers every concept in mathematics, so you can patch that gap first. To check step 1, the Fermi Problem Library has a step-by-step solver that explains the reasoning.
Start with step 1: it shows the whole idea in miniature.



