Skip to content
K Knidox Search…
Math · Calculus

Taylor Series

Build the Taylor polynomial of a standard function to any order, and see how far it is from the truth.

Function
The highest power kept. Terms that are zero are omitted.
Expanding about x = a.
To compare the polynomial against the true value.
Taylor polynomial of order 5 about 0
6 terms

eˣ converges on all x

1 + x + 0.5x² + 0.166667x³ + 0.041667x⁴ + 0.008333x⁵

Polynomial at x
2.71666667
True value
2.71828183
Absolute error
1.615e-3
Coefficients
kf⁽ᵏ⁾(a) ÷ k!Contribution at x
011
111
20.50.5
30.166666670.16666667
40.041666670.04166667
50.008333330.00833333

A Taylor polynomial approximates a function near a point by matching its derivatives there. Each term adds one more derivative, so the fit improves as the order rises: eˣ to order 5 about 0 is 1 + x + x²/2 + x³/6 + x⁴/24 + x⁵/120.

Matching derivatives, one at a time

The construction is simple once you see what each term does. The constant term matches the function’s value at the centre. The linear term matches its slope. The quadratic term matches its curvature, and so on — the coefficient of (x − a)ⁿ is exactly f⁽ⁿ⁾(a) ÷ n!, chosen so the nth derivative of the polynomial agrees with the function’s at that point.

Because everything is anchored at the centre, the approximation is excellent nearby and deteriorates as you move away. Doubling the distance from the centre multiplies the leading error term by 2ⁿ⁺¹, which is why a fifth-order polynomial that is near-perfect at x = 0.2 can be visibly wrong at x = 2.

Why the factorial is there

Differentiating (x − a)ⁿ n times produces n!, so dividing by n! is what makes the nth derivative of the term come out as f⁽ⁿ⁾(a) exactly rather than n! times too large. It also explains why the terms shrink so fast for functions like eˣ and sine — the factorial in the denominator outruns any fixed power in the numerator, which is why those series converge everywhere.

f(x) ≈ Σn=0..N f⁽ⁿ⁾(a)·(x − a)ⁿ ÷ n!

a Maclaurin series is the same thing with a = 0

  1. 1
    Pick the centre. Expanding eˣ about a = 0 makes every derivative equal to e⁰ = 1.
  2. 2
    Work out the derivatives at that point. For eˣ every derivative is itself, so f⁽ⁿ⁾(0) = 1 for all n.
  3. 3
    Divide each by n!. That gives coefficients 1, 1, 1/2, 1/6, 1/24, 1/120 for orders 0 to 5.
  4. 4
    Attach the powers. 1 + x + x²/2 + x³/6 + x⁴/24 + x⁵/120.
  5. 5
    Check the error at a point. At x = 1 this gives 2.716667 against e = 2.718282 — accurate to three decimal places already.

How the error falls with order

Approximating e¹ = 2.718282 with the Maclaurin polynomial of eˣ.

OrderValue at x = 1Absolute error
120.718282
22.50.218282
32.6666670.051615
42.7083330.009948
52.7166670.001615
82.7182790.0000031

Where the approximation stops working

Two things limit it. The first is the interval of convergence: ln(1 + x) and 1/(1 − x) only converge for |x| < 1, so no number of terms makes them usable at x = 2 — the series diverges rather than converging slowly. The second is distance from the centre: even for eˣ, which converges everywhere, a low-order polynomial is only useful close to a.

The remainder term quantifies this. Lagrange’s form bounds the error of an order-n polynomial by M·|x − a|ⁿ⁺¹ ÷ (n + 1)!, where M bounds the (n + 1)th derivative between a and x. For an alternating series such as sine there is a simpler bound still: the error is no larger than the first omitted term.

The coefficients here come from the closed form of each function’s derivatives rather than from numerical differentiation, so the polynomial is exact to the precision shown. That is also why the list of functions is curated: an arbitrary expression would need symbolic differentiation, and estimating high derivatives numerically is unreliable enough that the answer would not be trustworthy.

What is the difference between a Taylor and a Maclaurin series?
A Maclaurin series is a Taylor series centred at zero. The general Taylor form expands about any point a using f⁽ⁿ⁾(a)(x − a)ⁿ ÷ n!, and setting a = 0 gives the Maclaurin version.
Why divide by n factorial?
Because differentiating (x − a)ⁿ n times produces n!. Dividing by it makes the polynomial’s nth derivative equal the function’s exactly, rather than n! times too large.
How many terms do I need?
It depends on how far you are from the centre and how much accuracy you want. Close to the centre a handful of terms is usually plenty; the Lagrange remainder gives a rigorous bound if you need one.
Why does the approximation get worse away from the centre?
Because every coefficient is built from derivatives at the centre alone. The leading error term scales as |x − a|ⁿ⁺¹, so doubling the distance multiplies it by 2ⁿ⁺¹.
What is the interval of convergence?
The range of x where the infinite series actually converges to the function. eˣ, sine and cosine converge everywhere; ln(1 + x) and 1/(1 − x) only converge for |x| &lt; 1, where more terms outside that range make things worse rather than better.
How accurate is a truncated series?
For an alternating series with decreasing terms, the error is no larger than the first term you dropped. In general the Lagrange remainder bounds it by M|x − a|ⁿ⁺¹ ÷ (n + 1)!, with M bounding the next derivative.
Why can I only choose from a list of functions?
Because the coefficients here come from the closed form of each function’s derivatives, which keeps them exact. An arbitrary expression would need symbolic differentiation, and estimating high derivatives numerically is too unreliable to report as an answer.