What I’m going to present here is not exactly a paradox, but I couldn’t think of a better way to describe it in the space of a title. I’ll discuss two theorems about uniform convergence that seem to contradict each other, then show by an example why there’s no contradiction.

## Weierstrass approximation theorem

One of my favorite theorems is the Weierstrass approximation theorem. It says that every continuous function can be approximated as closely as you like by polynomials. This is surprising because polynomials are very special, well behaved functions, and merely continuous function can be worse.

For example, a polynomial cannot have any kinks in it, unlike the absolute value function. But even though an individual polynomial cannot have a kink, a sequence of polynomials can approach a kink.

## Morera’s theorem

Morera’s theorem [1] says that the uniform limit of analytic functions is analytic. But Weierstrass’s theorem says that the uniform limit of analytic functions (namely polynomials) can have a kink in it, which an analytic function cannot have. What gives?

Weierstrass’s theorem is about uniform convergence over an interval of the real line.

Morera’s theorem is about uniform convergence on compact subsets of an open set in the complex plane.

We’ll show an example below where a sequence of polynomials converges to |*x*| on an interval of the real line but not in a disk containing the interval.

## Bernstein polynomials

The Weierstrass approximation theorem tells us that there *exists* a sequence of polynomials converging uniformly to any continuous function on a compact interval. But we can go a step further and actually *construct* a sequence of such polynomials. The polynomials fall out of a proof of the Weierstrass theorem using probability! There’s nothing random going on here, and yet we can take a set of inequalities that fall out of calculations motivated by probability and construct our approximations.

Here is the *n*th Bernstein polynomial approximation to a function *g* in Mathematica code.

B[x_, n_, g_] := Sum[Binomial[n, k] x^k (1 - x)^(n - k) g[k/n], {k, 0, n}]

We can then use the following code to show the convergence of Bernstein polynomials.

f[x_] := Abs[x - 1/2] Plot[{B[x, 4, f], B[x, 10, f], B[x, 30, f], f[x]}, {x, 0, 1} , PlotLegends -> "Expressions"]

Next we’ll take a particular Bernstein polynomial for *f* in the sequence and plot the difference between it and *f* over the complex plane.

ComplexPlot3D[B[z, 6, f] - f[z], {z, 0, 1 + I}]

The polynomial is close to *f* along the interval [0, 1] on the real line, but the further we move away from the real axis the further it gets from *f*. Furthermore, the distance increases as we increase the degree of polynomial. The following code looks at the distance between *B*_{n}(*i*) and *f*(*i*) for *n* = 1, 2, 3, …, 10.

Table[N[Abs[B[I , n, f] - f[I]]], {n, 1, 10}]

It returns

0.6180 1.9021 1.9021 3.4085 3.4085 7.3941 7.3941 23.4511 23.4511 92.4377

So there’s no contradiction between the theorems of Weierstrass and Morera. The Bernstein polynomials do indeed converge uniformly to *f* over [0, 1] but they do not converge in the complex plane.

## Related posts

[1] I don’t know whether this theorem is exactly due to Morera, but it follows directly from Morera’s theorem.