Calculus · Taylor series

Taylor series

A Taylor series uses the derivatives at a point to build successive polynomial approximations. Add terms and move the center to explore where the approximation improves and where the series stops converging.

01

Taylor series in this visualization

The Taylor series (Taylor expansion) of a function ff at a point aa is the power series built from its derivatives there; at a=0a = 0 it is also called the Maclaurin series. The center is also written x0x_0. Its partial sum of degree nn is the Taylor polynomial PnP_n, the only polynomial of degree at most nn whose value and first nn derivatives at aa equal those of ff:

Taylor polynomial
Pn(x)=∑k=0nf(k)(a)k! (x−a)k.P_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}\,(x-a)^k.

The ink curve is ff, the yellow curve is PnP_n, and the blue point marks the center aa. The yellow bar on the xx-axis is a measurement: the widest interval ∣x−a∣<r|x - a| < r on which ∣f(x)−Pn(x)∣<0.01|f(x) - P_n(x)| < 0.01, found by checking points 0.0025 apart on both sides of aa and refining the first miss, and shown rounded down. The blue brackets sit at a±Ra \pm R, where R is the radius of convergence: the series converges for ∣x−a∣<R|x - a| < R and diverges for ∣x−a∣>R|x - a| > R. For the seven functions here, the sum inside that interval is ff itself, and RR is the distance from aa to the nearest point where ff breaks down, a complex point included.

How far PnP_n is from ff at a given xx is measured by the remainder. If ff has n+1n + 1 derivatives on the whole interval between aa and xx (so that interval must not cross a singularity, such as the pole of 1/(1−x)1/(1 - x) at 1), then

Remainder (Lagrange form)
f(x)−Pn(x)=f(n+1)(ξ)(n+1)! (x−a)n+1for some ξ between a and x.f(x) - P_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!}\,(x-a)^{n+1}\quad\text{for some } \xi \text{ between } a \text{ and } x.
02

Things to notice

  • Inside the radius the partial sums converge to ff here, so at each such xx the error tends to 0 as nn grows, though not necessarily at every single step. Outside it the terms do not tend to 0 and Pn(x)P_n(x) does not settle. The bar only approaches RR: it is measured on the screen, while RR comes from the formula.
  • A function can be smooth on the whole real line and still have a finite radius. 1/(1+x2)1/(1 + x^2) is undefined at the complex points ±i\pm i, so its series about aa converges only for ∣x−a∣<1+a2|x - a| < \sqrt{1 + a^2}.
  • At the ends of the interval anything can happen: the series of ln⁡(1+x)\ln(1 + x) at 0 converges at x=1x = 1 (to ln⁡2\ln 2) but not at x=−1x = -1; that of 1/(1−x)1/(1 - x) converges at neither end, that of 1+x\sqrt{1 + x} at both.
  • At a=0a = 0, sin⁡x\sin x has only odd powers and cos⁡x\cos x only even ones, so P2mP_{2m} and P2m−1P_{2m-1} of the sine are the same polynomial. n → ∞ skips such zero terms, so every step changes the curve.
  • Convergence alone does not make the sum equal ff. The function equal to e−1/x2e^{-1/x^2} for x≠0x \ne 0 and 0 at 0 has every derivative 0 at 0, so its Taylor series there is 0 for all xx.
03

Where it is used

  • Physics keeps the first terms near a point: sin⁡θ≈θ\sin\theta \approx \theta for a pendulum’s small swings, and (1−v2/c2)−1/2≈1+v2/(2c2)(1 - v^2/c^2)^{-1/2} \approx 1 + v^2/(2c^2) turns relativistic kinetic energy into 12mv2\tfrac12 mv^2 at low speeds.
  • The remainder tells how many terms a computation needs: summing 1/k!1/k! from k=0k = 0 to 1010, which is P10(1)P_{10}(1) for exe^x, already gives ee to within 3×10−83 \times 10^{-8}.
04

Controls

  • Turn the Degree knob, or press n → ∞ to add the next non-zero term, one at a time, up to n=30n = 30 (pressing again at the top replays from 0). Drag the blue point or the marker on the axis to move the center; the key centers jump to exact values.
  • The strip below the graph shows ∣f−Pn∣|f - P_n| on a logarithmic scale across the graph. Presentation mode opens a full-screen view for projectors (Space adds terms, ← → change the degree, H hides the radius).
05

Related