Interactive tool

Taylor polynomial explorer

Raise the degree of a Taylor polynomial, move its center and see where the polynomial follows the function and where it breaks away.

Pick a function, then set the degree nn and the center aa. The curve in the text color is the function, and the colored curve is its Taylor polynomial TnT_n. Move the point xx with the slider or by dragging across the graph, and the readouts compare Tn(x)T_n(x) with the true value f(x)f(x). The shaded band is the interval where the full Taylor series converges. For exe^x, sin⁡x\sin x and cos⁡x\cos x the series converges everywhere, so there is no band.

Radius of convergenceR = ∞
−3−2−1123−11234567xy
3
0
1

You can also drag across the graph

T₃(1)
2.6666667
f(1)
2.7182818
Error f(x) − Tn(x)
0.0516152
Taylor polynomial
T₃(x) = 1 + x + x²/2 + x³/6

Things to try

  • With exe^x centered at 00, set x=1x = 1 and raise the degree one step at a time. The polynomial value climbs toward e=2.7182818e = 2.7182818, and by degree 1010 the error is down to about 2.73×10−82.73 \times 10^{-8}.
  • Switch to sin⁡x\sin x centered at 00 and go from degree 33 to degree 44. Nothing moves, because sine has no even powers in its series. Keep raising the degree and the polynomial follows the curve across a wider stretch each time. Even at degree 1515 it misses sin⁡6.5\sin 6.5 by about 0.160.16.
  • Pick ln⁡(1+x)\ln(1 + x), set x=1.5x = 1.5 and raise the degree. From degree 22 on, every step makes the error larger, because 1.51.5 lies outside the band. Back at x=0.5x = 0.5 the error shrinks with every step.
  • Stay with ln⁡(1+x)\ln(1 + x) at x=1x = 1, the right end of the band. The series still converges there, but slowly. At degree 1515 the error is still about 0.030.03.
  • Try 11+x2\frac{1}{1 + x^2} at x=1.5x = 1.5. The function is smooth on the whole real line, yet the band stops at 11 and the error grows with the degree. Now move the center to a=1a = 1. The radius becomes 2≈1.414\sqrt{2} \approx 1.414, the band now covers 1.51.5, and the error shrinks instead.
  • With 1+x\sqrt{1 + x} centered at 00, compare x=1x = 1 with x=2x = 2. At x=1x = 1 the error shrinks slowly toward 00. At x=2x = 2 it grows with every step from degree 22 on.
  • Keep the degree fixed at 33 and move the center of exe^x toward the point. At x=1x = 1 the error is about 0.0520.052 with a=0a = 0 and about 0.00480.0048 with a=0.5a = 0.5.

What you are seeing

The Taylor polynomial of degree nn centered at aa matches ff and its first nn derivatives at aa.

Tn(x)=∑k=0nf(k)(a)k!(x−a)kT_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!} (x - a)^k

The explorer computes every coefficient from an exact formula for the derivatives. For example, every derivative of exe^x is exe^x, and the derivatives of ln⁡(1+x)\ln(1 + x) are

dkdxkln⁡(1+x)=(−1)k−1(k−1)!(1+x)k,k≥1.\frac{d^k}{dx^k} \ln(1 + x) = \frac{(-1)^{k-1} (k - 1)!}{(1 + x)^k}, \qquad k \ge 1.

At a=0a = 0 the readout writes the coefficients as exact fractions, and at other centers it rounds them to four decimals. Past degree 66 it shows the first terms only.

The error readout is the remainder Rn(x)=f(x)−Tn(x)R_n(x) = f(x) - T_n(x). Taylor’s theorem says it has the same shape as the next term, with the derivative taken at some zz between aa and xx.

Rn(x)=f(n+1)(z)(n+1)!(x−a)n+1R_n(x) = \frac{f^{(n+1)}(z)}{(n + 1)!} (x - a)^{n+1}

The factor (x−a)n+1(x - a)^{n+1} is why the error shrinks so fast near the center and why moving the center closer to xx helps.

The band is the interval (a−R,a+R)(a - R, a + R), where RR is the radius of convergence of the full series. For ln⁡(1+x)\ln(1 + x) and 1+x\sqrt{1 + x} the series reaches only as far as the trouble at x=−1x = -1, so R=1+aR = 1 + a. For 11+x2\frac{1}{1 + x^2} nothing goes wrong on the real line. The trouble sits at the complex numbers ±i\pm i, where 1+x2=01 + x^2 = 0, and the radius is the distance from aa to them.

R=1+a2R = \sqrt{1 + a^2}

Inside the band the error goes to 00 as the degree grows. Outside it the terms of the series grow, and the polynomials swing further from the function with every degree. The curve of TnT_n is cut off at the edges of the window when it runs off the graph.

The series and the remainder bounds are on the calculus reference sheet, and the videos are on the Calculus course page.