Taylor Series Calculator

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Series & Limits#19

Taylor Polynomial Generator

Degree-\(n\) Taylor/Maclaurin polynomial centered at \(a\), with error check.

The Taylor series calculator builds the degree-\( n \) Taylor polynomial of a function around any center \( x = a \). With \( a = 0 \) it works as a Maclaurin series calculator. It then plugs in a test value so you can see how close the polynomial comes to the real function.

It suits students writing out series by hand, and anyone who wants a quick polynomial approximation of \( \ln \), \( \sqrt{\ } \), trig or exponential functions. It is free and needs no account.

How to use the Taylor series calculator

  1. Type \( f(x) \). Use ^ for powers, and sqrt(), sin(), cos(), ln(), e^(x) and pi for functions. Implicit multiplication like x e^x works.
  2. Enter the center \( a \). Use 0 for a Maclaurin polynomial. The function must be defined at \( a \), so choose \( a = 1 \) for ln(x), for example.
  3. Choose the degree \( n \), from 0 to 10.
  4. Enter a test value of \( x \) and press Generate series. You get the polynomial \( P_n(x) \), the values \( P_n \) and \( f \) at the test point, and the absolute error between them.

Formula

The Taylor polynomial of degree \( n \) centered at \( a \) is

$$P_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}\,(x-a)^k$$

That sum is \( f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots \). The calculator differentiates \( f \) symbolically \( n \) times, evaluates each derivative at \( a \), and divides by \( k! \). Coefficients that are simple fractions are shown exactly. The full Taylor series is the limit as \( n \to \infty \). This tool gives you the polynomial up to degree 10, which is what most homework and approximation problems ask for.

Worked example

Example 1: a Maclaurin polynomial. Find the degree-4 Maclaurin polynomial of \( f(x) = \ln(1+x) \) and use it to estimate \( \ln 1.2 \).

Differentiate and evaluate at 0:

\( k \) \( f^{(k)}(x) \) \( f^{(k)}(0) \) \( f^{(k)}(0)/k! \)
0 \( \ln(1+x) \) 0 0
1 \( (1+x)^{-1} \) 1 1
2 \( -(1+x)^{-2} \) \( -1 \) \( -\tfrac12 \)
3 \( 2(1+x)^{-3} \) 2 \( \tfrac13 \)
4 \( -6(1+x)^{-4} \) \( -6 \) \( -\tfrac14 \)

So

$$P_4(x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4}.$$

At \( x = 0.2 \): \( P_4(0.2) = 0.2 - 0.02 + 0.0026667 - 0.0004 \approx 0.1822667 \). The true value is \( \ln 1.2 \approx 0.1823216 \), an error of about \( 5.49\times10^{-5} \). This is the example preloaded above.

Because the terms alternate in sign and shrink, the error is at most the next term, \( \frac{0.2^5}{5} = 0.000064 \), and the actual error is just under that.

Example 2: a center other than 0. Approximate \( \sqrt{4.2} \) with a degree-2 Taylor polynomial at \( a = 4 \).

Here \( f(4) = 2 \), \( f'(x) = \frac{1}{2\sqrt x} \) so \( f'(4) = \frac14 \), and \( f''(x) = -\frac{1}{4x^{3/2}} \) so \( f''(4) = -\frac1{32} \). Dividing by \( 2! \) gives

$$P_2(x) = 2 + \frac{x-4}{4} - \frac{(x-4)^2}{64}.$$

Then \( P_2(4.2) = 2 + 0.05 - 0.000625 = 2.049375 \), against \( \sqrt{4.2} \approx 2.0493902 \), an error of about \( 1.5\times10^{-5} \). In the calculator, enter sqrt(x), center 4, degree 2 and test value 4.2.

Getting a good approximation

  • Center near the test point. The error grows with \( |x - a| \). Estimating \( \sqrt{4.2} \) around \( a = 4 \) works far better than around \( a = 1 \).
  • Higher degree helps only inside the interval of convergence. The series for \( \ln(1+x) \) converges only for \( -1 < x \le 1 \). At \( x = 2 \), \( P_4(2) = -\frac43 \), nowhere near \( \ln 3 \approx 1.0986 \), and raising the degree makes it worse. The ratio test is how you find that interval; the series convergence calculator runs a numerical version.
  • Degree 1 is the tangent line. \( P_1 \) is exactly the linear approximation of \( f \) at \( a \), which the linear approximation calculator also computes.
  • Watch the error row. If the error barely changes as you raise \( n \), check that the test point is inside the interval of convergence.

For the derivations of the standard series for \( e^x \), \( \sin x \) and \( \cos x \), see the guide to Taylor and Maclaurin series.

Related guides

Further reading

FAQ

What is the difference between a Taylor and a Maclaurin series?

A Maclaurin series is a Taylor series centered at \( a = 0 \). Set the center to 0 in the calculator to get the Maclaurin polynomial.

What degree can the calculator handle?

Any degree from 0 to 10. That covers typical textbook problems. For higher orders, look for the pattern in the coefficients and write the general term.

Why does the calculator give an error at my center?

The function or one of its derivatives is undefined at \( a \). For example, \( \ln x \) and \( \sqrt{x} \) have no Taylor polynomial at 0. Choose a center inside the domain, like \( a = 1 \).

How accurate is a Taylor polynomial?

It depends on the degree and on the distance from the center. The calculator shows the actual error at your test point. For alternating series, the next unused term bounds it.

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators