Calculus · Taylor remainder

Taylor remainder

The Taylor remainder Rₙ(x) = f(x) − Pₙ(x) is the error of the degree-n Taylor polynomial. Knowing an upper bound for |f⁽ⁿ⁺¹⁾| between a and x is enough to bound the error, without knowing f(x).

The Taylor remainder in this visualization

A Taylor polynomial PnP_n matches a function ff and its first nn derivatives at the centre aa. The remainder Rn(x)=f(x)−Pn(x)R_n(x) = f(x) - P_n(x) is its error: the yellow bar at the point xx, from the polynomial to the curve. Taylor’s theorem describes it with one more derivative. If x≠ax \ne a and ff has a continuous (n+1)(n + 1)-th derivative on an interval containing both, the remainder looks like the next term of the series, except that the derivative is taken at some point ξ\xi strictly between them instead of at aa; at x=ax = a the remainder is 0.

The remainder in Lagrange’s form, and the bound it gives
Rn(x)=f(n+1)(ξ)(n+1)!(x−a)n+1,∣Rn(x)∣≤M ∣x−a∣n+1(n+1)!R_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!}(x-a)^{n+1}, \qquad |R_n(x)| \le \frac{M\,|x-a|^{n+1}}{(n+1)!}

Where ξ comes from

For n=0n = 0 the formula reads f(x)−f(a)=f′(ξ)(x−a)f(x) - f(a) = f'(\xi)(x - a): the mean value theorem. The general case is proved the same way, by applying the mean value theorem, in Cauchy’s form, to the error as the centre slides from aa to xx. Like the mean value theorem, it promises that such a ξ\xi exists, not where it is. Turn on Where ξ is: the strip below draws f(n+1)f^{(n+1)}, and the yellow level cc is the value it must take for the formula to give the actual error. The ◆ marks one point in the shaded stretch where the curve crosses that level (there can be more than one). Drag xx or change nn and it moves.

A bound you can compute

Usually you want the size of the error without knowing f(x)f(x), since that is what the polynomial was for. You don’t know ξ\xi, but you can replace ∣f(n+1)(ξ)∣|f^{(n+1)}(\xi)| by MM, the largest value of ∣f(n+1)∣|f^{(n+1)}| anywhere between aa and xx. That gives the Lagrange error bound. The shaded band is this bound drawn around PnP_n at every point, and ff stays inside it. Three things set its width: MM, which changes with nn and with how far the stretch reaches, the distance from aa raised to the power n+1n + 1, and the factorial. Near aa the band is thin and further out it widens; an extra term narrows it only when the factorial outgrows the other two.

How many terms, and how cautious

To guarantee an accuracy, look for the smallest order whose bound is below it. The bound can also be far above the real error: for ln⁡(1+x)\ln(1 + x) about 0, the derivatives ∣f(n+1)(t)∣=n!/(1+t)n+1|f^{(n+1)}(t)| = n!/(1 + t)^{n+1} are largest at the end nearest −1-1; the bound works out to (∣x∣/(1+x))n+1/(n+1)(|x|/(1 + x))^{n+1}/(n + 1), which for −1<x<−1/2-1 < x < -1/2 grows with nn even though the series converges there. A bound that fails to shrink only means the estimate is too rough to show convergence.

Things to notice

  • For sin⁡x\sin x about 0, P3=P4P_3 = P_4 because the x4x^4 term is zero. So the bound for n=4n = 4, with 5!5! underneath, also holds for P3P_3.
  • Textbooks often use a simpler MM: 1 for sine and cosine, 3 for exe^x on [0,1][0, 1]. Any number at least as large as the true maximum gives a valid, looser bound.

Controls

  • Press the x-axis, or drag the handle or the yellow bar, to move the point x. The order wheel raises or lowers the order by one.
  • The centre a changes in its field.

Related