Chalk−1

Math · Calculus II · Concept

Taylor polynomials and Taylor series

A Taylor polynomial of degree n is the polynomial whose value and first n derivatives at a center a match a function’s. Near a it approximates the function, and each added term improves the fit. Letting n grow gives the Taylor series, called a Maclaurin series when centered at 0. Taylor’s remainder bounds the error of the polynomial, and the ratio test finds the interval where the series converges.

A concrete case

Approximate cos0.5 from what happens at 0

A calculator gives cos0.5=0.877583 to six places. Suppose all you know about cosx is how it behaves at 0. Its height there is 1, its slope is 0, and it bends downward.

The height alone guesses 1, which is off by 0.122. The slope adds nothing, because the tangent line at 0 is flat. The bending is what is missing. Subtracting half of 0.52, which is 0.125, bends the guess down to 0.875, off by only 0.0026. One more term, 0.54/24≈0.0026, brings it to 0.877604, off by 0.00002.

Each step used one more derivative of cosx at 0, and each cut the error sharply. Adding powers of x with the right coefficients makes a polynomial that hugs the curve near the center. That polynomial is a Taylor polynomial.

cos0.5≈1−0.522+0.5424=0.877604
cos0.5≈1−0.522+0.5424=0.877604
Approximations of cos0.5 built from the derivatives at 0
What is matched at 0ApproximationValue at 0.5Error
Height110.122
Height and slope1+0⁢x10.122
Up to the second derivative1−x2/20.8750.0026
Up to the fourth derivative1−x2/2+x4/240.8776040.00002

The rule

The Taylor polynomial

The Taylor polynomial of degree n of f centered at a is the polynomial Pn whose value and first n derivatives at a equal those of f. The center a is the point where everything is matched. f⁡(k)(a) is the kth derivative of f at a, with f⁡(0)=f. k! is k factorial, the product 1⋅2⋅⋯⋅k, with 0!=1.

Centered at a=0, the polynomial is also called a Maclaurin polynomial. For cosx at 0, the derivatives are 1, 0, −1, 0 and 1, which give 1−x2/2!+x4/4!, the polynomial of the concrete case.

Pn(x)=∑k=0nf⁡(k)(a)k!⁢(x−a)k

Taylor series

Letting the degree grow without bound gives the Taylor series of f at a, an infinite series in powers of x−a. A Taylor series centered at 0 is a Maclaurin series. Each Taylor polynomial is a partial sum of the series. Where the series converges to f⁡(x), adding more terms gives a better approximation.

f⁡(x)=∑k=0∞f⁡(k)(a)k!⁢(x−a)k

Why it works

Why the coefficients are f⁡(k)(a)⁢/⁢k!

Write a cubic in powers of x−a, P⁢(x) =c0+c1(x−a)+c2(x−a)2 +c3(x−a)3. Put x=a, and every term but c0 vanishes, so P⁢(a)=c0. Differentiate once to get P′(x) =c1+2c2(x−a) +3c3(x−a)2. At x=a only c1 survives. Differentiating again gives P′⁢′(a)=2c2, and once more gives P′⁢′⁢′(a)=6c3=3! c3.

Powers of x−a keep the conditions separate, because at x=a each derivative sees only one coefficient. Setting P(k)(a)=f⁡(k)(a) gives ck=f⁡(k)(a)⁢/⁢k!. The factorial is there because differentiating (x−a)k exactly k times leaves k!.

ck=f⁡(k)(a)k!
What each derivative of P sees at x=a
Derivative at aValueMatched with f
P⁢(a)c0c0 =f⁡(a)
P′(a)c1c1 =f′(a)
P′⁢′(a)2c2c2 =f′⁢′(a)⁢/2!
P′⁢′⁢′(a)6c3c3 =f′⁢′⁢′(a)⁢/3!

The method

Building a Taylor polynomial

Work in four steps. Differentiate f up to the degree you want. Evaluate each derivative at the center. Divide the kth value by k!. Multiply by (x−a)k and add the terms.

The table builds the degree-3 polynomial of lnx centered at a=1, where lnx is defined and smooth. At x=1.1 it gives 0.1−0.005+0.000333 =0.095333, while ln1.1=0.095310.

