We just saw that any polynomial Pn(x) approximates a function f(x) from a finite-dimensional subspace. Two fundamental results tell us how good that approximation can be: the Weierstrass Approximation Theorem guarantees it can be made arbitrarily precise, and the Taylor Series gives us a concrete method for constructing such approximations.
Weierstrass Approximation Theorem (1885)
Theorem 2.1 (Weierstrass, 1885). For any f∈C([0,1]) and any ε>0, there exists a polynomial p(x) such that:
max0≤x≤1∣f(x)−p(x)∣≤ε
In plain terms: any continuous function on a closed interval can be approximated to within any desired accuracy by a polynomial of sufficiently high degree.
The Error Trade-off
If we have f(x)=2+3x+4x2+5x3+8x4 but can only afford P2(x)=a0+a1x+a2x2, we inevitably carry error from the dropped higher-degree terms.
The key principle is: higher degree → lower error. As n increases, the polynomial can track f(x) more closely:
as n↑∣f(x)−Pn(x)∣↓
Taylor Series
The Taylor Series transforms the intuition behind a tangent-line approximation into a precise, high-order polynomial expansion.
Motivation: The Tangent-Line Approximation
Given a point x0 and the value f(x0), suppose we also know the gradient f′(x0). The tangent line at x0 gives a first-order approximation:
As the figure shows, the tangent line accurately predicts the function’s value near x0. However, as we move to a farther point x, the curve bends away from the straight line, introducing an approximation error.
This tangent line is exact only for linear functions. To do better and close that error gap, we must also include curvature f′′(x0), then the rate of change of curvature f′′′(x0), and so on, giving the full Taylor Series.
The last term Rn is the truncation error, the price paid for stopping at degree n. It is never zero for non-polynomial functions, but it can always be bounded.
Here, ξ is some point between x0 and x. We don’t know exactly where, but we know it exists.If we had actually known the point, we could’ve found the exact value of error in the first place! We can at best, find the maximum possible value of ξ, and thus ∣Rn∣. This allows us to bound the error without needing to know the exact value of ξ.
Bounding the Error for sin(x) at x=0.1
Using p6(x)=x−3!x3+5!x5, the 7th derivative of sin(x) is −cos(x).
In other words, if we take just the first three terms of the Taylor expansion, we can guarantee that our approximation is accurate to within 2×10−11 , an incredibly tight bound!