Module contents
Lesson 14 of 20Advanced 100 min

Uniform convergence and function approximation

The jump from sequences of numbers to sequences of functions: pointwise versus uniform convergence, the supremum norm and completeness of C[a, b], theorems for interchanging limits with integrals, derivatives and series, and two approximation results with consequences for learning: the Weierstrass theorem (with Bernstein polynomials) and Arzelà–Ascoli. This underlies universal approximation, Fourier series and existence of ODE solutions.

After this lesson you can

  • Distinguish pointwise from uniform convergence using the supremum norm and decide which holds in examples.
  • Prove that the uniform limit of continuous functions is continuous and that C[a, b] with the supremum norm is complete.
  • Apply theorems interchanging limits with integrals, derivatives and sums, including the Weierstrass M-test.
  • Prove the Weierstrass approximation theorem using Bernstein polynomials and estimate its rate.
  • State Arzelà–Ascoli and use it to reason about compactness of families of functions.

Before you start

Motivation: what does it mean for a sequence of models to converge?

Almost everything you build in machine learning produces a sequence of functions, not numbers. Training generates models f1,f2,…f_1, f_2, \dots, one per epoch. A network with nn neurons in its hidden layer is a function fnf_n, and the question “can a network approximate anything?” asks what happens as nn grows. Taylor polynomials of the power series of exe^x, partial sums of a Fourier series and Picard iterations constructing the solution of an ODE are also sequences of functions.

You already know what it means for a sequence of numbers to converge. For functions there is an obvious answer, “fn(x)→f(x)f_n(x) \to f(x) at every xx,” but it turns out to be too weak: almost all the properties we care about can escape. Three examples you will explore in the first interactive:

  • Continuity is lost. Each xnx^n is continuous on [0,1][0, 1], but at each point xnx^n tends to 00 if x<1x < 1 and to 11 if x=1x = 1. The limit jumps.
  • Integrals do not pass to the limit. A bump of height nn supported on [1/n,3/n][1/n, 3/n] tends to 00 at every point because it eventually passes by, and its area is 11 for every nn. The limit of the integrals is 11; the integral of the limit, 00.
  • Derivatives do not pass to the limit. sin⁡(n2x)/n\sin(n^2 x)/n tends to 00 everywhere and as fast as you like, but its derivative ncos⁡(n2x)n\cos(n^2 x) blows up.

If a model fnf_n approximates a target ff and you use ∫fn\int f_n to estimate an expectation, or fn′f_n' to estimate a sensitivity, you need to know when those operations commute with the limit. This lesson introduces the notion that fixes it, uniform convergence, and the metric that measures it, the supremum norm. With these we will prove the space of continuous functions is complete, give limit-interchange theorems (for integrals, derivatives and series), settle what remained open for power series and prove two approximation results with direct consequences for learning: Weierstrass’s theorem, saying polynomials approximate any continuous function, and Arzelà–Ascoli, characterizing compact families of functions.

Pointwise versus uniform convergence

Let XX be a set (for us, almost always an interval [a,b][a, b] or a compact subset of Rd\R^d) and let fn,f:X→Rf_n, f: X \to \R.

The difference is only in the order of quantifiers, as between uniform continuity and ordinary continuity. In pointwise convergence, NN may depend on the point; in uniform convergence, it cannot. The second definition has an immediate geometric reading: draw a tube of radius ε\eps around the graph of ff, the band {(x,y):∣y−f(x)∣<ε}\{(x, y) : \abs{y - f(x)} < \eps\}. Convergence is uniform if, for each ε\eps, from some nn onward the entire graph of fnf_n stays inside the tube.

The condition “for all xx, ∣fn(x)−f(x)∣<ε\abs{f_n(x) - f(x)} < \eps” is summarized by one number.

The norm properties are checked pointwise: ∣f(x)+g(x)∣≤∣f(x)∣+∣g(x)∣≤∥f∥∞+∥g∥∞\abs{f(x) + g(x)} \le \abs{f(x)} + \abs{g(x)} \le \norm{f}_\infty + \norm{g}_\infty for every xx, and taking the supremum on the left gives the triangle inequality. In this notation the definition of uniform convergence reads:

fn→f uniformemente en X  ⟺  ∥fn−f∥∞→0.f_n \to f \text{ uniformemente en } X \iff \norm{f_n - f}_\infty \to 0.

(If ∣fn(x)−f(x)∣<ε\abs{f_n(x) - f(x)} < \eps for every xx, the supremum is ≤ε\le \eps; and if the supremum is <ε< \eps, every value is.) Uniform convergence is therefore convergence in the metric space (B(X),d∞)(B(X), d_\infty). This reduces deciding whether a sequence converges uniformly to a calculus exercise: find the pointwise limit ff and then maximize ∣fn−f∣\abs{f_n - f}.

InteractiveThe ε tube
  • fn=xnf_n = x^n inside the tube
  • outside the tube
  • limit ff
  • tube f±εf \pm \eps
N(ε,x)N(\eps, x): index after which fm(x)f_m(x) stays inside the tube (clipped at 200). The horizontal line is the current nn.
8
0.15
Lower panel
∥fn−f∥∞\norm{f_n - f}_\infty1 (not attained)
Entire graph inside?no
Uniform NNdoes not exist
∣fn(x0)−f(x0)∣\abs{f_n(x_0) - f(x_0)}0.168
N(ε,x0)N(\eps, x_0)9
∫fn\int f_n0.1111
∫f\int f (of the limit)0
Each x<1x < 1 eventually enters the tube, but near 11 ever larger nn is needed: N(ε,x)N(\eps, x) is unbounded and the limit, which jumps at x=1x = 1, is not even continuous.
Choose a sequence, move nn and the radius ε\eps of the tube around the limit ff. Parts of fnf_n outside the tube are red and the magenta segment marks where ∥fn−f∥∞\norm{f_n - f}_\infty is attained. Drag x0x_0: each point eventually enters the tube, but with the same nn? The lower panel answers by plotting N(ε,x)N(\eps, x), the index from which fm(x)f_m(x) no longer leaves the tube. With xnx^n on [0,1][0, 1] it shoots up near 11; with xnx^n on [0,0.9][0, 0.9] and with sin⁡(nx)/n\sin(nx)/n it stays bounded. Try the moving bump and look at the integral readout.

The N(ε,x)N(\eps, x) panel makes the difference between the two quantifiers visible. Pointwise convergence says N(ε,x)N(\eps, x) is finite at each point; uniform convergence says sup⁡xN(ε,x)<∞\sup_x N(\eps, x) < \infty for each ε\eps. For xnx^n on [0,1)[0, 1), the smallest NN with xN<εx^N < \eps is ⌈log⁡ε/log⁡x⌉\lceil \log\eps / \log x \rceil, which tends to infinity as x→1−x \to 1^-: no nn puts the entire graph inside the tube. Moving to [0,0.9][0, 0.9] removes exactly the problematic region.

To decide whether a sequence converges uniformly without knowing its limit in advance, the criterion is Cauchy’s, now in the supremum norm.

The forward implication is the triangle inequality. The converse is precisely completeness of the function space, proved in the next section.

