Skip to content

Taylor Series Calculator

Enter a function, a centre and a degree, and get its Taylor polynomial with exact coefficients (1/6, √2/12, cos 1), a table of every derivative and coefficient, the value of the approximation at a test point against the true value and Lagrange's error bound, and graphs of the function with its polynomial and of the error. Runs in your browser. Free, no sign-up.

Use + − * / ^ and brackets. Functions: sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, exp, ln, log (base 10), sqrt, abs. Constants: pi and e.

0 gives a Maclaurin series. A number or constant such as 1 or pi/4.

Compares Tₙ(x) with f(x) and with the error bound.

Results

Maclaurin polynomial of degree 5

T5(x)=x−x36+x5120

Tₙ(x) = Σ f⁽ᵏ⁾(a)/k! · (x − a)ᵏ, for k = 0 to n

Coefficients

kf⁽ᵏ⁾(x)f⁽ᵏ⁾(a)f⁽ᵏ⁾(a) / k!
0sin(x)00
1cos(x)11
2−sin(x)00
3−cos(x)-1−1/6 ≈ -0.16666667
4sin(x)00
5cos(x)11/120 ≈ 0.0083333333

Approximation at x = 1

0.84166667

Tₙ(x)

0.84147098

f(x)

0.00019568186

Actual error |f(x) − Tₙ(x)|

0.0011687097

Lagrange error bound

Lagrange's bound is M·|x − a|ⁿ⁺¹/(n + 1)! with M ≈ 0.84147098, the largest |f⁽ⁿ⁺¹⁾| found by sampling between a and x, so it is an estimate rather than a proof.

Graph

  • f(x)
  • Tₙ(x), n = 5
Graph of f and its degree 5 Taylor polynomial about x = 0-4-3-2-101234-1-0.500.51xy(1, 0.841)

Approximation error

  • |f(x) − Tₙ(x)|
Graph of the error |f(x) − Tₙ(x)|, which is 0 at x = 0 and grows away from it-4-3-2-101234012xy

How to Use the Taylor Series Calculator

  1. 1. Type the function. Use x as the variable: sin(x), e^x, ln(x), 1/(1-x), sqrt(1+x), atan(x).
  2. 2. Choose the centre and the degree. The centre a is where the polynomial matches f exactly; 0 gives a Maclaurin series, and a value like 1 or pi/4 gives a general Taylor series in powers of (x − a). The degree n goes up to 12.
  3. 3. Pick a test point. The calculator compares Tₙ(x) with the true f(x) there and gives the actual error and Lagrange's bound on it.
  4. 4. Read the table and the graphs. Each row shows a derivative, its value at a and the coefficient f⁽ᵏ⁾(a)/k!. The first graph overlays f and Tₙ; the second shows the error growing away from the centre.

The Formula

The degree-n Taylor polynomial of f about x = a is Tₙ(x) = f(a) + f′(a)(x − a) + f″(a)/2! (x − a)² + … + f⁽ⁿ⁾(a)/n! (x − a)ⁿ. Each coefficient is the kth derivative at the centre divided by k!. With a = 0 it is called a Maclaurin polynomial. Letting n grow without limit gives the Taylor series; whether it equals f depends on where it converges.

FunctionMaclaurin seriesConverges for
eˣ1 + x + x²/2! + x³/3! + …all x
sin xx − x³/3! + x⁵/5! − …all x
cos x1 − x²/2! + x⁴/4! − …all x
1/(1 − x)1 + x + x² + x³ + …|x| < 1
ln(1 + x)x − x²/2 + x³/3 − …−1 < x ≤ 1
arctan xx − x³/3 + x⁵/5 − …|x| ≤ 1

Worked Example: sin x Near 0

For f(x) = sin x about 0, the derivatives cycle through cos x, −sin x, −cos x, sin x, so at 0 they are 1, 0, −1, 0, 1, … and the degree-5 polynomial is T₅(x) = x − x³/6 + x⁵/120. At x = 1 it gives 101/120 ≈ 0.8416667, while sin 1 = 0.8414710, an actual error of 0.0001957.

Lagrange's remainder says |f(x) − Tₙ(x)| ≤ M·|x − a|ⁿ⁺¹/(n + 1)!, where M bounds |f⁽ⁿ⁺¹⁾| between a and x. Here f⁽⁶⁾ = −sin x, and its largest size on [0, 1] is sin 1 ≈ 0.8415, so the bound is 0.8415/720 ≈ 0.001169. The true error 0.0001957 sits safely under it. The tool estimates M by sampling, so treat the bound as a sound estimate rather than a proof.

Why Far-Away Points Go Wrong

A Taylor polynomial is accurate close to its centre and drifts away from f as you leave it. For 1/(1 − x) about 0, the degree-4 polynomial 1 + x + x² + x³ + x⁴ gives 1.9375 at x = 0.5 against a true value of 2, and outside |x| < 1 the series does not converge at all, however many terms you add. Even for sin x, whose series converges everywhere, a degree-7 polynomial is off by about 0.05 at x = 3. The error graph shows exactly where the gap opens up.

Frequently Asked Questions

What is the difference between a Taylor and a Maclaurin series?
A Maclaurin series is a Taylor series centred at 0, so its terms are powers of x rather than of (x − a). Everything else is the same: the coefficients are f⁽ᵏ⁾(a)/k!. Choosing a different centre is useful when f is undefined at 0 (as ln x is) or when you need accuracy near another point.
How many terms do I need?
Enough that the error bound at your largest x is below the accuracy you need. Because the Lagrange bound shrinks like |x − a|ⁿ⁺¹/(n + 1)!, small distances need few terms: for sin x within 0.5 of 0, degree 5 already has error under 0.000002. Enter your test point and raise the degree until the bound is small enough.
What is the Lagrange error bound?
It is a guaranteed ceiling on |f(x) − Tₙ(x)|: M·|x − a|ⁿ⁺¹/(n + 1)!, with M the maximum of |f⁽ⁿ⁺¹⁾| between a and x. It always overestimates the actual error a little, which is what makes it safe to quote.
What is the radius of convergence?
It is the distance from the centre within which the full Taylor series converges to f. For eˣ, sin x and cos x it is infinite; for 1/(1 − x) and ln(1 + x) it is 1, because of the singularity at x = 1 (and x = −1 for the log). Inside the radius, adding terms improves the fit; outside, it makes it worse.
Why does it say the series cannot be built?
The centre must be a point where f and every derivative up to degree n exist. ln x is undefined at 0 and √x has no derivative there, so expand about 1 instead. A removable gap like sin(x)/x at 0 is not handled directly: expand sin x to the degree you need and divide each term by x.
How is the first-degree Taylor polynomial related to the tangent line?
T₁(x) = f(a) + f′(a)(x − a) is exactly the equation of the tangent line at x = a, which is why the tangent line is called the linear approximation. Higher degrees add curvature (the f″ term) and keep matching more derivatives.

Related Tools

More in Math Calculators

See all Math Calculators