Taylor and Maclaurin Series, Explained

After reading this you can expand a function into its Taylor polynomial around any point, read the coefficients, and judge how far from that point the approximation stays useful.

What a Taylor series is

A Taylor series rebuilds a function out of powers of (x - x_0). Near the point x_0 you replace a complicated function with a polynomial that matches its value, its slope, its curvature, and higher derivatives at that single point.

Take exp(x) around x_0 = 0. The first few terms are 1 + x + \frac{x^2}{2} + \frac{x^3}{6}. Plug in x = 0.1. The polynomial gives 1.105166..., and exp(0.1) = 1.105171.... Four terms already match to five decimals. That is the hook: a fixed handful of coefficients reproduces a curve to high accuracy in a neighborhood of the expansion point.

When to use it, and when not to

Reach for a Taylor series when you need a local approximation you can compute by hand or evaluate cheaply: linearizing near an operating point, estimating a limit, or integrating a function with no closed-form antiderivative. The series turns sin(x)/x, undefined at 0, into 1 - \frac{x^2}{6} + \frac{x^4}{120}, which is perfectly defined at 0 and equals 1 there.

Do not use it far from x_0. The accuracy that costs you almost nothing near the point can collapse completely once you leave the radius of convergence. The Maclaurin series of \frac{1}{1-x} is 1 + x + x^2 + \cdots, which converges only for |x| \lt 1. At x = 2 the partial sums grow without bound while the true value is -1.

The formula and the intuition

f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(x_0)}{n!}\,(x - x_0)^n

Here f^{(n)}(x_0) is the n-th derivative of f evaluated at the expansion point, n! is the factorial, and (x - x_0)^n is the offset from the point raised to the n-th power. When x_0 = 0 the offset becomes plain x^n and the expansion is called a Maclaurin series.

The intuition is matching. The n = 0 term forces the polynomial to share the function's value at x_0. The n = 1 term forces the same slope. Each further term fixes one more derivative. The division by n! is exactly what cancels the factor that repeated differentiation of x^n produces, so the n-th derivative of the polynomial at x_0 equals f^{(n)}(x_0) and nothing else.

The error after keeping terms up to power N equals \frac{f^{(N+1)}(c)}{(N+1)!}(x - x_0)^{N+1} for some c between x_0 and x. This Lagrange remainder tells you the error shrinks fast when |x - x_0| is small and the order is high.

Worked example: sin(x) to order 7

Expanding sin(x) around 0

Use the demo values: expr = sin(x), var = x, x0 = 0, order = 7.

  1. List derivatives of \sin x at 0: \sin 0 = 0, \cos 0 = 1, -\sin 0 = 0, -\cos 0 = -1, then the pattern repeats.
  2. Only odd powers survive because every even derivative vanishes at 0.
  3. Divide each surviving derivative by n!: coefficients are 1/1! = 1, -1/3! = -1/6, 1/5! = 1/120, -1/7! = -1/5040.

The polynomial is

\sin x \approx x - \frac{x^3}{6} + \frac{x^5}{120} - \frac{x^7}{5040}

Check it at x = 1. The polynomial gives 0.8414710... and sin(1) = 0.8414710..., agreeing to seven decimals. At x = 3 the polynomial gives 0.09107... while sin(3) = 0.14112..., an error of about 0.05. The same seven terms are excellent near 0 and mediocre near 3.

The error stays microscopic near x = 0 and grows steeply past about x = 2. Read the vertical scale: near the origin it is billionths, near x = 4 it is half a unit.

Reading the coefficients

The calculator lists the non-zero coefficients. Each one is \frac{f^{(n)}(x_0)}{n!}, not the raw derivative. If a coefficient is -1/6 at power 3, the third derivative at the expansion point is -1/6 \times 3! = -1.

Gaps in the powers carry meaning. When only odd powers appear, as with \sin x, the function is odd around x_0. When only even powers appear, as with \cos x = 1 - \frac{x^2}{2} + \frac{x^4}{24} - \cdots, the function is even. The size of successive coefficients hints at the radius of convergence: for e^x the coefficients 1/n! shrink toward zero fast, so the series converges for every x.

First non-zero Maclaurin coefficients of three standard functions
Power nexp(x)sin(x)cos(x)
0101
1110
20.50-0.5
30.1667-0.16670
40.0416700.04167
50.0083330.0083330

Raising the order of the Maclaurin polynomial of sin(x) widens the interval where it tracks the true curve. Order 3 stays close for roughly |x| < 1.5, order 7 for roughly |x| < 3, and order 11 for roughly |x| < 4.5, after which each polynomial diverges toward plus or minus infinity.

Common mistakes

The first mistake is expanding around the wrong point. If you need values near x = 2, expand around x_0 = 2, not 0. A Maclaurin series is only convenient because 0 is where you happen to want the answer.

The second is trusting the polynomial outside its convergence radius. Adding more terms does not always help. For \frac{1}{1-x} at x = 2, order 5 gives 63 and order 10 gives 2047, both drifting away from the true -1.

Some functions have a valid series that still fails to reproduce them. The classic case is e^{-1/x^2} at 0, whose every derivative there is 0. Its Maclaurin series is identically zero, yet the function is positive for all x \ne 0. A convergent series need not equal the function.

The third mistake is confusing the coefficient with the derivative. The coefficient at power 4 for cos(x) is 1/24, but the fourth derivative at 0 is 1/24 \times 24 = 1.

Related tools

Building a Taylor series starts with repeated differentiation, which you can check with the Derivative & Integral Calculator. Once you have a truncated series you often integrate it term by term; compare the result against the Numerical Integrator. To probe a limit that a series resolves, use the Limit Calculator. If you want a polynomial through data points rather than through derivatives at one point, the Interpolation Calculator fits that job, and the Function Analyzer & Grapher shows where the original function bends. Series solutions of differential equations connect to the Differential Equation Solver, and multivariable Taylor expansions build on the Gradient & Hessian Calculator. For a different view of approximation error, the Riemann Sum Calculator shows convergence of area estimates.

Frequently asked questions

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

A Maclaurin series is just a Taylor series with the expansion point fixed at x_0 = 0. Every Maclaurin series is a Taylor series, but you use a general x_0 whenever the point of interest is not the origin.

How many terms should I keep?

Keep enough that the next term is smaller than your tolerance. For sin(1), the order-7 term is 1/5040 \approx 0.0002, so if you want three-decimal accuracy, order 7 is more than enough. Farther from x_0 you need more terms, and past the convergence radius no finite number works.

Why do some powers have zero coefficients?

Because the corresponding derivative at x_0 is zero. Odd functions like \sin x lose every even power, and even functions like \cos x lose every odd power.

Can the series equal the function everywhere?

Only for functions like e^x, \sin x and \cos x, whose radius of convergence is infinite. Most functions match only inside a finite interval around x_0.

What does the order field control?

It sets the highest power of (x - x_0) kept in the polynomial. Order 5 keeps powers up to x^5, even if some of those coefficients turn out to be zero.