Polynomial approximation

Taylor polynomial calculator

The degree-n Taylor polynomial of f about a center a is P_n(x) = f(a) + f'(a)(x − a) + f''(a)/2! (x − a)^2 + … + f^(n)(a)/n! (x − a)^n. When a is 0, that polynomial is the Maclaurin polynomial. This page builds it for the standard functions below, through order 12.

Coefficients that are rational are written as reduced fractions, and the factorial is kept visible in the steps. A factor such as e, ln(2), or √2 stays exact instead of being replaced by a decimal. The table lists f^(k)(a), k!, and the coefficient of each power. A check at a point x you choose compares P_n(x) with f(x) and reports the absolute error. A Lagrange remainder bound is printed when a finite M is honest to claim on the interval between a and x. If the interval meets a singularity, the page says that no finite bound is available.

The boxes open on the degree-4 Maclaurin polynomial for e^x, checked at x = 1/2. That run is the worked example further down the page. The same screen also states the radius of convergence for the function you picked.

Use an integer, a decimal, or a fraction. A decimal is kept as a fraction of a power of ten, so 0.5 is 1/2. For sine and cosine you may also type a multiple of pi, such as pi/2, pi/4, or 2pi/3. Order n runs from 0 to 12. Maclaurin means the center is 0.

How a Taylor polynomial is built

Ask for the polynomial of degree at most n that matches f at a single point as far as the derivatives can see. Matching the value fixes the constant term: it has to be f(a). Matching the first derivative fixes the coefficient of (x − a). The kth derivative of (x − a)^k is k!, so if the term is c_k (x − a)^k, its kth derivative at the center is c_k k!. Set that equal to f^(k)(a) and solve: c_k = f^(k)(a) / k!. That is the whole recipe. There is one coefficient for each k from 0 through n, and no freedom left.

When the center is 0, (x − a)^k is just x^k. That special case is named for Maclaurin. The algebra is the same. Only the powers look simpler, and several of the standard functions then have rational coefficients: 1/k! for e^x, 1/k for ln(1+x), and 1 for every power in 1/(1−x).

The polynomial is a finite object. The Taylor series is the limit of these polynomials as n grows, when that limit exists. A series converges inside an open disk whose radius is the distance from a to the nearest singularity in the complex plane. e^x, sin x, and cos x have no singularity, so the radius is infinite. ln(1+x) breaks at −1. 1/(1−x) breaks at 1. arctan x is smooth on the whole real line and still has singularities at i and −i, so its Maclaurin series has radius 1 and diverges for |x| > 1. The polynomial can be evaluated past that radius. It just stops being a reliable stand-in for f.

The error has a name. Lagrange's form says f(x) − P_n(x) = f^(n+1)(c) / (n+1)! · (x − a)^(n+1) for some c strictly between a and x, when the derivatives exist on that interval. You rarely know c. If |f^(n+1)(t)| ≤ M for every t between a and x, the absolute error is at most M |x − a|^(n+1) / (n+1)!. That ceiling is the remainder bound on this page. It is not the exact error. If the interval reaches a point where the derivative blows up, no such M exists, and inventing one would be a false comfort.

How to read the result

The title says Maclaurin when the center is 0 and Taylor otherwise. Under the graph, the expanded polynomial drops any term whose coefficient is 0. The table does not. A zero row is useful: it is how you see that the even powers of sin x are missing, rather than forgotten.

The coefficient column shows the quotient f^(k)(a)/k! and, when division simplifies the fraction, the reduced value as well. So 1/4! = 1/24, and 8/3! = 4/3 for the k = 3 term of e^(2x). Square roots stay in the coefficient when the center is a multiple of π that produces one, such as sin x about π/4.

The numeric check evaluates the polynomial at your x. When every coefficient and the point are rational, P_n(x) is printed as an exact fraction and then as a decimal. f(x) is the true function value. The absolute error is the gap between them. If x is outside the real domain, or outside the interval of convergence, the page says which, and it still prints the polynomial value.

The graph draws f as a solid curve and P_n as a dashed curve on a window around the center. The window stops short of a singularity, so a logarithm or 1/(1−x) does not send the picture to infinity. The dot is the center, where the two curves are required to meet.

A fully worked example

Both blocks below are written on the page, so you can read them with scripts turned off. The form opens on the first block. The second block moves the same function to a center that is not 0, which is the step that brings in the factor e.

Maclaurin polynomial of degree 4 for e^x, checked at x = 1/2.

f(x) = e^x. Every derivative is e^x, and e^0 = 1.
The center is 0, so this is a Maclaurin polynomial.
P_4(x) = sum_{k=0}^{4} x^k / k!.

k    f^(k)(0)    k!     coefficient
0    1            1      1
1    1            1      1
2    1            2      1/2! = 1/2
3    1            6      1/3! = 1/6
4    1            24     1/4! = 1/24

P_4(x) = 1 + x + (1/2) x^2 + (1/6) x^3 + (1/24) x^4.

Check at x = 1/2.
P_4(1/2) = 1 + 1/2 + (1/4)/2 + (1/8)/6 + (1/16)/24
         = 1 + 1/2 + 1/8 + 1/48 + 1/384.
Common denominator 384:
384/384 + 192/384 + 48/384 + 8/384 + 1/384 = 633/384 = 211/128.
211/128 = 1.6484375.
e^(1/2) ≈ 1.6487212707.
Absolute error ≈ 0.0002837707.

Lagrange bound. On [0, 1/2], the fifth derivative e^t is largest at t = 1/2.
M = e^(1/2).
|R_4(1/2)| ≤ M / 5! · (1/2)^5 = e^(1/2) / (120 · 32) = e^(1/2) / 3840 ≈ 0.0004293545.
The true error sits under that ceiling. The ceiling is not the error.

Radius. e^x is entire. The series converges for every real x.

Same function, nonzero center. Degree 2 Taylor polynomial of e^x about 1.

f(1) = e, f'(1) = e, f''(1) = e.
P_2(x) = e + e (x − 1) + e (x − 1)^2 / 2
       = e [ 1 + (x − 1) + (x − 1)^2 / 2 ].
The coefficients are not rational. They are rational multiples of e, and that is the exact form. A decimal for e would already be a rounding.

Common mistakes

The derivative in the coefficient is a number, f^(k)(a), not the function f^(k)(x). If a power of x survives inside the coefficient, the center was never substituted.

Degree n means the powers from 0 through n, which is n + 1 terms before any of them turn out to be zero. Stopping at k = n − 1 builds the polynomial of degree n − 1 and then compares it with a remainder formula written for a different order.

Maclaurin is not a second kind of approximation. It is the Taylor polynomial with a = 0. The expansion of e^x about 1 is a Taylor polynomial. Calling it Maclaurin is a false label, and it hides the factor e.

The Lagrange expression with an unnamed c is an equality. The version with M is an inequality. Students often copy the bound into an answer blank that asked for the error. The error is smaller than the bound unless |f^(n+1)| actually attains M at the right place.

M has to cover the interval between a and x, and only that interval. A maximum taken on a larger interval is still a valid bound, but it is usually worse. A maximum taken on an interval that does not contain the segment from a to x is not a bound for this x at all.

Smooth on the real line is not the same as an infinite radius. arctan x has derivatives of every order everywhere, and its Maclaurin series still diverges for |x| > 1. The partial polynomial at x = 2 is a number. It is not evidence that the series converges there.

Two sign patterns cause most of the algebra errors. For sin x the derivatives at 0 cycle 0, 1, 0, −1. For ln(1+x) the coefficients are +1, −1/2, +1/3, −1/4, and the first omitted sign is the one people flip.

Related reading

A Taylor series is an infinite sum, so the meaning of convergence lives in sequences, series, and infinite sums. The tests that decide many of those series, including the ratio test that explains a factorial in the denominator, are in convergence tests for series. Finite arithmetic and geometric sums, which are a different question, are the sequence calculator.

The surrounding map is calculus foundations. The argument that a remainder goes to zero, when a course asks you to write it, is on real analysis and proof habits. After you have an explicit polynomial, the numerical derivative calculator can audit the slope of P_n at the center. It should come back near f'(a). Glossary entries that sit next to this page: series, partial sum, and convergence.

Disclaimer. Educational estimate only. This page is not a computer algebra system and not a proof. See the site disclaimer and the FAQ on calculators versus understanding.

Common questions

What is a Taylor polynomial?

The degree-n Taylor polynomial of f about a center a is P_n(x) = f(a) + f'(a)(x-a) + f''(a)/2! (x-a)^2 + ... + f^(n)(a)/n! (x-a)^n. It is the unique polynomial of degree at most n whose value and first n derivatives agree with f at x = a.

How is a Maclaurin polynomial different from a Taylor polynomial?

A Maclaurin polynomial is a Taylor polynomial whose center is 0. The powers are then ordinary powers of x. Every Maclaurin polynomial is a Taylor polynomial. The expansion of e^x about 1 is a Taylor polynomial and not a Maclaurin polynomial.

How do you estimate the remainder of a Taylor polynomial?

Lagrange's form says the error at x equals f^(n+1)(c)/(n+1)! (x-a)^(n+1) for some c between a and x. If the absolute value of f^(n+1)(t) is at most M on that interval, the absolute error is at most M times |x-a|^(n+1)/(n+1)!. The bound is a ceiling, not the exact error. If the interval reaches a singularity, no finite M exists, and this page says so.

What is the radius of convergence of a Taylor series?

It is the radius of the largest disk, centered at a, inside which the infinite series converges. For e^x, sin x, and cos x the radius is infinite. For ln(1+x) and for 1/(1-x) it is the distance from a to the nearest singularity. For arctan x the singularities are the imaginary points i and -i, so the radius is the square root of 1+a^2. A finite polynomial can still be evaluated outside that disk. The infinite series need not approach the function there.

Why does the Maclaurin series for sin x use only odd powers?

sin x is an odd function, so sin(-x) = -sin x. The even-order derivatives of an odd function are 0 at 0, and the coefficients of the even powers are 0. cos x is even, so its odd-order derivatives at 0 vanish and only even powers remain.

Is a Taylor polynomial equal to the function?

Only in special cases. If f is a polynomial of degree d and n is at least d, the Taylor polynomial equals f everywhere. For e^x, sin x, and ln(1+x), a finite polynomial matches the function at the center and is only an approximation nearby. Raising n improves the match near the center, inside the radius of convergence. The remainder bound measures the gap.

Want a tool that matches a new explainer, or a check that a page and a calculator disagree? Write a short note.

Suggest a topic or tool