lnx≈(x−1)−(x−1)22+(x−1)33
The degree-3 Taylor polynomial of lnx at a=1
kf⁡(k)(x)f⁡(k)(1)Divided by k!Term
0lnx000
11⁢/⁢x11(x−1)
2−1⁢/x2−1−1⁢/2−(x−1)2/2
32⁢/x322⁢/6 =1⁢/3(x−1)3/3

Series to know

A few series come up so often that knowing them saves time. Each one follows from the formula, and each comes with the interval where it equals the function.

ex=∑n=0∞xnn!
Common Maclaurin series
FunctionSeriesEquals the function for
ex1+x+x2/2!+x3/3!+⋯every x
sinxx−x3/3!+x5/5!−⋯every x
cosx1−x2/2!+x4/4!−⋯every x
1⁢/⁢(1−x)1+x+x2+x3+⋯−1 <x <1
ln(1+x)x−x2/2+x3/3−⋯−1 <x ≤1

New series from old

Many series are quicker to build from one you know than from derivatives. Substituting −x2 for x in the series for ex gives e−x2 =1−x2+x4/2!−x6/3!+⋯. Multiplying the sine series by x gives xsinx=x2−x4/3!+⋯.

Inside the interval of convergence, a series can also be differentiated or integrated term by term. The derivative of the sine series is the cosine series. Integrating 1⁢/⁢(1+x2) =1−x2+x4−⋯ gives arctanx =x−x3/3+x5/5−⋯, which holds for −1≤x≤1.

e−x2=1−x2+x42!−x63!+⋯

How big the error can be

The error of Pn at x is f⁡(x)−Pn(x). Suppose the derivative of order n+1 of f stays within M in size between a and x. Then Taylor’s remainder bounds the error as shown below. The bound grows with the distance from the center and falls fast as the degree rises, because of the factorial.

For an alternating series whose terms shrink in size to 0, such as sinx near 0, the first term left out also bounds the error. A graph or a table of sampled errors is useful feedback, but it does not prove a bound.

∣⁢f⁡(x)−Pn(x)⁢∣≤M⁢∣⁢x−a∣n+1(n+1)!

Where a Taylor series converges

A power series in x−a converges on an interval centered at a. The ratio test finds its radius R, because the series converges where the limit of the ratio of consecutive terms is less than 1. At the endpoints, x=a−R and x=a+R, that limit is exactly 1 and the ratio test decides nothing. Each endpoint needs a test of its own.

Convergence alone does not mean the series equals the function. The remainder going to 0 is what proves it, and it does for ex, sinx and cosx at every x.

limn→∞|an+1an|<1

Where it breaks

Where it breaks

A Taylor polynomial is accurate near its center and can be poor far from it. The degree-2 polynomial of ex at 0 gives 1+3+4.5=8.5 at x=3, while e3≈20.09.

Outside its interval of convergence a series gives no value at all, even where the function is defined. 1+x+x2+⋯ equals 1⁢/⁢(1−x) only for −1<x<1. At x=2 the function equals −1, while the series 1+2+4+⋯ diverges. In the same way ln(1+x) is defined at x=2, and its series diverges there.

The function needs its derivatives at the center. x has no derivative at 0, so it has no Maclaurin series. Center it where it is smooth, such as a=4, instead.

A polynomial and a series are different objects. Degree n means stopping after the (x−a)n term, while the series keeps every term.

Check your answer

Check your answer

A Taylor polynomial promises to agree with f at the center and to stay close nearby, and both promises can be tested.

Check the center. P⁢(a) must equal f⁡(a), and P′(a) must equal f′(a). For cosx at 0, P⁢(0)=1=cos0, and P has no x term, which matches the slope 0.

Check a value. Compare P at a point near the center with a calculator. The error should be small, it should shrink when you add a term, and it should stay below the remainder bound.

Check the pattern. An odd function such as sinx has only odd powers, and an even one such as cosx has only even powers. The denominators should be factorials.

To have Chalk check the work, write it in a Math box. Put the function on the first row as f⁡(x)=…, then each derivative on its own row, f′(x)=…, f′⁢′(x)=…, f′⁢′⁢′(x)=…. The Checker marks each derivative ✓ or ✗. Then write the polynomial as P⁢(x)=… and its value as P⁢(0.2)=…. With the derivative rows above it, the row P⁢(x)=… is checked against f. The right polynomial reads ✓. A wrong one reads ✗ once the box shows the center, as with f⁡(0)=1 and f′(0)=1 above P⁢(x)=1+x+x2. Without a center it reads ?, because it might be right at another center. The value row after it is checked against the P above, so P⁢(0.2)=1.24 reads ✓ although 1+x+x2 is not the polynomial for ex. Check P against the derivatives first, as the first check above does.

