Bernstein polynomial (source code)

= Bernstein polynomial
{c}
{title2=$B_nf$}
{wiki}

For a function $f:[0,1]\to\mathbb R$ and an <integer> $n\geq1$, its <Bernstein polynomial> is
$$
B_nf(x)=\sum_{k=0}^n f(k/n)\binom nk x^k(1-x)^{n-k}
       =\mathbb E[f(K/n)],\qquad K\sim\operatorname{Bin}(n,x).
$$
The <Bernstein basis> supplies nonnegative weights whose sum is one. Equivalently, the weights are the <probabilities> of a <binomial distribution>, and the result is an <expected value>. At a given $x$, this averages the sampled values $f(k/n)$ with weights concentrated near $k/n=x$.<The Weierstrass approximation theorem (Georgia Tech handout)>[The Weierstrass approximation theorem, Lemmas 0.1–0.2 and Theorem 0.3, printed pp. 1–2: weights, binomial moments and polynomial construction]{ref}

The endpoints are exact: $B_nf(0)=f(0)$ and $B_nf(1)=f(1)$. Interior sampled points need not be interpolated. For example, <binomial distribution> moments give $B_n(x)=x$ and $B_n(x^2)=x^2+x(1-x)/n$. Thus every <affine function> is reproduced exactly, whereas $x^2$ is generally changed. <Bernstein polynomial degree preservation> is a statement about <degree of a polynomial>, not equality of the entire <polynomial>.

For a <continuous> $f$, the <uniform continuity> of $f$ and the <variance> $\operatorname{Var}(K/n)=x(1-x)/n\leq1/(4n)$ explain <uniform convergence>. Split the <expected value> of the error into $|K/n-x|<\delta$, where <uniform continuity> makes the change small, and its complement, whose <probability> is at most $1/(4n\delta^2)$ by <Chebyshev's inequality>. The <bounded function> $f$ bounds the remaining error. This proves convergence without assuming <differentiability>.

For $f\in C([0,1]^d)$, the tensor-product <Bernstein polynomial> is the <expected value> of $f(X_1/n,\ldots,X_d/n)$ for <independent random variables> $X_j\sim\operatorname{Bin}(n,x_j)$. The same <uniform continuity> and coordinatewise <variance> estimates give <uniform convergence> for each fixed finite $d$.