Tutorials › Calculus II › Exponential Approximation With Lagrange Bounds

Remainders and Error Estimates · Tutorial 854 of 998

Exponential Approximation With Lagrange Bounds

Use the exponential’s derivatives to obtain a certified error bound, then select a Taylor degree that meets a specified tolerance.

Advanced 12 min read

What You'll Learn

  • Write the degree-n Taylor polynomial for the exponential function at zero.
  • Apply Lagrange’s remainder theorem on an interval from zero to a positive input.
  • Use the bound on the derivative to obtain an explicit error estimate.
  • Choose a degree that guarantees a requested absolute accuracy.
  • Distinguish a valid derivative bound from an unjustified underestimate.

Approximating the Exponential With a Guarantee

The Taylor polynomial for the exponential function gives a natural finite approximation to \(e^x\). But a computed polynomial value alone does not say how accurate that approximation is. To certify accuracy, we need an upper bound on the error.

For nonnegative inputs, the derivatives of \(e^x\) are especially useful: every derivative is again the exponential function. On an interval from zero to a positive endpoint, the derivative is largest at that endpoint. Lagrange’s remainder theorem therefore gives a direct way to bound the error and choose a polynomial degree.

The Taylor Polynomial and Lagrange Remainder

Definition: The degree-\(n\) Taylor polynomial of \(e^x\) at zero is $$ P_n(x)=\sum_{k=0}^{n}\frac{x^k}{k!} =1+x+\frac{x^2}{2!}+\cdots+\frac{x^n}{n!}. $$ The approximation error at \(x\) is \(R_n(x)=e^x-P_n(x)\).

Lagrange’s remainder theorem states that if a function has continuous derivatives through order \(n+1\) on the interval between its center and the input, then its Taylor remainder has the form

$$ R_n(x)=\frac{f^{(n+1)}(c)}{(n+1)!}x^{n+1} $$

for some point \(c\) between the center and \(x\). We use this theorem for \(f(x)=e^x\), whose derivatives of every order are continuous and satisfy \(f^{(n+1)}(t)=e^t\).

Theorem: If \(0\le x\le b\), where \(b>0\), then $$ |e^x-P_n(x)| \le \frac{e^b x^{n+1}}{(n+1)!} \le \frac{e^b b^{n+1}}{(n+1)!}. $$

Why the Bound Works

For \(x>0\), Lagrange’s theorem gives a \(c\) with \(0<c<x\) such that

$$ e^x-P_n(x)=\frac{e^c x^{n+1}}{(n+1)!}. $$

Since \(x\le b\), the point \(c\) lies in \([0,b]\). The exponential is increasing, so \(e^c\le e^b\). Also, \(x^{n+1}\le b^{n+1}\). All quantities are nonnegative, so substituting these inequalities into the remainder expression gives

$$ |e^x-P_n(x)| =\frac{e^c x^{n+1}}{(n+1)!} \le \frac{e^b x^{n+1}}{(n+1)!} \le \frac{e^b b^{n+1}}{(n+1)!}. $$

At \(x=0\), the error is exactly zero, so the bound holds there as well. The first bound in the theorem uses the actual input \(x\) in the power; the second uses the endpoint \(b\) in both places and is convenient when one wants a single guarantee across the interval \([0,b]\).

For a single positive input, take \(b=x\). The resulting bound is

$$ |e^x-P_n(x)|\le \frac{e^x x^{n+1}}{(n+1)!}. $$

This is an absolute error bound: it limits the size of the difference between the exact value and the polynomial value. It does not, by itself, give the sign of that difference.

Choosing a Degree From a Tolerance

Suppose the desired absolute error is less than a positive tolerance \(\varepsilon\). A degree \(n\) is certified by the endpoint bound on \([0,b]\) whenever

$$ \frac{e^b b^{n+1}}{(n+1)!}<\varepsilon. $$

This is a sufficient test: if it holds, the error is guaranteed to be below the tolerance. If it does not hold, the bound has not certified the requested accuracy; that alone does not prove the actual error is too large.

For fixed \(b\), the endpoint bounds eventually decrease as \(n\) increases. In fact, if \(B_n=e^b b^{n+1}/(n+1)!\), then

$$ \frac{B_{n+1}}{B_n}=\frac{b}{n+2}. $$

Once \(n+2>b\), this ratio is less than one. In practice, test successive degrees until the bound falls below the tolerance. To claim that a degree is the smallest one certified by this bound, also check that the preceding degree fails the test.

Worked Examples

Worked Example: Approximate \(e^{1/2}\) Within \(0.001\)

Use the degree-four polynomial and set \(b=x=1/2\). Its value is

$$ \begin{aligned} P_4\left(\frac12\right) &=1+\frac12+\frac{(1/2)^2}{2!} +\frac{(1/2)^3}{3!}+\frac{(1/2)^4}{4!}\\ &=1+\frac12+\frac18+\frac1{48}+\frac1{384}\\ &=\frac{384+192+48+8+1}{384}\\ &=\frac{633}{384}=\frac{211}{128}=1.6484375. \end{aligned} $$

For the error bound, use \(e^{1/2}<2\). This follows, for example, from \(e<3<4\), which implies \(e^{1/2}<2\). Lagrange’s bound gives

$$ \begin{aligned} \left|e^{1/2}-P_4\left(\frac12\right)\right| &\le \frac{e^{1/2}(1/2)^5}{5!}\\ &<\frac{2}{32\cdot120} =\frac1{1920} \approx 0.000520834 <0.001. \end{aligned} $$

