Skip to content
Brainlag

Theme

Colour

← All simulations

Taylor and Maclaurin series

A Taylor polynomial copies a function's value and its first n derivatives at one point. Add terms and it hugs the curve further out, but only as far as the radius of convergence.

Error at x₀ against degree n (log scale)

Readouts

What's happening

Near x = a a smooth function looks like its tangent line, and it looks even more like a polynomial that matches its value and its first n derivatives there: Pₙ(x) = Σ f⁽ᵏ⁾(a)(x − a)ᵏ/k!. Expanding about a = 0 gives the Maclaurin series. For eˣ, sin x and cos x the polynomials get better everywhere as n grows, because the k! in the denominator eventually beats any power of x. For ln(1 + x), 1/(1 − x), √(1 + x) and arctan x they only improve inside the interval of convergence, a distance R from a. Outside it the error grows with n, however many terms you add. R is the distance from a to the nearest point where the function breaks down, and for arctan that point is not on the real line at all: it is ±i, where 1/(1 + x²) blows up. The Lagrange form of the remainder bounds the error without knowing the answer: |f(x) − Pₙ(x)| ≤ M|x − a|ⁿ⁺¹/(n + 1)!, where M is the largest size of f⁽ⁿ⁺¹⁾ between a and x.

Pₙ(x) = Σ f⁽ᵏ⁾(a)(x − a)ᵏ / k!eˣ = 1 + x + x²/2! + x³/3! + ...ln(1 + x) = x − x²/2 + x³/3 − ..., −1 < x ≤ 1|Rₙ(x)| ≤ M|x − a|ⁿ⁺¹ / (n + 1)!

A-Level Further Maths (AQA, Edexcel, OCR, OCR MEI): Maclaurin series of standard functions and their validity. First-year university calculus: Taylor's theorem, the Lagrange remainder and radius of convergence.

Work through the numbers with Graphing Calculator and Scientific Calculator.

Challenge

Predict first: with f = sin x about a = 0, what degree n do you need before Pₙ(3) is within 0.001 of sin 3? Use the Lagrange bound 3ⁿ⁺¹/(n + 1)!, then set x₀ = 3 and step n up.

FAQ

What is the difference between a Taylor and a Maclaurin series?
None in kind: a Maclaurin series is a Taylor series expanded about a = 0. A Taylor series about a uses powers of (x − a) and the derivatives at a.
Why does the series for ln(1 + x) only work for −1 < x ≤ 1?
ln(1 + x) is undefined at x = −1, and a power series about 0 converges on a disc that cannot contain that point, so the radius is 1. At x = 1 the series becomes 1 − 1/2 + 1/3 − ..., which converges (to ln 2); at x = −1 it is minus the harmonic series, which diverges.
Why does arctan x have radius of convergence 1 when it is defined everywhere?
Its derivative 1/(1 + x²) blows up at the complex numbers x = ±i, which are a distance 1 from 0. A power series converges on a disc in the complex plane, and that disc stops at the nearest trouble, even when the trouble is not on the real line.
How do I use the Lagrange remainder?
Find the (n + 1)th derivative, bound its size by M on the interval between a and x, and then |f(x) − Pₙ(x)| ≤ M|x − a|ⁿ⁺¹/(n + 1)!. For sin x you can always take M = 1.