Maclaurin Series

A function rebuilt from its derivatives at zero.

Start with the tangent

Near x = 0, the curve y = eˣ is close to its tangent there. The curve passes through (0, 1), because e⁰ = 1, and its gradient there is also e⁰ = 1, so the tangent is y = 1 + x.

At x = 0.1 the tangent gives 1.1, and e^0.1 = 1.105171. At x = 0.5 it gives 1.5, against e^0.5 = 1.648721. The tangent matches the curve's height and gradient at 0, and nothing more, so it drifts away as x moves off 0.

Match the bend as well

The tangent is straight, but eˣ bends upward. To follow the bend, add a term in x²: try 1 + x + cx², and choose c so that this polynomial has the same second derivative at 0 as eˣ.

The second derivative of 1 + x + cx² is 2c, and the second derivative of eˣ is eˣ, which is 1 at 0. So 2c = 1 and c = 1/2, giving 1 + x + x²/2.

At x = 0.5 this gives 1 + 0.5 + 0.125 = 1.625, against the true 1.648721: out by 0.023721, where the tangent alone was out by 0.148721.

xy

The gold curve y = eˣ, with the plain straight line y = 1 + x and the plain parabola y = 1 + x + x²/2. All three pass through (0, 1). The parabola stays with the curve further from 0 than the line does.

The general term

Carry on, one term per derivative. Term n is f⁽ⁿ⁾(0)xⁿ/n!: the nth derivative of the function at 0, times xⁿ, divided by n factorial. Written out, f(x) = f(0) + f'(0)x + f⁽²⁾(0)x²/2! + f⁽³⁾(0)x³/3! + …, and this is the Maclaurin series of f.

The factorial is there to make the derivatives match. Differentiate xⁿ a total of n times and it becomes n × (n − 1) × … × 1 = n!. So the nth derivative of the term f⁽ⁿ⁾(0)xⁿ/n! is exactly f⁽ⁿ⁾(0). Every other term has either vanished by then or still carries a power of x, which is 0 at x = 0. So at 0 the polynomial and the function agree in height, gradient, second derivative, and every derivative the polynomial includes.

Everything in the series is measured at zero. The function's values anywhere else are not used.

The series for eˣ

Every derivative of eˣ is eˣ, and at 0 each of them equals 1. So every coefficient is 1/n!, and eˣ = 1 + x + x²/2! + x³/3! + …, which is 1 + x + x²/2 + x³/6 + … with the factorials worked out.

Put in x = 1 and add one term at a time. The sums are 1, then 2, then 2.5, then 2.666667 after four terms, 2.708333 after five, 2.716667 after six, and 2.718056 after seven. The true value is e = 2.718282, so seven terms are out by 0.000226.

At x = 0.5 the same four terms, 1 + 0.5 + 0.125 + 0.020833, give 1.645833, out by 0.002888 from 1.648721. Closer to 0, fewer terms are needed for the same accuracy.

The series for sin x

Differentiate sin x again and again: cos x, then −sin x, then −cos x, then sin x, and round again. At 0 these are 1, 0, −1, 0, and sin 0 = 0 itself. So the terms in even powers vanish, and the odd ones alternate in sign: sin x = x − x³/3! + x⁵/5! − …, which is x − x³/6 + x⁵/120 − …

The first term alone says sin x ≈ x for small x, measured in radians. That is the small-angle approximation. At x = 0.5 it gives 0.5; two terms give 0.5 − 0.020833 = 0.479167; three give 0.479427. The true value is sin 0.5 = 0.479426.

At x = 1 the sums are 1, then 0.833333, then 0.841667, then 0.841468 with a fourth term, against sin 1 = 0.841471.

The same series settles a limit. Divide by x: sin x / x = 1 − x²/6 + …, and every term after the 1 shrinks to 0 as x shrinks, so sin x / x tends to 1 as x tends to 0.

-2π−ππ2πP3(x) = x − x³/3!within 0.01 for |x| ≤ 1.04N = 3

P3 stays within 0.01 of sin x for |x| ≤ 1.04: each extra degree matches one more derivative at 0, so the polynomial hugs the curve further before it flies away

Step the degree until the polynomial stays within 0.01 of sin x out to π

The plain curve is y = sin x and the gold one is the series stopped at the x³ term, x − x³/3!. The shaded band is where the two differ by less than 0.01: out to about |x| = 1.04. Drag N to add terms: with the x⁵ term the band reaches about 1.76, and with the x⁷ term about 2.50.

The usual mistakes

Leaving out the factorial. The x² term of eˣ is x²/2, not x²: its coefficient is f⁽²⁾(0)/2! = 1/2.

Putting the wrong factorial under a term. 3! = 6 belongs to the x³ term; the x² term divides by 2! = 2.

Getting the sign of the x³ term of sin x wrong. It is x − x³/6; the minus bends the line y = x back down toward the curve.

Using degrees. The derivatives of sin x and cos x are the ones above only when x is in radians, so the series needs x in radians.

The cosine, and a pendulum

Differentiating cos x gives −sin x, −cos x, sin x, cos x, which at 0 are 0, −1, 0, 1, and cos 0 = 1. So cos x = 1 − x²/2! + x⁴/4! − …, which is 1 − x²/2 + x⁴/24 − …

