Skip to content

Taylor's Theorem

In this lesson you’ll see Taylor’s theorem stated with an exact remainder rather than a vague ”≈”, learn to prove it by the same subtract-off-the-known-part trick that gave the mean value theorem, use the remainder to get honest error bounds, and understand the difference between a Taylor series converging and a Taylor series converging to the function it came from.

Calculus introduced Taylor series as an infinite sum and asked you to trust it. Analysis does the opposite: it starts with a finite polynomial plus an error term you can control, and only afterwards asks whether the error goes to zero.

Suppose ff has nn derivatives at aa. The nnth Taylor polynomial of ff about aa is

Pn(x)=k=0nf(k)(a)k!(xa)kP_n(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}(x-a)^k

It is the unique polynomial of degree at most nn whose first nn derivatives at aa match those of ff. That matching is the whole design goal: PnP_n agrees with ff in value, slope, curvature, and so on, up to order nn, at the single point aa.

The linear case P1(x)=f(a)+f(a)(xa)P_1(x) = f(a) + f'(a)(x-a) is the tangent line. Taylor’s theorem is what tangent-line approximation grows into.

Taylor’s theorem (Lagrange form). Let ff be n+1n+1 times differentiable on an open interval containing aa and xx. Then there is a point ξ\xi strictly between aa and xx with

f(x)=Pn(x)+f(n+1)(ξ)(n+1)!(xa)n+1f(x) = P_n(x) + \frac{f^{(n+1)}(\xi)}{(n+1)!}(x-a)^{n+1}

Write Rn(x)=f(x)Pn(x)R_n(x) = f(x) - P_n(x) for the remainder. The theorem says RnR_n has exactly the shape of the next term in the pattern, except that the derivative is evaluated at an unknown interior point instead of at aa.

Two things to notice. First, this is an equality, not an estimate - nothing has been thrown away. Second, the only thing unspecified is where ξ\xi sits, and that is precisely the same concession the mean value theorem makes. Taking n=0n = 0 recovers the MVT exactly:

f(x)=f(a)+f(ξ)(xa)f(x) = f(a) + f'(\xi)(x-a)

So Taylor’s theorem is the MVT extended to higher order, and it is proved the same way.

Proof. Fix xax \ne a and choose the number MM so that

f(x)=Pn(x)+M(xa)n+1f(x) = P_n(x) + M(x-a)^{n+1}

which is possible since (xa)n+10(x-a)^{n+1} \ne 0. The claim is that M=f(n+1)(ξ)/(n+1)!M = f^{(n+1)}(\xi)/(n+1)! for some interior ξ\xi.

Let

g(t)=f(t)Pn(t)M(ta)n+1g(t) = f(t) - P_n(t) - M(t-a)^{n+1}

Because PnP_n matches ff to order nn at aa, we get g(a)=g(a)==g(n)(a)=0g(a) = g'(a) = \cdots = g^{(n)}(a) = 0, and by the choice of MM we also get g(x)=0g(x) = 0.

Now apply Rolle repeatedly. Since g(a)=g(x)=0g(a) = g(x) = 0, there is ξ1\xi_1 between them with g(ξ1)=0g'(\xi_1) = 0. Since g(a)=g(ξ1)=0g'(a) = g'(\xi_1) = 0, there is ξ2\xi_2 between those with g(ξ2)=0g''(\xi_2) = 0. Continuing n+1n+1 times produces ξ=ξn+1\xi = \xi_{n+1} strictly between aa and xx with

g(n+1)(ξ)=0g^{(n+1)}(\xi) = 0

But PnP_n has degree at most nn, so its (n+1)(n+1)st derivative vanishes, and the (n+1)(n+1)st derivative of M(ta)n+1M(t-a)^{n+1} is M(n+1)!M(n+1)!. Hence

0=f(n+1)(ξ)M(n+1)!M=f(n+1)(ξ)(n+1)!0 = f^{(n+1)}(\xi) - M(n+1)! \quad\Longrightarrow\quad M = \frac{f^{(n+1)}(\xi)}{(n+1)!}

Subtract off the part you already understand, then apply Rolle. That is the same move as in the MVT proof, iterated. It is worth seeing that the entire content of Taylor’s theorem is Rolle applied n+1n+1 times.

In practice you never know ξ\xi, so you bound the derivative instead. If

f(n+1)(t)Kfor all t between a and x|f^{(n+1)}(t)| \le K \quad \text{for all } t \text{ between } a \text{ and } x

then

Rn(x)K(n+1)!xan+1|R_n(x)| \le \frac{K}{(n+1)!}|x-a|^{n+1}

That is the working form. Everything on the right is computable, and the (n+1)!(n+1)! in the denominator is why Taylor approximation is so effective at short range.

Two separate effects shrink the error:

  • Increasing the degree divides by a larger factorial.
  • Moving xx closer to aa shrinks xan+1|x-a|^{n+1}, and shrinks it faster for larger nn.