Continuity of the limit and completeness of C[a, b]

Uniform convergence preserves continuity. This result justifies everything else.

The proof is the ε/3\eps/3 argument: to compare f(x)f(x) with f(x0)f(x_0), pass through fN(x)f_N(x) and fN(x0)f_N(x_0), with an NN that uniformity lets us choose before looking at xx. You will reconstruct it step by step in the first exercise. Two immediate consequences:

  • xnx^n does not converge uniformly on [0,1][0, 1], because its pointwise limit is discontinuous. This is the fastest way to rule out uniformity.
  • The converse is false: nxe−nx2n x e^{-nx^2} has a continuous limit and does not converge uniformly. A continuous limit is not enough.

The space of continuous functions is complete

Let C[a,b]C[a, b] be the space of continuous functions on [a,b][a, b], with the supremum norm. By the Weierstrass extreme value theorem, every f∈C[a,b]f \in C[a, b] is bounded and the supremum is a maximum: ∥f∥∞=max⁡[a,b]∣f∣\norm{f}_\infty = \max_{[a, b]}\abs{f}. What makes C[a,b]C[a, b] a good space for analysis is that Cauchy sequences converge within it.

Proof

Let (fn)(f_n) be Cauchy in the supremum norm. For each xx, ∣fn(x)−fm(x)∣≤∥fn−fm∥∞\abs{f_n(x) - f_m(x)} \le \norm{f_n - f_m}_\infty, so the sequence of numbers (fn(x))(f_n(x)) is Cauchy in R\R and, by completeness of R\R, converges. Call its limit f(x)f(x): we now have a pointwise candidate.

Now uniformity. Given ε>0\eps > 0, take NN with ∥fn−fm∥∞≤ε\norm{f_n - f_m}_\infty \le \eps for n,m≥Nn, m \ge N. Fix n≥Nn \ge N and x∈[a,b]x \in [a, b]. For every m≥Nm \ge N, ∣fn(x)−fm(x)∣≤ε\abs{f_n(x) - f_m(x)} \le \eps; letting m→∞m \to \infty, ∣fn(x)−f(x)∣≤ε\abs{f_n(x) - f(x)} \le \eps. Since NN does not depend on xx, ∥fn−f∥∞≤ε\norm{f_n - f}_\infty \le \eps for all n≥Nn \ge N: fn→ff_n \to f uniformly. By the preceding theorem, ff is continuous, that is, f∈C[a,b]f \in C[a, b]. The same argument works in C(K)C(K) and, omitting the final step, in B(X)B(X).

∎

This is the completeness of C[a, b] with the supremum norm, with an immediate practical consequence: the Banach fixed-point theorem applies in C[a,b]C[a, b]. This proves the Picard–Lindelöf theorem on existence and uniqueness of ODE solutions: Picard iteration is a contraction on a space of continuous functions, and its fixed point is the solution.

Interchanging limits

The three pathologies in the motivation are three questions of the form “can I interchange two operations that are limits?”:

lim⁡n∫fn=?∫lim⁡nfn,lim⁡nfn′=?(lim⁡nfn)′,∑k∫uk=?∫∑kuk.\lim_n \int f_n \overset{?}{=} \int \lim_n f_n, \qquad \lim_n f_n' \overset{?}{=} \Big(\lim_n f_n\Big)', \qquad \sum_k \int u_k \overset{?}{=} \int \sum_k u_k.

An integral is a limit of Riemann sums; a derivative, a limit of difference quotients; a series, a limit of partial sums. Interchanging two limits is generally illegitimate: lim⁡mlim⁡nmm+n=0\lim_m \lim_n \frac{m}{m + n} = 0 and lim⁡nlim⁡mmm+n=1\lim_n \lim_m \frac{m}{m + n} = 1. The limit-interchange theorems give sufficient conditions, and uniformity is key in all three.

Integrals

Proof

Let εn=∥fn−f∥∞\eps_n = \norm{f_n - f}_\infty. Then fn−εn≤f≤fn+εnf_n - \eps_n \le f \le f_n + \eps_n on [a,b][a, b], and ff is bounded. The upper and lower integrals of ff lie between ∫fn−εn(b−a)\int f_n - \eps_n(b - a) and ∫fn+εn(b−a)\int f_n + \eps_n(b - a), so differ by at most 2εn(b−a)→02\eps_n(b - a) \to 0. Therefore they agree: ff is integrable. And ∣∫fn−∫f∣≤∫∣fn−f∣≤(b−a)εn\abs{\int f_n - \int f} \le \int \abs{f_n - f} \le (b - a)\eps_n.

∎

Both counterexamples fail exactly where the assumption fails. For the bump hnh_n (height nn, base [1/n,3/n][1/n, 3/n]), ∥hn∥∞=n\norm{h_n}_\infty = n and ∫01hn=1\int_0^1 h_n = 1. For nxe−nx2n x e^{-nx^2},

∫01nxe−nx2 ⁣dx=[−12e−nx2]01=1−e−n2⟶12≠0=∫01lim⁡nfn.\int_0^1 n x e^{-nx^2} \dd x = \Big[-\tfrac{1}{2} e^{-nx^2}\Big]_0^1 = \frac{1 - e^{-n}}{2} \longrightarrow \frac{1}{2} \neq 0 = \int_0^1 \lim_n f_n.

In both cases mass concentrates in an increasingly narrow region near the origin and height grows to compensate. In contrast, ∫01xn ⁣dx=1/(n+1)→0\int_0^1 x^n \dd x = 1/(n + 1) \to 0, which is the integral of the limit, even though convergence is not uniform. Uniformity is sufficient, not necessary: what saves xnx^n is that it is bounded by 1. The Lebesgue integral’s dominated convergence theorem turns that observation into a theorem: pointwise convergence and a bound ∣fn∣≤g\abs{f_n} \le g with ∫g<∞\int g < \infty suffice.

Derivatives

Uniform convergence does not control derivatives. Small ∥fn−f∥∞\norm{f_n - f}_\infty says graphs are close, not that their slopes agree. An oscillation of amplitude 1/n1/n and frequency n2n^2 is uniformly close to 0 and has slope nn.