In the application below, a pendulum 2 meters long is drawn aside through 0.2 radians, and the series for cos x up to the x⁴ term gives how far the bob rises.

Worked example: A Pendulum Drawn Aside Through a Small Angle: How Far the Bob Rises, from a Series

Question A pendulum 2 meters long is drawn aside until its string makes an angle of x = 0.2 radians with the vertical. The bob then rises h = 2(1 − cos x) meters. (a) Write the Maclaurin series for cos x as far as the term in x4, and use it to estimate cos 0.2. (b) Find how far the bob rises, and say how far out the two-term estimate 1 − x22 would leave it.

  1. 1.Differentiate the cosine at zero, one order at a time: cos 0 = 1, then −sin 0 = 0, then −cos 0 = −1, then sin 0 = 0, then cos 0 = 1. Divide each by the factorial of its order to get the coefficients.

    −0.500.5100.511.52x, radianscos xcos 0 = 1, −sin 0 = 0, −cos 0 = −1then 0, then 1, over the factorials
    −0.500.5100.511.52x, radianscos xcos 0 = 1, −sin 0 = 0, −cos 0 = −1then 0, then 1, over the factorials
    The derivatives of cos x at zero run 1, 0, −1, 0, 1, and each is divided by the factorial of its order.
  2. 2.(a) So cos x ≈ 1 − x22 + x424, every odd term vanishing. At x = 0.2: 1 − 0.02 + 0.001624 = 1 − 0.02 + 0.0000667 = 0.980067 to six decimal places.

    −0.500.5100.511.52x, radianscos xthree termsterms usedcos 0.21120.9830.9800667exact0.9800666cos x ≈ 1 − x2/2 + x4/24x = 0.2: 1 − 0.02 + 0.0000667
    −0.500.5100.511.52x, radianscos xthree termsterms usedcos 0.21120.9830.9800667exact0.9800666cos x ≈ 1 − x2/2 + x4/24x = 0.2: 1 − 0.02 + 0.0000667
    (a) So cos x ≈ 1 − x22 + x424, and at x = 0.2 that is 1 − 0.02 + 0.0000667.
  3. 3.Put that into the height: h = 2(1 − 0.980067) = 2 × 0.019933 = 0.039867 m.

    −0.500.5100.511.52x, radianscos xthree termsterms usedcos 0.21120.9830.9800667exact0.9800666cos 0.2 ≈ 0.980067h = 2(1 − 0.980067) = 0.039867 m
    −0.500.5100.511.52x, radianscos xthree termsterms usedcos 0.21120.9830.9800667exact0.9800666cos 0.2 ≈ 0.980067h = 2(1 − 0.980067) = 0.039867 m
    That gives cos 0.2 ≈ 0.980067, so h = 2(1 − 0.980067) = 0.039867 m.
  4. 4.(b) So the bob rises about 39.87 mm.

    −0.500.5100.511.52x, radianscos xthree termsterms usedcos 0.21120.9830.9800667exact0.9800666the bob rises about 39.87 mm
    −0.500.5100.511.52x, radianscos xthree termsterms usedcos 0.21120.9830.9800667exact0.9800666the bob rises about 39.87 mm
    (b) The bob rises about 39.87 mm.
  5. 5.Now stop the series at two terms: cos 0.2 ≈ 1 − 0.02 = 0.98, which gives h = 2 × 0.02 = 0.04 m, or 40 mm.

    −0.500.5100.511.52x, radianscos xthree termstwo termsterms usedcos 0.21120.9830.9800667exact0.9800666two terms: cos 0.2 ≈ 0.98h = 0.04 m, or 40 mm
    −0.500.5100.511.52x, radianscos xthree termstwo termsterms usedcos 0.21120.9830.9800667exact0.9800666two terms: cos 0.2 ≈ 0.98h = 0.04 m, or 40 mm
    Stopping at two terms gives cos 0.2 ≈ 0.98 and h = 0.04 m, or 40 mm: the lower curve pulls away much sooner.
  6. 6.The two-term estimate is therefore 40 − 39.87 = 0.13 mm too high. Check: the term left out is x424 = 0.0000667, and 2 × 0.0000667 = 0.000133 m, which is that 0.13 mm.

    −0.500.5100.511.52x, radianscos xthree termstwo termsterms usedcos 0.21120.9830.9800667exact0.980066640 − 39.87 = 0.13 mm too high2 × 0.0000667 = 0.000133 m
    −0.500.5100.511.52x, radianscos xthree termstwo termsterms usedcos 0.21120.9830.9800667exact0.980066640 − 39.87 = 0.13 mm too high2 × 0.0000667 = 0.000133 m
    The two-term answer is 0.13 mm too high, and the term left out, 2 × 0.2424 = 0.000133 m, is exactly that.

Answer: (a) cos 0.2 ≈ 0.980067; (b) the bob rises about 39.87 mm, and the two-term estimate leaves it 0.13 mm too high

Common mistakes

  • Reading 0.2 as a measure in degrees. The series is built from the derivatives of cos x with x in radians, and at 0.2 degrees the bob would rise only about 0.012 mm, out by a factor of more than three thousand.
  • Keeping only the first term, cos x ≈ 1. That gives h = 0 and says the bob does not rise at all; the series needs the x2 term before it says anything about the height.

More using differentiation problems, worked step by step →

Practice Maclaurin Series in the app