Taylor Series Calculator

A Taylor series approximates a function near a point using a polynomial built from its derivatives at that point. When the centre is 0 it is called a Maclaurin series. This calculator differentiates the function repeatedly, builds the polynomial with exact coefficients, and graphs it against the original function.

Use 0 for a Maclaurin series.
Try:

How to use the taylor series calculator

  1. Type the function, such as sin(x) or e^x.
  2. Enter the centre a and the order (1 to 8).
  3. Press Calculate to see the polynomial and the comparison graph.

Formula

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

Worked example: sin x, order 5

  • f(x) =: sin(x)
  • Centre a: 0
  • Order (1–8): 5

✓ Answer checked

sin⁡(x)≈x−16x3+1120x5\sin\left(x\right) \approx x - \frac{1}{6}x^{3} + \frac{1}{120}x^{5}
Error at x = 0.5
0.0000015450.000001545
−4−3−2−11234−1−0.50.51a = 0f(x)Taylor polynomial (order 5)
Near x = 0 the polynomial (dashed) hugs the curve; further away they drift apart. Higher orders stay close for longer.
Step-by-step working (3 steps)
  1. Taylor formula Taylor series

    Each term uses a derivative of f at the centre, divided by a factorial.

    f(x)≈∑k=05f(k)(0)k!(x−0)kf(x) \approx \sum_{k=0}^{5} \frac{f^{(k)}(0)}{k!}(x - 0)^k
  2. Derivatives at the centre

    Differentiate repeatedly and substitute x = a.

    f(0)(0)=0,  f(1)(0)=1,  f(2)(0)=0,  f(3)(0)=−1,  f(4)(0)=0,  f(5)(0)=1f^{(0)}(0) = 0,\; f^{(1)}(0) = 1,\; f^{(2)}(0) = 0,\; f^{(3)}(0) = -1,\; f^{(4)}(0) = 0,\; f^{(5)}(0) = 1
  3. Build the polynomial

    Divide each derivative by k! and attach (x − a)ᵏ.

    x−16x3+1120x5x - \frac{1}{6}x^{3} + \frac{1}{120}x^{5}
Formulas used
f(x)≈f(a)+f′(a)(x−a)+f′′(a)2!(x−a)2+⋯f(x) \approx f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots
How this was checked
  • ✓ Halving the distance from the centre shrinks the error from 2.53e-16 to 1.73e-18, as a correct order-5 polynomial should.

Frequently asked questions

What is the Maclaurin series of sin x?

x − x³/3! + x⁵/5! − …, so to order 5 it is x − x³/6 + x⁵/120.

Why does the approximation get worse further away?

The polynomial is built to match the function's derivatives at the centre, so it is most accurate near that point.

How is the answer checked?

The error is measured at two distances from the centre; for a correct polynomial it shrinks quickly as you move closer.

Related calculators

Related guides