Thus \(1.6484375\) is guaranteed to approximate \(e^{1/2}\) to within \(0.001\). The check is that the stated error bound is less than the requested tolerance.

Worked Example: Find a Degree for \(e^2\) With Error Below \(0.001\)

Here the input and endpoint are both \(2\). We use the convenient inequalities \(e^2<8\) and \(e^2>4\). For example, \(2<e<11/4\) implies \(4<e^2<121/16<8\). The upper bound can be verified from the exponential series: the terms through degree three sum to \(8/3\), and the tail from degree four onward is at most

$$ \frac1{4!}\sum_{j=0}^{\infty}\left(\frac14\right)^j =\frac1{18}, \qquad \frac83+\frac1{18}=\frac{49}{18}<\frac{11}{4}. $$

For degree nine, the error bound is larger than \(0.001\), because

$$ \frac{e^2\,2^{10}}{10!} > \frac{4\cdot1024}{3,628,800} \approx 0.001128 >0.001. $$

Degree nine is therefore not certified. For degree ten, the bound satisfies

$$ \frac{e^2\,2^{11}}{11!} < \frac{8\cdot2048}{39,916,800} =\frac{16,384}{39,916,800} \approx 0.000411 <0.001. $$

Thus degree ten is the smallest degree certified by this bound. To evaluate the polynomial, the terms are

$$ \begin{aligned} P_{10}(2) &=1+2+2+\frac43+\frac23+\frac4{15} +\frac4{45}+\frac{16}{630}\\ &\quad+\frac{16}{2520}+\frac{512}{362,880} +\frac{1024}{3,628,800}\\ &\approx 7.388994708995. \end{aligned} $$

The displayed decimal is rounded to 12 decimal places. The Taylor remainder theorem and the degree-ten bound guarantee that this polynomial value differs from \(e^2\) by less than \(0.001\).

Worked Example: Find a Degree for \(e\) With Error Below \(0.00001\)

Set \(x=b=1\). For degree eight, the endpoint bound is \(e/9!\). Since \(e<3\),

$$ \frac{e}{9!}<\frac{3}{362,880} \approx 0.000008268 <0.00001. $$

To check that degree seven does not meet the same bound test, note that \(e>1\). Hence

$$ \frac{e}{8!}>\frac1{40,320} \approx 0.000024802 >0.00001. $$

The bounds decrease with increasing degree here, since their successive ratio is \(1/(n+2)<1\). Therefore degree eight is the smallest degree certified by this test. Its polynomial value is

$$ \begin{aligned} P_8(1) &=1+1+\frac12+\frac16+\frac1{24}+\frac1{120} +\frac1{720}+\frac1{5040}+\frac1{40320}\\ &=\frac{109,601}{40,320}\\ &\approx 2.7182787698. \end{aligned} $$

The decimal is rounded to 10 decimal places. The bound \(e/9!<0.00001\) verifies that this approximation has the requested accuracy.

A Common Mistake: Using the Wrong Derivative Maximum

For an input of \(2\), the relevant interval is \([0,2]\), not \([0,1]\). The \((n+1)\)st derivative is \(e^t\), and its maximum on \([0,2]\) is \(e^2\).

A mistaken calculation might use \(e\) as the derivative bound and claim, for degree ten, that

$$ \frac{e\,2^{11}}{11!}<\frac{3\cdot2048}{39,916,800} \approx 0.000154<0.0002. $$

This does not provide a valid guarantee: \(e^t\) reaches \(e^2\) at the endpoint \(t=2\), so \(e\) is not an upper bound for the derivative on the interval. The correct bound is

$$ \frac{e^2\,2^{11}}{11!} > \frac{4\cdot2048}{39,916,800} \approx 0.000205 >0.0002. $$

Degree ten therefore does not pass this stricter test. Degree eleven does, since

$$ \frac{e^2\,2^{12}}{12!} < \frac{8\cdot4096}{479,001,600} \approx 0.000069 <0.0002. $$

The correction is to bound the derivative over the entire interval from zero to the input. For \(0\le t\le b\), use \(e^t\le e^b\).

Why the Method Is Useful

A polynomial approximation is useful in computation, but a remainder bound makes it possible to state what the computation guarantees. For an input in \([0,b]\), the single bound \(e^b b^{n+1}/(n+1)!\) controls the error throughout that interval. For a single input, using \(x\) in place of \(b\) can give a more specific estimate.

The method also makes clear what a failed bound means. If a proposed degree does not make the bound smaller than the tolerance, the conclusion is only that this particular estimate is insufficient. A higher degree can reduce the bound; alternatively, a sharper bound on the derivative may help. The essential requirement is that the derivative bound used really applies everywhere between the center and the input.

Check Your Understanding

Use Lagrange’s remainder bound to answer these questions. When selecting a degree, distinguish a bound that certifies the tolerance from one that merely fails to certify it.

  1. Write \(P_3(x)\), the degree-three Taylor polynomial for \(e^x\) at zero.
  2. State an upper bound for \(|e^x-P_n(x)|\) when \(0\le x\le b\).
  3. For a fixed endpoint \(b\), what is the ratio of the degree-\((n+1)\) endpoint bound to the degree-\(n\) endpoint bound?
  4. Why is \(e\) not a valid upper bound for the derivatives of \(e^t\) on the interval \([0,2]\)?
  5. If a Lagrange bound exceeds a requested tolerance, what can and cannot be concluded about the actual error?