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
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
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\).
Why the Bound Works
For \(x>0\), Lagrange’s theorem gives a \(c\) with \(0<c<x\) such that
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
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
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
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
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
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
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
For degree nine, the error bound is larger than \(0.001\), because
Degree nine is therefore not certified. For degree ten, the bound satisfies
Thus degree ten is the smallest degree certified by this bound. To evaluate the polynomial, the terms are
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\),
To check that degree seven does not meet the same bound test, note that \(e>1\). Hence
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
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
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
Degree ten therefore does not pass this stricter test. Degree eleven does, since
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.
- Write \(P_3(x)\), the degree-three Taylor polynomial for \(e^x\) at zero.
- State an upper bound for \(|e^x-P_n(x)|\) when \(0\le x\le b\).
- For a fixed endpoint \(b\), what is the ratio of the degree-\((n+1)\) endpoint bound to the degree-\(n\) endpoint bound?
- Why is \(e\) not a valid upper bound for the derivatives of \(e^t\) on the interval \([0,2]\)?
- If a Lagrange bound exceeds a requested tolerance, what can and cannot be concluded about the actual error?