The second is why PnP_n is a local tool. Away from aa the factor xan+1|x-a|^{n+1} grows, and for a function whose derivatives are large the bound can be useless.

Letting nn \to \infty gives the Taylor series

k=0f(k)(a)k!(xa)k\sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k!}(x-a)^k

Here is where calculus quietly assumed something false. The series converging is not the same as the series converging to ff. The correct statement is:

The Taylor series converges to f(x)f(x) if and only if Rn(x)0R_n(x) \to 0.

And Rn(x)0R_n(x) \to 0 can fail in two different ways.

The series can diverge. For f(x)=11xf(x) = \frac{1}{1-x} about 0, the series is xk\sum x^k, which diverges for x1|x| \ge 1 even though ff is perfectly well behaved at, say, x=2x = -2.

The series can converge to the wrong function. Define

f(x)={e1/x2x00x=0f(x) = \begin{cases} e^{-1/x^2} & x \ne 0 \\ 0 & x = 0\end{cases}

Every derivative of this function at 0 is 0. So its Taylor series about 0 is the zero series, which converges everywhere - to the zero function, which is not ff. The remainder never goes to zero for x0x \ne 0.

That example is the reason smooth and analytic are different words. A function is smooth if it has derivatives of all orders; it is analytic at aa if it also equals its Taylor series near aa. Analytic implies smooth, and this function shows the converse fails.

There is a weaker but often more convenient statement, requiring only nn derivatives:

f(x)=Pn(x)+o((xa)n)as xaf(x) = P_n(x) + o\big((x-a)^n\big) \quad \text{as } x \to a

meaning Rn(x)/(xa)n0R_n(x)/(x-a)^n \to 0. This says nothing quantitative at a fixed xx, but it is exactly what you want when computing limits, and it is the form behind the standard limit tricks.

Example 1: Build P3P_3 for sinx\sin x about 0 and bound the error at x=0.5x = 0.5.

Solution. Derivatives at 0 cycle 0,1,0,10, 1, 0, -1, so

P3(x)=xx36P_3(x) = x - \frac{x^3}{6}

The fourth derivative is sinx\sin x, so K=1K = 1 works everywhere. Then

R3(0.5)14!(0.5)4=0.0625240.0026|R_3(0.5)| \le \frac{1}{4!}(0.5)^4 = \frac{0.0625}{24} \approx 0.0026

Checking: P3(0.5)=0.50.0208333=0.4791667P_3(0.5) = 0.5 - 0.0208333 = 0.4791667 and sin(0.5)=0.4794255\sin(0.5) = 0.4794255. The true error is about 0.000260.00026, ten times better than the bound.

The bound is honest but not tight, because it assumes the worst possible fourth derivative on the interval. That is typical and acceptable: a guaranteed bound is worth more than a sharp guess.

Example 2: How many terms for ee to six decimal places?

Solution. Take f(x)=exf(x) = e^x, a=0a = 0, x=1x = 1. All derivatives are exe^x, bounded on [0,1][0,1] by e<3e < 3. So

Rn(1)3(n+1)!|R_n(1)| \le \frac{3}{(n+1)!}

We want this below 5×1075 \times 10^{-7}, so we need (n+1)!>6×106(n+1)! > 6 \times 10^6. Since 10!=3,628,80010! = 3{,}628{,}800 and 11!=39,916,80011! = 39{,}916{,}800, take n+1=11n + 1 = 11, that is n=10n = 10.

ek=0101k!=2.718281801e \approx \sum_{k=0}^{10} \frac{1}{k!} = 2.718281801\ldots

against e=2.718281828e = 2.718281828\ldots

This is how a library function decides where to stop. The factorial growth means ten terms buy six digits.

Example 3: Why 11x\frac{1}{1-x} has a radius of only 1.

Solution. f(k)(x)=k!/(1x)k+1f^{(k)}(x) = k!/(1-x)^{k+1}, so f(k)(0)=k!f^{(k)}(0) = k! and the series is xk\sum x^k.

That geometric series converges exactly when x<1|x| < 1. Yet ff is smooth at every x1x \ne 1, including x=3x = -3.

A Taylor series about aa is blind to good behaviour beyond the nearest singularity, even a singularity in the other direction. The radius here is 1 because the pole at x=1x = 1 is at distance 1, and that limit applies symmetrically.

Example 4: A smooth function that is not analytic.

Show the Taylor series of f(x)=e1/x2f(x) = e^{-1/x^2} (with f(0)=0f(0) = 0) about 0 is identically zero.

Solution. For x0x \ne 0, each derivative is e1/x2e^{-1/x^2} times a rational function of xx. At 0, apply the limit definition:

f(0)=limh0e1/h2hf'(0) = \lim_{h\to0}\frac{e^{-1/h^2}}{h}

Substituting t=1/ht = 1/h turns this into limttet2=0\lim_{t\to\infty} t e^{-t^2} = 0, since the exponential beats any power. The same argument, with a higher power of tt, gives f(k)(0)=0f^{(k)}(0) = 0 for every kk.

So Pn0P_n \equiv 0 for all nn, and Rn(x)=f(x)0R_n(x) = f(x) \ne 0 for x0x \ne 0. The remainder does not vanish.

Smooth does not imply analytic. This function is infinitely flat at the origin without being zero near it.

Example 5: Estimate 4.2\sqrt{4.2} with an error bound.

Solution. Take f(x)=xf(x)=\sqrt{x}, a=4a = 4, so f(4)=2f(4) = 2, f(4)=14f'(4) = \tfrac14, f(4)=132f''(4) = -\tfrac{1}{32}.

P2(x)=2+14(x4)164(x4)2P_2(x) = 2 + \tfrac14(x-4) - \tfrac{1}{64}(x-4)^2 P2(4.2)=2+0.050.000625=2.049375P_2(4.2) = 2 + 0.05 - 0.000625 = 2.049375

For the bound, f(x)=38x5/2f'''(x) = \tfrac{3}{8}x^{-5/2}, which on [4,4.2][4, 4.2] is largest at x=4x=4: 381320.01172\tfrac{3}{8}\cdot\tfrac{1}{32} \approx 0.01172. So

R2(4.2)0.011726(0.2)31.6×105|R_2(4.2)| \le \frac{0.01172}{6}(0.2)^3 \approx 1.6\times10^{-5}

The true value is 2.04939022.0493902\ldots, so the actual error is about 1.5×1051.5\times10^{-5}. Here the bound is nearly tight, because the third derivative barely varies on such a short interval.

Example 6: Use Taylor to evaluate a limit.

Find limx0xsinxx3\displaystyle\lim_{x\to0}\frac{x - \sin x}{x^3}.

Solution. From sinx=xx36+o(x3)\sin x = x - \frac{x^3}{6} + o(x^3),

xsinx=x36+o(x3)x - \sin x = \frac{x^3}{6} + o(x^3)

Dividing by x3x^3 gives 16+o(1)16\frac16 + o(1) \to \frac16.

Compare L’Hôpital, which needs three rounds of differentiation. Substituting a Taylor expansion is usually faster and always tells you which term is doing the work.

Example 7: Second-derivative test, derived.

Suppose f(a)=0f'(a) = 0 and f(a)>0f''(a) > 0. Show aa is a local minimum.

Solution. Taylor with n=1n=1 gives, for some ξ\xi between aa and xx,

f(x)=f(a)+f(a)(xa)+f(ξ)2(xa)2=f(a)+f(ξ)2(xa)2f(x) = f(a) + f'(a)(x-a) + \frac{f''(\xi)}{2}(x-a)^2 = f(a) + \frac{f''(\xi)}{2}(x-a)^2

If ff'' is continuous at aa and positive there, it stays positive on some interval around aa. For xx in that interval, ξ\xi lies in it too, so the last term is positive and f(x)>f(a)f(x) > f(a). ∎

The second-derivative test is Taylor’s theorem at n=1n=1. It also shows why the test is silent when f(a)=0f''(a)=0: the sign information came from that term, and there is none.

Numerical libraries. Evaluating sin\sin, exp\exp, or log\log in hardware or software means reducing the argument to a small range and then using a polynomial. The degree is chosen from a remainder bound like Example 2, so the routine can promise a result correct to the last bit.

Finite-difference methods. Every discretization of a derivative, and the order of accuracy quoted for it, comes from expanding in Taylor series and seeing which terms cancel. The leading uncancelled term is the error term.

Physics linearization. The small-angle approximation sinθθ\sin\theta \approx \theta that makes the pendulum solvable is P1P_1, and the remainder bound tells you the angle at which the model stops being trustworthy.

Optimization. Newton’s method is built by minimizing P2P_2 at each step, and the quadratic convergence rate comes from the size of R2R_2. Quasi-Newton methods are approximations of the same quadratic model.

Computer graphics and audio. Polynomial approximation of transcendental functions is standard where a per-sample or per-pixel cost matters, and the acceptable degree is set by an error budget.

Error propagation in measurement. Expanding a formula to first order in its inputs is exactly how uncertainty is propagated through a calculation; the second-order remainder is what tells you when the linear rule is inadequate.

What characterizes the nth Taylor polynomial of f about a?
What is the Lagrange form of the remainder Rₙ(x)?
Which theorem is Taylor's theorem proved from?
For f(x) = sin x with a = 0, what does the Lagrange bound give for |R₃(0.5)|?
Under what condition does the Taylor series of f converge to f(x)?
What does the function e^(−1/x²), extended by 0 at the origin, demonstrate?
Why does increasing the degree improve a Taylor approximation so quickly at short range?
How does Taylor's theorem justify the second-derivative test?