Taylor Polynomial Error and Lagrange Remainder
Apply the Lagrange Error Bound to estimate the maximum error in approximating f(x) with a Taylor polynomial. Determine the degree needed to achieve a desired accuracy and apply to AP-style estimation problems.
A lesson of AP Calculus BC, in Infinite Sequences and Series, about 10 minutes.
Taylor Polynomials and the Lagrange Error Bound
By the end of this lesson, you will be able to construct Taylor polynomials, use them to approximate function values, and bound the approximation error.
Taylor Polynomials
The nth-degree Taylor polynomial of $f$ centered at $a$ is:
$$P_n(x) = \sum_{k=0}^n \frac{f^{(k)}(a)}{k!}(x-a)^k = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots + \frac{f^{(n)}(a)}{n!}(x-a)^n$$
$P_n(x)$ is the best degree-$n$ polynomial approximation to $f$ near $x = a$.
Note: the linearization $L(x) = f(a) + f'(a)(x-a)$ is just $P_1(x)$.
Computing Taylor Polynomials
Example: Find $P_3(x)$ for $f(x) = e^x$ centered at $a = 0$ (Maclaurin polynomial).
$f(x) = e^x$; $f'(x) = e^x$; $f''(x) = e^x$; $f'''(x) = e^x$
$f(0) = f'(0) = f''(0) = f'''(0) = 1$
$P_3(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6}$
Approximation: $e^{0.1} \approx P_3(0.1) = 1 + 0.1 + 0.005 + 0.000167 = 1.105167$
Actual: $e^{0.1} \approx 1.10517$ ✓
The Remainder (Error) Term
The actual function value equals the Taylor polynomial plus an error:
$$f(x) = P_n(x) + R_n(x)$$
where $R_n(x) = f(x) - P_n(x)$ is the remainder (error).
Lagrange Error Bound
If $|f^{(n+1)}(t)| \leq M$ for all $t$ between $a$ and $x$, then:
$$|R_n(x)| = |f(x) - P_n(x)| \leq \frac{M}{(n+1)!}|x-a|^{n+1}$$
Interpretation: the error is bounded by a quantity involving the maximum of the $(n+1)$th derivative, $|x-a|^{n+1}$, and $(n+1)!$.
Applying the Lagrange Error Bound
Example: Use $P_3(x) = 1 + x + x^2/2 + x^3/6$ to approximate $e^{0.5}$. Bound the error.
$f^{(4)}(x) = e^x$; on $[0, 0.5]$: $|f^{(4)}(x)| \leq e^{0.5} < 2$ (since $e < 3$, $e^{0.5} < 2$). So $M = 2$.
$$|R_3(0.5)| \leq \frac{2}{4!}(0.5)^4 = \frac{2}{24}\cdot\frac{1}{16} = \frac{1}{192} \approx 0.0052$$
Actual error: $|e^{0.5} - P_3(0.5)| \approx |1.6487 - 1.6458| = 0.0029 < 0.0052$ ✓
Using the Bound in Reverse
How many terms needed for a given accuracy?
Find $n$ such that $\frac{M}{(n+1)!}|x-a|^{n+1} < \epsilon$ (desired accuracy).