InteractiveThe function converges, not the derivative
∥fn−f∥∞\norm{f_n - f}_\infty
10⁻²10⁻¹11010²
0.167
∥fn′−g∥∞\norm{f_n' - g}_\infty
10⁻²10⁻¹11010²
6
fn(x)=sin⁡(n2x)/nf_n(x) = \sin(n^2 x)/n and its limit ff
fn′(x)=ncos⁡(n2x)f_n'(x) = n\cos(n^2 x) and g=f′=0g = f' = 0
  • fnf_n
  • limit ff and its derivative (or pointwise limit gg)
  • fn′f_n' and tangent at x0x_0
  • band f±∥fn−f∥∞f \pm \norm{f_n - f}_\infty
Sequence
6
∥fn−f∥∞\norm{f_n - f}_\infty0.167
∥fn′−g∥∞\norm{f_n' - g}_\infty6
Distance in the C1C^1 norm6.17
fn′(x0)f_n'(x_0)−1.559
g(x0)g(x_0)0
Amplitude 1/n1/n, slope up to nn: the ratio is n2n^2. Uniform closeness to 00 says nothing about derivatives.
Above, fnf_n with a band of radius ∥fn−f∥∞\norm{f_n - f}_\infty around its limit and the tangent at x0x_0; below, fn′f_n'. The two indicators, on a logarithmic scale, compare uniform distances of functions and derivatives side by side. With sin⁡(n2x)/n\sin(n^2 x)/n, increase nn: the first bar shrinks like 1/n1/n and the second grows like nn. Switch to x2+1/n2\sqrt{x^2 + 1/n^2}: every fnf_n is smooth and the limit ∣x∣\abs{x} is not differentiable at 0. What do the derivatives do near the origin?

The figure’s second example is subtler than the first. The fn(x)=x2+1/n2f_n(x) = \sqrt{x^2 + 1/n^2} are C∞C^\infty, 0≤fn(x)−∣x∣≤1/n0 \le f_n(x) - \abs{x} \le 1/n (multiply and divide by fn(x)+∣x∣f_n(x) + \abs{x}) and the uniform limit ∣x∣\abs{x} is not differentiable at 0. The derivatives fn′(x)=x/x2+1/n2f_n'(x) = x/\sqrt{x^2 + 1/n^2} converge pointwise to sign⁡x\operatorname{sign} x, which is discontinuous: derivative convergence cannot be uniform, by the continuity theorem. What is needed is precisely that, uniform convergence of the derivatives.

Proof

Let c=lim⁡nfn(x0)c = \lim_n f_n(x_0). The function gg is continuous as the uniform limit of continuous fn′f_n', so define f(x)=c+∫x0xg(t) ⁣dtf(x) = c + \int_{x_0}^x g(t) \dd t, which by the fundamental theorem of calculus is C1C^1 with f′=gf' = g. By the same theorem, fn(x)=fn(x0)+∫x0xfn′(t) ⁣dtf_n(x) = f_n(x_0) + \int_{x_0}^x f_n'(t) \dd t. Subtracting,

∣fn(x)−f(x)∣≤∣fn(x0)−c∣+∣x−x0∣ ∥fn′−g∥∞≤∣fn(x0)−c∣+(b−a) ∥fn′−g∥∞,\abs{f_n(x) - f(x)} \le \abs{f_n(x_0) - c} + \abs{x - x_0}\,\norm{f_n' - g}_\infty \le \abs{f_n(x_0) - c} + (b - a)\,\norm{f_n' - g}_\infty,

and the bound does not depend on xx and tends to 0.

∎

The assumption C1C^1 simplifies the proof; Rudin (theorem 7.17) proves the same assuming only that fnf_n are differentiable, using the mean value theorem instead of the integral. A compact way to state all this: on C1[a,b]C^1[a, b] with norm ∥f∥C1=∥f∥∞+∥f′∥∞\norm{f}_{C^1} = \norm{f}_\infty + \norm{f'}_\infty, measuring both values and slopes, the preceding theorem shows a Cauchy sequence converges, so C1[a,b]C^1[a, b] is complete. The sin⁡(n2x)/n\sin(n^2 x)/n tend to 0 in ∥⋅∥∞\norm{\cdot}_\infty and their C1C^1 distance to 0 is 1/n+n→∞1/n + n \to \infty.

Series of functions and the M-test

A series ∑kuk(x)\sum_k u_k(x) converges uniformly if its partial sums Sn=∑k≤nukS_n = \sum_{k \le n} u_k do. Applied to SnS_n, the integral theorem says a uniformly convergent series of integrable functions can be integrated term by term; the derivative theorem says it can be differentiated term by term if the derivative series converges uniformly. The practical criterion for uniformity is the Weierstrass M-test.

Proof

For m>nm > n, ∣Sm(x)−Sn(x)∣≤∑k=n+1m∣uk(x)∣≤∑k=n+1mMk\abs{S_m(x) - S_n(x)} \le \sum_{k = n + 1}^m \abs{u_k(x)} \le \sum_{k = n + 1}^m M_k for every xx. Since ∑Mk\sum M_k converges, its tails tend to 0 and (Sn)(S_n) is Cauchy in the supremum norm. By completeness of B(X)B(X), it converges uniformly to a function SS. Letting m→∞m \to \infty in the inequality gives the tail bound. Absolute convergence at each point follows by comparison.

∎

The tail bound is a usable error estimate: with uk(x)=sin⁡(kx)/k2u_k(x) = \sin(kx)/k^2, Mk=1/k2M_k = 1/k^2 and ∑k>n1/k2<1/n\sum_{k > n} 1/k^2 < 1/n, so one hundred terms approximate the sum throughout R\R with error below 0.010.01. The sum is continuous, being a uniform limit of continuous functions. In contrast, the derivative series, ∑kcos⁡(kx)/k\sum_k \cos(kx)/k, is the harmonic series at x=0x = 0 and diverges: term-by-term differentiation is not allowed.

Power series: what remained to prove

The Taylor lesson used without proof that a power series may be differentiated and integrated term by term inside its radius of convergence. Now we have the tools.

Proof

Point 1 is an M-test exercise you will do at the end: take ρ\rho between rr and RR and compare with a geometric series. For 2, every x∈(−R,R)x \in (-R, R) lies in some [−r,r][-r, r] with r<Rr < R, partial sums are polynomials, convergence is uniform on [−r,r][-r, r], and continuity is local. For 3, the radius is calculated using Cauchy–Hadamard, 1/R=lim sup⁡k∣ak∣1/k1/R = \limsup_k \abs{a_k}^{1/k}, and lim sup⁡k(k∣ak∣)1/k=lim sup⁡k∣ak∣1/k\limsup_k (k\abs{a_k})^{1/k} = \limsup_k \abs{a_k}^{1/k} because k1/k→1k^{1/k} \to 1. (Multiplication by xx does not change the radius, so ∑kakxk−1\sum k a_k x^{k-1} and ∑kakxk\sum k a_k x^k converge at the same points.) By point 1 applied to the derivative series, derivatives of the partial sums converge uniformly on every [−r,r][-r, r], and the derivative theorem gives f′=∑kakxk−1f' = \sum k a_k x^{k-1} there. Point 4 follows by iterating 3 and applying the integral theorem on [0,x][0, x].

∎

Uniformity holds on every [−r,r][-r, r], not all of (−R,R)(-R, R). The geometric series ∑xk=1/(1−x)\sum x^k = 1/(1 - x) has R=1R = 1 and sup⁡∣x∣<1∣1/(1−x)−∑k≤nxk∣=sup⁡∣x∣<1∣x∣n+1/∣1−x∣=∞\sup_{\abs{x} < 1} \abs{1/(1 - x) - \sum_{k \le n} x^k} = \sup_{\abs{x} < 1} \abs{x}^{n+1}/\abs{1 - x} = \infty for every nn. This is called convergence uniform on compact subsets of (−R,R)(-R, R). As for endpoints, Abel’s theorem says that if the series converges at x=Rx = R, convergence is uniform on [0,R][0, R]; this justifies, for example, ∑k≥1(−1)k+1/k=log⁡2\sum_{k \ge 1} (-1)^{k+1}/k = \log 2 by evaluating the series for log⁡(1+x)\log(1 + x) at x=1x = 1.

The Weierstrass approximation theorem

Which functions can be uniformly approximated by polynomials? Taylor series work only for analytic functions, and some C∞C^\infty functions are not analytic. Weierstrass’s answer (1885) is surprising: all continuous functions.

This is the Weierstrass approximation theorem. The most beautiful proof is Sergei Bernstein’s (1912), which is also constructive and has a probabilistic interpretation. It suffices to treat [0,1][0, 1]: the change x=a+(b−a)tx = a + (b - a)t maps polynomials to polynomials.

Bernstein polynomials

It uses only values of ff on the uniform grid 0,1/n,…,10, 1/n, \dots, 1, averaging them with weights bn,k(x)≥0b_{n,k}(x) \ge 0 that, by the binomial theorem, sum to (x+(1−x))n=1(x + (1 - x))^n = 1. The probabilistic interpretation explains everything. Toss a coin nn times, with heads probability xx, and let SnS_n be the number of heads, Sn∼Bin⁡(n,x)S_n \sim \operatorname{Bin}(n, x). Then P(Sn=k)=bn,k(x)\Pr(S_n = k) = b_{n,k}(x) and

Bnf(x)=E[f(Snn)].B_n f(x) = \E\Big[f\Big(\frac{S_n}{n}\Big)\Big].

By the law of large numbers, the frequency Sn/nS_n/n concentrates around xx, and if ff is continuous, f(Sn/n)f(S_n/n) concentrates around f(x)f(x). What turns this idea into uniform convergence is that the spread of Sn/nS_n/n is controlled by a bound independent of xx.

These are the total mass, mean and variance of Sn/nS_n/n: E[Sn]=nx\E[S_n] = nx and Var⁡(Sn)=nx(1−x)\Var(S_n) = nx(1 - x), because SnS_n is the sum of nn independent Bernoulli variables. If you prefer not to use probability, they follow by differentiating (x+y)n=∑k(nk)xkyn−k(x + y)^n = \sum_k \binom{n}{k} x^k y^{n-k}:

∑kk(nk)xkyn−k=nx(x+y)n−1\sum_k k \tbinom{n}{k} x^k y^{n-k} = n x (x + y)^{n-1}
Apply x ∂xx\,\partial_x to both sides of (x+y)n=∑k(nk)xkyn−k(x + y)^n = \sum_k \tbinom{n}{k} x^k y^{n-k}.
1/4

In particular, BnB_n reproduces affine functions exactly (Bn1=1B_n 1 = 1, Bnx=xB_n x = x) but not quadratics: Bn(x2)=x2+x(1−x)/nB_n(x^2) = x^2 + x(1 - x)/n. The error for f(x)=x2f(x) = x^2 is exactly x(1−x)/nx(1 - x)/n, with maximum 1/(4n)1/(4n).

Proof

Let M=∥f∥∞M = \norm{f}_\infty. Since [0,1][0, 1] is compact, ff is uniformly continuous: given ε>0\eps > 0 there is δ>0\delta > 0 with ∣f(s)−f(t)∣<ε/2\abs{f(s) - f(t)} < \eps/2 if ∣s−t∣<δ\abs{s - t} < \delta. Fix x∈[0,1]x \in [0, 1]. Since the weights sum to 1,

∣Bnf(x)−f(x)∣=∣∑k(f(kn)−f(x))bn,k(x)∣≤∑∣k/n−x∣<δε2 bn,k(x)+∑∣k/n−x∣≥δ2M bn,k(x).\abs{B_n f(x) - f(x)} = \Big|\sum_k \Big(f\Big(\frac{k}{n}\Big) - f(x)\Big) b_{n,k}(x)\Big| \le \sum_{\abs{k/n - x} < \delta} \frac{\eps}{2}\, b_{n,k}(x) + \sum_{\abs{k/n - x} \ge \delta} 2M\, b_{n,k}(x).

The first sum is at most ε/2\eps/2. In the second, each term satisfies 1≤(k/n−x)2/δ21 \le (k/n - x)^2/\delta^2, so by the third moment,

∑∣k/n−x∣≥δbn,k(x)≤1δ2∑k(kn−x)2bn,k(x)=x(1−x)nδ2≤14nδ2.\sum_{\abs{k/n - x} \ge \delta} b_{n,k}(x) \le \frac{1}{\delta^2}\sum_k \Big(\frac{k}{n} - x\Big)^2 b_{n,k}(x) = \frac{x(1 - x)}{n\delta^2} \le \frac{1}{4n\delta^2}.

(This is Chebyshev’s inequality for Sn/nS_n/n.) Hence ∣Bnf(x)−f(x)∣≤ε/2+M/(2nδ2)\abs{B_n f(x) - f(x)} \le \eps/2 + M/(2n\delta^2), a bound independent of xx. For n>M/(εδ2)n > M/(\eps\delta^2) it is less than ε\eps throughout [0,1][0, 1].

∎

Notice where each assumption was used: uniform continuity (from compactness) gives a δ\delta valid for all xx, and the bound x(1−x)≤1/4x(1 - x) \le 1/4 makes concentration uniform. This two-part pattern recurs throughout analysis: nearby, regularity; far away, the probability of being far away is small.

InteractiveBernstein polynomials
Weights bn,k(x0)b_{n,k}(x_0) at k/nk/n: the distribution of S/nS/n with S∼Bin⁡(n,x0)S \sim \operatorname{Bin}(n, x_0), standard deviation 0.125
  • ff
  • BnfB_n f
  • samples f(k/n)f(k/n)
  • maximum error
Uniform error ∥Bnf−f∥∞\norm{B_n f - f}_\infty (and Chebyshev error) versus degree nn, on log-log axes
  • Bernstein
  • Chebyshev
  • ∝1/n\propto 1/n
  • ∝1/n\propto 1/\sqrt{n}
16
∥Bnf−f∥∞\norm{B_n f - f}_\infty0.118
attained at x≈x \approx0.500
Chebyshev, same degree0.0211
Log-log slope (n≥32n \ge 32)−0.50
Bnf(x0)B_n f(x_0)0.7322
f(x0)f(x_0)0.8500
At the peak the error is 1.2 E∣S/n−1/2∣≈1.2/2πn1.2\,\E\abs{S/n - 1/2} \approx 1.2/\sqrt{2\pi n}: slope −1/2-1/2. Away from the peak the function is linear and the error is much smaller.
Choose a function or draw it directly with the pointer on the graph, with as many peaks as you like. Increase degree nn (the scale is logarithmic) and drag x0x_0. Magenta points are samples f(k/n)f(k/n), and below are the weights bn,k(x0)b_{n,k}(x_0): Bnf(x0)B_n f(x_0) is their weighted average, a bell of width x0(1−x0)/n\sqrt{x_0(1 - x_0)/n} that narrows as nn grows. The lower graph measures uniform error against nn on log-log axes: compare the slope with lines 1/n1/n and 1/n1/\sqrt{n} for the smooth function, the peak and the cusp. Enable Chebyshev to see what another method achieves at the same degree.

How fast?

The proof gives convergence, but the figure shows that speed depends on regularity of ff. The same pieces of the proof quantify it.

Proof

(1) ∣Bnf(x)−f(x)∣≤∑k∣f(k/n)−f(x)∣ bn,k≤L∑k∣k/n−x∣ bn,k=L E∣Sn/n−x∣\abs{B_n f(x) - f(x)} \le \sum_k \abs{f(k/n) - f(x)}\,b_{n,k} \le L\sum_k \abs{k/n - x}\,b_{n,k} = L\,\E\abs{S_n/n - x}. By Cauchy–Schwarz (or Jensen), E∣Y∣≤E[Y2]\E\abs{Y} \le \sqrt{\E[Y^2]}, and the third moment gives x(1−x)/n\sqrt{x(1 - x)/n}. (2) Similarly, with ∣f(s)−f(t)∣≤H∣s−t∣α\abs{f(s) - f(t)} \le H\abs{s - t}^\alpha and E∣Y∣α≤(E[Y2])α/2\E\abs{Y}^\alpha \le (\E[Y^2])^{\alpha/2}, by Jensen with the concave function t↦tα/2t \mapsto t^{\alpha/2}. (3) By Taylor with Lagrange remainder, f(k/n)=f(x)+f′(x)(k/n−x)+12f′′(ξk)(k/n−x)2f(k/n) = f(x) + f'(x)(k/n - x) + \tfrac{1}{2}f''(\xi_k)(k/n - x)^2. Multiplying by bn,kb_{n,k} and summing, the linear term disappears by the second moment (∑k(k/n−x)bn,k=0\sum_k (k/n - x) b_{n,k} = 0) and the remainder is bounded by 12∥f′′∥∞ x(1−x)/n\tfrac{1}{2}\norm{f''}_\infty\,x(1 - x)/n.

∎

The three bounds are sharp in order of magnitude. For the peak f(x)=∣x−1/2∣f(x) = \abs{x - 1/2}, which is 1-Lipschitz, the error at x=1/2x = 1/2 is exactly E∣Sn/n−1/2∣\E\abs{S_n/n - 1/2}, which by the central limit theorem behaves like 1/2πn1/\sqrt{2\pi n}: with n=100n = 100 it is 0.03980.0398, compared with 0.03990.0399 for the approximation. For the cusp ∣x−1/2∣\sqrt{\abs{x - 1/2}}, of exponent 1/21/2, error falls like n−1/4n^{-1/4}. And for smooth functions, Voronovskaya’s theorem (1932) gives exact behavior: if f∈C2f \in C^2,

lim⁡n→∞n (Bnf(x)−f(x))=x(1−x)2f′′(x)\lim_{n \to \infty} n\,\big(B_n f(x) - f(x)\big) = \frac{x(1 - x)}{2} f''(x)

uniformly on [0,1][0, 1]. The error is of order 1/n1/n, neither better nor worse, even if ff is analytic: Bernstein saturates at 1/n1/n, and the only way to go faster is that f′′=0f'' = 0, that is, ff is affine. For f(x)=sin⁡(2πx)f(x) = \sin(2\pi x), the maximum of x(1−x)∣f′′(x)∣/2x(1 - x)\abs{f''(x)}/2 is 3.943.94, so lowering error below 10−610^{-6} requires n≈3.9×106n \approx 3.9\times 10^6. Interpolation at Chebyshev nodes achieves the same with degree 11.

Beyond polynomials: Stone–Weierstrass

What is special about polynomials? Very little. Marshall Stone (1937, 1948) isolated the properties that matter.

We do not prove it here (the proof uses Weierstrass to approximate ∣t∣\abs{t} and a lattice argument), but consequences are immediate. Polynomials in dd variables are dense in C(K)C(K) for every compact K⊂RdK \subset \R^d. Trigonometric polynomials a0+∑k=1n(akcos⁡kx+bksin⁡kx)a_0 + \sum_{k=1}^n (a_k \cos kx + b_k \sin kx) are dense in continuous 2π2\pi-periodic functions (apply the theorem on the circle, which is compact; cos⁡x\cos x and sin⁡x\sin x together separate its points), the starting point for Fourier series convergence. And there is a direct connection to networks: finite linear combinations ∑jαjcos⁡(wj⊤x+bj)\sum_j \alpha_j \cos(\vb{w}_j\T\vb{x} + b_j) form an algebra, because cos⁡Acos⁡B=12[cos⁡(A+B)+cos⁡(A−B)]\cos A\cos B = \tfrac{1}{2}[\cos(A + B) + \cos(A - B)] and A±BA \pm B are again affine in x\vb{x}; they contain constants (w=0\vb{w} = \vb{0}) and separate points. By Stone–Weierstrass, a network with one hidden layer and cosine activation uniformly approximates any continuous function on a compact set. The case of sigmoid activations, which do not form an algebra, is Cybenko’s theorem (1989), the universal approximation theorem, requiring another technique (Hahn–Banach and the Riesz representation theorem).

Equicontinuity and the Arzelà–Ascoli theorem

In Rd\R^d, every bounded sequence has a convergent subsequence (Bolzano–Weierstrass), and compact sets are closed and bounded. In C[0,1]C[0, 1] this is false. The sequence xnx^n lies in the unit ball, ∥xn∥∞=1\norm{x^n}_\infty = 1, and no subsequence converges uniformly: every subsequence converges pointwise to the discontinuous function jumping at 1, and a uniform limit would have to agree with it and be continuous. The closed unit ball of C[0,1]C[0, 1] is closed and bounded, but not compact.

What do the xnx^n lack? They become increasingly steep near 1. The following condition prevents this.

The canonical example: if all f∈Ff \in \mathcal{F} are Lipschitz with the same constant LL, δ=ε/L\delta = \eps/L suffices. Thus families with uniformly bounded derivatives, ∥f′∥∞≤L\norm{f'}_\infty \le L, are equicontinuous. The xnx^n are not: for any δ\delta, xnx^n goes from almost 0 to 1 on [1−δ,1][1 - \delta, 1] when nn is large.

This is the Arzelà–Ascoli theorem: in a space of functions on a compact set, “bounded plus equicontinuous” replaces “bounded” in Bolzano–Weierstrass.

Proof

(2 ⇒ 1). A compact metric space is separable: for every mm, finitely many balls of radius 1/m1/m cover it, and the union of their centers is a countable dense set D={d1,d2,… }D = \{d_1, d_2, \dots\}. Let (fn)(f_n) be a sequence in F\mathcal{F} and BB the uniform bound.

Step 1: convergence on DD (diagonal argument). The sequence of numbers (fn(d1))(f_n(d_1)) lies in [−B,B][-B, B], so has a convergent subsequence; call it (f1,n)(f_{1,n}). Extract from it (f2,n)(f_{2,n}) with (f2,n(d2))(f_{2,n}(d_2)) convergent, and so on. The diagonal gj=fj,jg_j = f_{j,j} is, from term ii onward, a subsequence of (fi,n)(f_{i,n}), so (gj(di))(g_j(d_i)) converges for every ii.

Step 2: from DD to all of KK (ε/3\eps/3 again). Given ε>0\eps > 0, take the equicontinuity δ\delta for ε/3\eps/3. Balls B(d,δ)B(d, \delta) with d∈Dd \in D cover KK because DD is dense, and compactness means finitely many suffice: B(di1,δ),…,B(dip,δ)B(d_{i_1}, \delta), \dots, B(d_{i_p}, \delta). Since there are finitely many points, there exists JJ such that ∣gj(dir)−gl(dir)∣<ε/3\abs{g_j(d_{i_r}) - g_l(d_{i_r})} < \eps/3 for all r≤pr \le p and all j,l≥Jj, l \ge J. For any x∈Kx \in K choose rr with d(x,dir)<δd(x, d_{i_r}) < \delta:

∣gj(x)−gl(x)∣≤∣gj(x)−gj(dir)∣+∣gj(dir)−gl(dir)∣+∣gl(dir)−gl(x)∣<ε.\abs{g_j(x) - g_l(x)} \le \abs{g_j(x) - g_j(d_{i_r})} + \abs{g_j(d_{i_r}) - g_l(d_{i_r})} + \abs{g_l(d_{i_r}) - g_l(x)} < \eps.

Thus (gj)(g_j) is Cauchy in the supremum norm and, by completeness of C(K)C(K), converges uniformly.

(1 ⇒ 2). If F\mathcal{F} were not uniformly bounded, there would be fnf_n with ∥fn∥∞>n\norm{f_n}_\infty > n and no convergent subsequences. For equicontinuity: the closure of F\mathcal{F} is compact, hence totally bounded, as is F\mathcal{F}, so there are h1,…,hp∈Fh_1, \dots, h_p \in \mathcal{F} with F⊂⋃rB(hr,ε/3)\mathcal{F} \subset \bigcup_r B(h_r, \eps/3). Each hrh_r is uniformly continuous; let δ\delta be the minimum of the pp values of δ\delta corresponding to ε/3\eps/3. If f∈Ff \in \mathcal{F} is at distance less than ε/3\eps/3 from hrh_r and d(x,y)<δd(x, y) < \delta, then ∣f(x)−f(y)∣≤ε/3+∣hr(x)−hr(y)∣+ε/3<ε\abs{f(x) - f(y)} \le \eps/3 + \abs{h_r(x) - h_r(y)} + \eps/3 < \eps.

∎

Three uses you will see later:

  • Existence of ODE solutions (Peano). If F\vb{F} is only continuous, without Picard–Lindelöf’s Lipschitz condition, Euler polygonal approximations with decreasing step are uniformly bounded and equi-Lipschitz. Arzelà–Ascoli gives a uniformly convergent subsequence, and the integral theorem lets us pass to the limit in x(t)=x0+∫0tF(x(s)) ⁣ds\vb{x}(t) = \vb{x}_0 + \int_0^t \vb{F}(\vb{x}(s)) \dd s. A solution exists, though it may not be unique.
  • Existence of minimizers. If a model class H\mathcal{H} is compact in C(K)C(K) and the loss is continuous with respect to ∥⋅∥∞\norm{\cdot}_\infty, the extreme value theorem gives an attained minimum. The LL-Lipschitz functions from a compact set into [−B,B][-B, B] form a compact class, as does the class of networks with fixed architecture, bounded weights and Lipschitz activations (it is the continuous image of a compact parameter set and is equi-Lipschitz).
  • Generalization. Qualitative compactness has a quantitative version, covering numbers: how many balls of radius ε\eps are needed to cover the class. For 1-Lipschitz functions from [0,1]d[0, 1]^d into [0,1][0, 1], Kolmogorov and Tikhomirov (1959) proved that the logarithm of that number grows like ε−d\eps^{-d}. This is the curse of dimensionality in exact form: describing an arbitrary Lipschitz function with accuracy ε\eps requires on the order of ε−d\eps^{-d} bits.

Toward learning: density, speed and norm

Gather the above in the language you will use. A model class H⊂C(K)\mathcal{H} \subset C(K) is dense if for every f∈C(K)f \in C(K) and every ε>0\eps > 0 there is h∈Hh \in \mathcal{H} with ∥h−f∥∞<ε\norm{h - f}_\infty < \eps. Weierstrass says polynomials are dense; Stone–Weierstrass, that cosine networks are too; Cybenko, sigmoid networks. Three cautions this lesson lets us state precisely:

  1. Density is not speed. What matters in practice is how many parameters are needed for a given ε\eps, depending both on regularity of ff (in Bernstein, 1/n1/\sqrt{n} at a peak, 1/n1/n for a smooth function) and on the method (Chebyshev, geometric for analytic functions).
  2. The norm determines what is approximated. A model uniformly close to the target can have derivatives arbitrarily far away, and the guarantee applies only inside KK: outside the compact set there is none (extrapolation is another problem).
  3. Existence is not finding. Good weights existing does not say how to reach them with finite data and gradient descent. That is the subject of optimization and learning theory.

Implementation from scratch

First, Bernstein polynomials with stable evaluation. The direct formula has two numerical problems: (nk)\binom{n}{k} overflows float64 once nn exceeds about a thousand, and xk(1−x)n−kx^k(1 - x)^{n-k} underflows below 10−30810^{-308} much earlier. Both are solved by calculating each weight’s logarithm and exponentiating at the end: the product of a huge and a tiny number is moderate.

[ ]Stable Bernstein evaluation and its uniform errorBrowser
import math
import numpy as np

def bernstein(f, n, x):
    """B_n f en los puntos x. Pesos binomiales en escala logarítmica: sin desbordamientos."""
    x = np.asarray(x, dtype=float)
    k = np.arange(n + 1)
    logC = np.array([math.lgamma(n + 1) - math.lgamma(j + 1) - math.lgamma(n - j + 1) for j in range(n + 1)])
    with np.errstate(divide="ignore", invalid="ignore"):   # log(0) = -inf es justo lo que queremos
        L = (logC
             + np.where(k > 0, k * np.log(x)[:, None], 0.0)
             + np.where(k < n, (n - k) * np.log1p(-x)[:, None], 0.0))
    return np.exp(L) @ f(k / n)

# el camino directo falla antes de lo que parece
try:
    float(math.comb(1100, 550))
except OverflowError as e:
    print("comb(1100, 550) en float64:", e)

x = np.linspace(0, 1, 2001)
cuadrado = lambda t: t**2
print("B_10(x^2) = x^2 + x(1-x)/10:", np.allclose(bernstein(cuadrado, 10, x), x**2 + x * (1 - x) / 10))

funciones = {
    "suave  sin(2πx)":    (lambda t: np.sin(2 * np.pi * t), "C^∞"),
    "pico   |x - 1/2|":   (lambda t: np.abs(t - 0.5), "Lipschitz"),
    "cúspide √|x - 1/2|": (lambda t: np.sqrt(np.abs(t - 0.5)), "Hölder 1/2"),
}
ns = np.array([16, 32, 64, 128, 256, 512])
errores = {}
for nombre, (f, clase) in funciones.items():
    e = np.array([np.max(np.abs(bernstein(f, n, x) - f(x))) for n in ns])
    errores[nombre] = e
    pendiente = np.polyfit(np.log(ns), np.log(e), 1)[0]
    print(f"{nombre:20s} ({clase:10s}) error en n=512: {e[-1]:.2e}   pendiente log-log: {pendiente:.3f}")

# las cotas del teorema
e_pico = errores["pico   |x - 1/2|"]
print("\npico: error · 2√n (cota 1):          ", np.round(e_pico * 2 * np.sqrt(ns), 3))
e_suave = errores["suave  sin(2πx)"]
print("suave: error · 8n/‖f''‖ (cota 1):     ", np.round(e_suave * 8 * ns / (4 * np.pi**2), 3))
print("suave: n · error (Voronovskaya: 3.943):", np.round(ns * e_suave, 3))

The slopes are −0.97-0.97, −0.50-0.50 and −0.23-0.23, near the theoretical −1-1, −1/2-1/2 and −1/4-1/4 (the cusp’s approaches −1/4-1/4 slowly, from above). The theorem’s bounds hold with moderate slack: peak error is about 0.80.8 times the bound 1/(2n)1/(2\sqrt n), and its ratio to it tends to 2/2π≈0.802/\sqrt{2\pi} \approx 0.80; smooth-function error is 0.80.8 times the bound ∥f′′∥∞/(8n)\norm{f''}_\infty/(8n), and nn times the error approaches Voronovskaya’s constant, 3.9433.943.

Now the visual log-log comparison with reference lines:

[ ]The rate depends on regularityBrowser
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(6.4, 4))
for nombre, e in errores.items():
    ax.loglog(ns, e, "o-", label=nombre.split()[0])
ax.loglog(ns, 2.0 / ns, "k--", lw=1, label="∝ 1/n")
ax.loglog(ns, 0.4 / np.sqrt(ns), "k:", lw=1, label="∝ 1/√n")
ax.loglog(ns, 0.55 / ns**0.25, "k-.", lw=1, label="∝ n^(-1/4)")
ax.set_xlabel("grado n"); ax.set_ylabel("‖B_n f − f‖∞"); ax.legend(); ax.grid(True, which="both", alpha=0.3)
plt.show()

Interchanging limits in practice

With sympy you can check exactly when the limit of integrals agrees with the integral of the limit. The three sequences tend to 0 at every x∈(0,1)x \in (0, 1):

[ ]Limit of the integral versus integral of the limitBrowser
import sympy as sp

n = sp.Symbol("n", positive=True, integer=True)
x = sp.Symbol("x", positive=True)
casos = {
    "x^n":            x**n,
    "n x e^(-n x^2)": n * x * sp.exp(-n * x**2),
    "n^2 x e^(-n x)": n**2 * x * sp.exp(-n * x),
}
for nombre, fn in casos.items():
    I = sp.integrate(fn, (x, 0, 1))
    print(f"{nombre:15s} ∫_0^1 f_n = {sp.simplify(I)}   ->   {sp.limit(I, n, sp.oo)}   (integral del límite: 0)")

# ¿dónde está el problema? en el supremo
g = n * x * sp.exp(-n * x**2)
x_max = sp.solve(sp.diff(g, x), x)[0]
print("\nmáximo de n x e^(-n x^2):", x_max, "  valor:", sp.simplify(g.subs(x, x_max)))

The last two violate interchange and the first does not, although none converges uniformly on [0,1][0, 1]; xnx^n is saved by domination by the constant 1. The second’s maximum is 2n e−1/2/2=n/2 e−1/2\sqrt{2}\sqrt{n}\,e^{-1/2}/2 = \sqrt{n/2}\,e^{-1/2}, as calculated by hand. Now the M-test: for ∑ksin⁡(kx)/k2\sum_k \sin(kx)/k^2, the uniform distance between two partial sums is bounded by the corresponding part of ∑1/k2\sum 1/k^2. And the bump, integrated numerically with quad:

[ ]The M-test and the persistent bumpBrowser
import numpy as np
from scipy.integrate import quad

print("  N    sup|S_2N - S_N|   cota Σ_{N<k≤2N} 1/k²   cociente   dónde (N·x)")
for N in [10, 100, 1000]:
    k = np.arange(N + 1, 2 * N + 1)
    # la serie es impar y 2π-periódica: basta [0, π]. El pico de la diferencia tiene anchura
    # del orden de 1/N, así que se añade una rejilla fina en [0, 5/N] (una uniforme gruesa no lo vería)
    xs = np.union1d(np.linspace(0, np.pi, 2001), np.linspace(0, 5 / N, 2001))
    dif = np.abs(np.sin(np.outer(xs, k)) @ (1 / k**2))      # |S_2N(x) - S_N(x)|
    cota = np.sum(1 / k**2)
    print(f"{N:5d}   {dif.max():.3e}         {cota:.3e}             {dif.max() / cota:.3f}      {N * xs[dif.argmax()]:.2f}")

print("\nserie derivada Σ cos(kx)/k en x = 0 (armónica):",
      [round(float(np.sum(1 / np.arange(1, N + 1))), 3) for N in (10, 100, 1000)])

def joroba(m, t):
    a, c, b = 1 / m, 2 / m, 3 / m
    if t <= a or t >= b:
        return 0.0
    return m * m * (t - a) if t <= c else m * m * (b - t)

print("\n   m   ∫ h_m     h_m(0.05)   sup h_m")
for m in [3, 10, 30, 50, 100, 1000]:
    area = quad(lambda t: joroba(m, t), 0, 1, points=[1 / m, 2 / m, 3 / m])[0]
    print(f"{m:5d}   {area:.6f}   {joroba(m, 0.05):.3f}       {m}")

The M-test bound is almost exact for this series: the actual supremum is 95 %95\,\% of the bound, attained near x≈1.09/Nx \approx 1.09/N, where all tail sines are still positive (kx∈[1.09,2.18]kx \in [1.09, 2.18]) and there are no cancellations. Because the peak has width of order 1/N1/N, a fixed uniform grid would miss it for large NN: measuring a supremum numerically requires looking where the function changes rapidly. At x=0.05x = 0.05, the bump has not arrived yet for m≤20m \le 20, passes over it for 20<m<6020 < m < 60 and from m=60m = 60 onward is 0 forever; meanwhile its area remains 1.

With libraries: Chebyshev as a contrast

numpy.polynomial.chebyshev.Chebyshev.interpolate(f, deg, domain=[a, b]) constructs the degree-deg polynomial interpolating ff at the interval’s first-kind Chebyshev nodes, clustered near the endpoints. This is the reference method for polynomial approximation (you will see it in detail in Runge’s phenomenon and m09 interpolation). Compare it with Bernstein at the same degree:

[ ]Bernstein versus ChebyshevBrowser
import numpy as np
from numpy.polynomial import Chebyshev

x = np.linspace(0, 1, 2001)
print(f"{'función':20s} {'grado':>5s} {'Bernstein':>11s} {'Chebyshev':>11s}")
for nombre, (f, _) in funciones.items():
    for d in (8, 32, 128):
        eb = np.max(np.abs(bernstein(f, d, x) - f(x)))
        ec = np.max(np.abs(Chebyshev.interpolate(f, d, domain=[0, 1])(x) - f(x)))
        print(f"{nombre:20s} {d:5d} {eb:11.2e} {ec:11.2e}")

# ¿qué grado hace falta para un error de 1e-6 en sin(2πx)?
f = funciones["suave  sin(2πx)"][0]
d = next(d for d in range(1, 60) if np.max(np.abs(Chebyshev.interpolate(f, d, domain=[0, 1])(x) - f(x))) < 1e-6)
print(f"\nsin(2πx): Chebyshev necesita grado {d}; Bernstein, del orden de 3.943 / 1e-6 ≈ {3.943e6:.1e}")

For the analytic function, Chebyshev reaches machine roundoff at degree 32, while Bernstein remains at 10−110^{-1}; for the peak, Chebyshev goes like 1/n1/n and Bernstein like 1/n1/\sqrt{n}. Bernstein has two virtues Chebyshev lacks: it is a positive operator (if f≥0f \ge 0, Bnf≥0B_n f \ge 0) and preserves monotonicity and convexity of ff, properties making it useful in computer graphics (Bézier curves are Bernstein polynomials) and when an approximation must respect shape constraints.

Common mistakes

Exercises

ProofThe uniform limit of continuous functions is continuous
Prove: If fn:[a,b]→Rf_n: [a, b] \to \R are continuous and fn→ff_n \to f uniformly on [a,b][a, b], then ff is continuous at [a,b][a, b].
0
Fix x0∈[a,b]x_0 \in [a, b] and ε>0\eps > 0. Find δ>0\delta > 0 such that ∣x−x0∣<δ\abs{x - x_0} < \delta implies ∣f(x)−f(x0)∣<ε\abs{f(x) - f(x_0)} < \eps.

Step 1 of 3. What is the first step?

NumericA uniform distance
Calculate ∥f20−0∥∞\norm{f_{20} - 0}_\infty on [0,0.9][0, 0.9] for fn(x)=xnf_n(x) = x^n, that is, sup⁡x∈[0,0.9]x20\sup_{x \in [0, 0.9]} x^{20}. Give four decimal places.
QuizUniform or only pointwise?
Which of these sequences converge uniformly to their pointwise limit on the indicated set?

More than one answer may be correct.

NumericThe growing peak
For fn(x)=nxe−nx2f_n(x) = n x e^{-n x^2}, calculate ∥f50∥∞\norm{f_{50}}_\infty on [0,1][0, 1].
NumericBernstein error for x²
Calculate ∥B50f−f∥∞\norm{B_{50}f - f}_\infty on [0,1][0, 1] for f(x)=x2f(x) = x^2.
NumericWhat degree does the bound guarantee?
ff is 1-Lipschitz on [0,1][0, 1]. What is the smallest nn for which the theorem's bound L/(2n)L/(2\sqrt{n}) guarantees ∥Bnf−f∥∞≤0.01\norm{B_n f - f}_\infty \le 0.01?
ProofPower series and the M-test
Prove: If ∑kakxk\sum_k a_k x^k has convergence radius R>0R > 0 and 0<r<R0 < r < R, the series converges absolutely and uniformly on [−r,r][-r, r].
0
Find constants MkM_k with ∣akxk∣≤Mk\abs{a_k x^k} \le M_k on [−r,r][-r, r] and ∑Mk<∞\sum M_k < \infty.

Step 1 of 3. Which bound do you use?

QuizWhich families are compact?
Which families are relatively compact in (C[0,1],∥⋅∥∞)(C[0, 1], \norm{\cdot}_\infty), that is, which have the property that every sequence has a uniformly convergent subsequence?

More than one answer may be correct.

QuizWhat passes to the limit
Let fn∈C1[a,b]f_n \in C^1[a, b] with fn→ff_n \to f uniformly on [a,b][a, b]. What can be guaranteed?

More than one answer may be correct.

CodeBernstein and its convergence exponent
Implement three functions. bernstein(f, n, x) returns BnfB_n f evaluated at the array x of points in [0,1][0, 1]; f accepts arrays. It must work without overflow for nn in the thousands (calculate weights on a logarithmic scale with math.lgamma). sup_error(f, n, m=2001) returns max⁡∣Bnf−f∣\max\abs{B_n f - f} on a uniform grid of m points in [0,1][0, 1]. exponente(f, ns) returns the least-squares slope of log⁡\log sup_error versus log⁡n\log n for the degrees in list ns.
import math
import numpy as np

def bernstein(f, n, x):
  """B_n f evaluado en el array x (puntos de [0, 1])."""
  x = np.asarray(x, dtype=float)
  # tu código: pesos binomiales C(n,k) x^k (1-x)^(n-k) en escala logarítmica
  return np.zeros_like(x)

def sup_error(f, n, m=2001):
  """max |B_n f - f| en una rejilla uniforme de m puntos de [0, 1]."""
  # tu código
  return 0.0

def exponente(f, ns):
  """Pendiente de log(sup_error) frente a log(n), por mínimos cuadrados."""
  # tu código
  return 0.0
Shift+Enter to run

Summary

Key idea
Uniform convergence is convergence in the supremum norm: the entire graph of fnf_n enters a tube of radius ε\eps around the limit. This notion preserves continuity and the integral (not the derivative), makes C[a,b]C[a, b] a complete space, and is the norm in which approximation theorems are stated, from Weierstrass to universal approximation.
  • Pointwise and uniform convergence differ by quantifier order: N(ε,x)N(\eps, x) versus N(ε)N(\eps). In practice, calculate the pointwise limit ff and check whether ∥fn−f∥∞→0\norm{f_n - f}_\infty \to 0.
  • The uniform limit of continuous functions is continuous (ε/3\eps/3 argument), and (C[a,b],∥⋅∥∞)(C[a, b], \norm{\cdot}_\infty) is complete. With ∥⋅∥1\norm{\cdot}_1 or ∥⋅∥2\norm{\cdot}_2, it is not.
  • Uniform convergence allows interchange of limit and integral, but not limit and derivative: that needs uniform convergence of derivatives. The M-test gives uniformity for series, with an explicit tail bound.
  • Power series converge uniformly on each [−r,r][-r, r] with r<Rr < R, so can be differentiated and integrated term by term and are C∞C^\infty.
  • Weierstrass: polynomials are dense in C[a,b]C[a, b]. Bernstein proves this with Bnf(x)=E[f(Sn/n)]B_n f(x) = \E[f(S_n/n)], with error O(1/n)\bigO(1/\sqrt{n}) for Lipschitz functions and O(1/n)\bigO(1/n) for C2C^2, never improving on 1/n1/n. Density is not efficiency: Chebyshev is exponentially better for analytic functions.
  • Arzelà–Ascoli: on a compact set, a family is relatively compact if and only if uniformly bounded and equicontinuous. It gives existence of ODE solutions and minimizers and, quantified by covering numbers, controls generalization.