Where the remainder comes from, and where series lead

The error E⁢(x)=f⁡(x)−Pn(x) and its first n derivatives are all 0 at a, and its derivative of order n+1 is f⁡(n+1). Integrating the bound ∣f⁡(n+1)∣≤M from a to x, n+1 times, gives ∣⁢E⁢(x)⁢∣ ≤M⁢∣⁢x−a∣n+1/⁢(n+1)!.

A convergent Taylor series does not always equal its function. Let f⁡(x)=e−1⁢/x2 for x≠0, with f⁡(0)=0. Every derivative of f at 0 is 0, so its Maclaurin series is 0+0+0+⋯, which equals f only at x=0.

Series also reach where the formulas do not. Putting i⁢θ into the series for ex and grouping the real and imaginary terms gives the cosine and sine series. That is Euler’s formula, ei⁢θ=cosθ+isinθ.

ei⁢θ=cosθ+isinθ

Common mistakes

  • Forgetting the factorials. The coefficient of (x−a)k is f⁡(k)(a)⁢/⁢k!, not f⁡(k)(a). For ex the x2 term is x2/2, not x2, because differentiating x2 twice leaves 2.
  • Writing powers of x instead of x−a when the center is not 0. Centered at 4, the x polynomial is 2+(x−4)⁢/4−(x−4)2/64. Powers of x alone would match the derivatives at 0, not at 4.
  • Leaving the derivatives unevaluated. The coefficients are numbers, f⁡(k)(a)⁢/⁢k!. A coefficient that still contains x, such as cosx, means the derivative was never evaluated at the center.
  • Using a series outside its interval of convergence. 1+x+x2+⋯ does not equal 1⁢/⁢(1−x) at x=2, because the series diverges there while 1⁢/⁢(1−2)=−1.
  • Treating a sampled maximum error as a proven bound. A graph checks only the points it samples. The remainder bound, or the alternating series bound, is what proves the error is small.
  • Counting terms instead of the degree. The degree-3 Maclaurin polynomial of sinx is x−x3/6, which has only two nonzero terms. The degree is the highest power kept, not the number of terms.

Key terms

Taylor polynomial
The polynomial of degree at most n that matches a function’s value and first n derivatives at a center a: Pn(x) =Σ f⁡(k)(a)⁢(x−a)k/⁢k! for k=0 to n.
Taylor series
The power series Σ f⁡(n)(a)⁢(x−a)n/⁢n! built from all of a function’s derivatives at a. Where it converges to the function, it represents the function as an infinite polynomial.
Maclaurin series
A Taylor series centered at 0. It writes f⁡(x) as f⁡(0)+f′(0)⁢x+f′⁢′(0)x2/2! +f′⁢′⁢′(0)x3/3!+…, built from the function’s derivatives at x=0.
Power series
A series of powers of (x−a), Σcn(x−a)n, centered at a. Whether it converges depends on x: it converges inside its radius of convergence, and each endpoint must be checked separately.
Radius of convergence
The number R such that a power series converges, absolutely, at every x closer than R to its center and diverges at every x farther away. R can be 0 or ∞. At exactly distance R, test each endpoint on its own.
Interval of convergence
All the x-values where a power series converges: the interval inside the radius of convergence, plus whichever endpoints pass their own tests.
Factorial
For a positive integer n, n! is the product of the integers from 1 through n, and 0! is defined as 1. Factorials count arrangements of distinct objects.

Work through an example

Use the degree-two Taylor polynomial of ex at 0 to approximate e0.2, and bound the error.

Approximate e to the power 0.2 →

Find the Maclaurin series of sinx →

Find the interval of convergence →

Sources and scope

Authored study material. Tool results depend on the stated inputs and model assumptions.

After reading

Study it, then try it

Practice the key terms as flashcards, then open the example in its tool, change a value and keep a useful result on your board.

Study the 7 key terms Open Taylor Approximation Check the value in Math Open worked example on a board Taylor Approximation in Math Reference

Your existing work stays on this device. Examples open as editable copies.