Tutorials › Calculus II › Selecting Degree from Truncation Error

Taylor Methods in Computation · Tutorial 877 of 998

Selecting Degree from Truncation Error

Turn a stated error tolerance into a justified Taylor degree using a remainder bound that applies to the function and evaluation point.

Advanced 10 min read

What You'll Learn

  • Translate an absolute error tolerance into a degree-selection test.
  • Apply the Lagrange remainder bound at a specified distance from the center.
  • Select a degree using an alternating-series remainder bound when the Taylor series sums to the function value.
  • Check whether a candidate degree meets the tolerance and whether a lower degree fails the same bound.
  • Distinguish polynomial degree from the number of nonzero terms retained.

From an Accuracy Target to a Taylor Degree

A Taylor polynomial is useful in computation only if its error is small enough for the task. Often the target is stated first: approximate a function value at a specified point with absolute error at most a given tolerance. The practical question is then not merely how to form a polynomial, but how many terms to retain to guarantee that tolerance.

The degree-selection process depends on an error bound. A bound is a guarantee, not usually the exact error: if it is larger than the tolerance, the approximation might still be accurate enough, but that bound has not certified it. Conversely, if the bound is at most the tolerance, the requested accuracy is guaranteed, assuming the bound’s hypotheses hold.

Definition: Let \(T_n(x)\) be the Taylor polynomial of degree \(n\) for \(f\) about a center \(a\). An absolute tolerance \(\varepsilon>0\) is met at a specified evaluation point \(x\) when \[ |f(x)-T_n(x)|\leq \varepsilon. \] A remainder estimate certifies the tolerance if it gives an upper bound for this error that is no greater than \(\varepsilon\).

The distance from the center matters: Taylor remainder bounds contain a factor involving \(|x-a|^{n+1}\). A degree that is adequate near the center may not be adequate farther away. The examples below treat the evaluation point and tolerance as fixed, then test candidate degrees using a suitable bound.

The Lagrange-Bound Selection Test

Suppose \(f\) has continuous derivatives through order \(n+1\) on the closed interval between \(a\) and \(x\). If a number \(M\) satisfies \(|f^{(n+1)}(t)|\leq M\) throughout that interval, Taylor’s theorem gives the Lagrange remainder estimate

$$ |f(x)-T_n(x)| \leq \frac{M|x-a|^{n+1}}{(n+1)!}. $$

Thus, a candidate degree \(n\) is certified whenever the right-hand side is at most \(\varepsilon\). The derivative bound \(M\) can depend on the candidate degree, because each degree uses a derivative of a different order. Recalculate or justify the bound for each candidate rather than assuming it stays the same.

A useful workflow is to start with a low degree, evaluate a valid remainder bound, and increase the degree until the bound falls below the tolerance. To claim that this is the smallest degree certified by the chosen bound, also check that the bound for the preceding degree exceeds the tolerance. That comparison concerns the chosen estimate; it need not prove that a lower-degree polynomial’s actual error is too large.

Worked Example: An Exponential Approximation at Distance One-Half

Approximate \(e^{1/2}\) by its Maclaurin polynomial and find a degree certified to have absolute error at most \(10^{-4}\). For every nonnegative integer \(k\), the \(k\)-th derivative of \(e^t\) is \(e^t\). On \(0\leq t\leq 1/2\), \(e^t\leq e^{1/2}<2\), so we may use \(M=2\) for every candidate remainder order.

For degree \(4\), the bound uses the fifth derivative and the factor \((1/2)^5/5!\):

$$ |R_4(1/2)| \leq \frac{2(1/2)^5}{5!} =\frac{2}{32\cdot120} =\frac{1}{1920} \approx 0.0005208 >0.0001. $$

Degree \(4\) is not certified by this bound. For degree \(5\):

$$ |R_5(1/2)| \leq \frac{2(1/2)^6}{6!} =\frac{2}{64\cdot720} =\frac{1}{23040} \approx 0.00004340 <0.0001. $$

Therefore degree \(5\) meets the requested tolerance. Its polynomial value is

$$ T_5(1/2) =1+\frac12+\frac{(1/2)^2}{2!} +\frac{(1/2)^3}{3!} +\frac{(1/2)^4}{4!} +\frac{(1/2)^5}{5!} =\frac{6331}{3840} \approx 1.6486979. $$

The degree and arithmetic check are consistent with the certificate: the stated approximation is the sum of the six terms through degree \(5\), and the Lagrange bound guarantees its distance from \(e^{1/2}\) is less than \(0.0001\). Degree \(4\) fails the same conservative test, so degree \(5\) is the first degree certified by this particular bound.

Using an Alternating-Series Bound

For some Taylor series, the terms at the evaluation point alternate in sign and decrease in magnitude to zero. If the series converges to \(f(x)\) at that point, the alternating-series estimate says that the error after truncation is no greater than the magnitude of the first omitted term.

Theorem: Suppose \(f(x)=\sum_{k=0}^{\infty}(-1)^k b_k\), where \(b_k\geq0\), \(b_k\) is nonincreasing, and \(b_k\to0\). Then the error after keeping terms through index \(m\) satisfies \[ \left|f(x)-\sum_{k=0}^{m}(-1)^k b_k\right|\leq b_{m+1}. \] For Taylor approximation, this gives a bound for \(|f(x)-T_n(x)|\) only when the Taylor series converges to \(f(x)\) at the evaluation point.

The convergence-to-\(f(x)\) condition is essential. Alternating-series reasoning by itself bounds the difference between a partial sum and the sum of the series; it does not establish that the series sum equals the function value. One way the estimate works is that consecutive partial sums bracket the series sum: the even partial sums move in one direction, the odd partial sums in the other, and the gap between consecutive partial sums is the next term. As the terms tend to zero, the limit lies within one next-term gap of either partial sum. If that limit is \(f(x)\), the desired function error is bounded too.

For Taylor series with zero coefficients, inspect the nonzero terms in order. The first omitted nonzero term may have degree greater than \(n+1\). The alternating bound uses that term’s magnitude, provided the signed terms alternate and decrease as required.

Worked Example: Choosing a Degree for the Cosine Series

Approximate \(\cos(0.6)\) with absolute error at most \(10^{-4}\). The Maclaurin series is \(\sum_{k=0}^{\infty}(-1)^k x^{2k}/(2k)!\), and it converges to \(\cos x\) for every real \(x\). At \(x=0.6\), its nonzero term magnitudes decrease: the ratio of a term to its predecessor is \[ \frac{0.6^{2k+2}/(2k+2)!}{0.6^{2k}/(2k)!} =\frac{0.36}{(2k+2)(2k+1)}<1 \quad(k\geq0). \] Thus the alternating-series estimate applies to the function error.

The degree-\(2\) polynomial keeps \(1-x^2/2!\); its first omitted term has magnitude

$$ \frac{0.6^4}{4!}=\frac{0.1296}{24}=0.0054>0.0001. $$

For degree \(4\), the next nonzero term has degree \(6\), so the bound is

$$ \frac{0.6^6}{6!}=\frac{0.046656}{720}=0.0000648<0.0001. $$

Hence degree \(4\) is certified, while degree \(2\) is not certified by this estimate. The intervening degree-\(3\) Taylor polynomial equals the degree-\(2\) polynomial, since the coefficient of \(x^3\) is zero; it has the same first omitted nonzero term and does not meet the bound. The approximation is \[ T_4(0.6)=1-\frac{0.36}{2}+\frac{0.1296}{24} =1-0.18+0.0054=0.8254. \] The computed polynomial value and first omitted term verify the calculation: the alternating-series guarantee places \(\cos(0.6)\) within \(0.0000648\) of \(0.8254\).

A Second Alternating-Series Selection

The same approach works when the terms are not powers of a single even exponent, as long as the hypotheses are checked at the chosen evaluation point. The following example also illustrates that the first omitted term determines the degree test directly.

Worked Example: Approximating a Logarithm at One-Third

Choose a Taylor degree to approximate \(\ln(1+1/3)\) with absolute error at most \(10^{-4}\). For \(|x|<1\), the Taylor series \[ \ln(1+x)=\sum_{k=1}^{\infty}(-1)^{k+1}\frac{x^k}{k} \] converges to \(\ln(1+x)\). At \(x=1/3\), the term magnitudes \(b_k=(1/3)^k/k\) decrease to zero, since \[ \frac{b_{k+1}}{b_k}=\frac{k}{3(k+1)}<1. \] The alternating-series estimate therefore bounds the error in approximating the logarithm itself.

A degree-\(5\) Taylor polynomial retains terms through \(k=5\). Its first omitted term has magnitude

$$ b_6=\frac{(1/3)^6}{6} =\frac{1}{729\cdot6} =\frac{1}{4374} \approx 0.0002286>0.0001. $$

For degree \(6\), the first omitted term has magnitude

$$ b_7=\frac{(1/3)^7}{7} =\frac{1}{2187\cdot7} =\frac{1}{15309} \approx 0.00006532<0.0001. $$

Thus degree \(6\) is the first degree certified by this bound. Evaluating its polynomial gives

$$ T_6(1/3) =\frac13-\frac1{18}+\frac1{81}-\frac1{324} +\frac1{1215}-\frac1{4374} =\frac{12581}{43740} \approx 0.287631. $$

The bound \(1/15309\) verifies that this computed value differs from \(\ln(4/3)\) by less than \(10^{-4}\). The degree-\(5\) bound is larger than the tolerance, so it does not certify degree \(5\).

Choosing Between the Bounds

The Lagrange and alternating-series approaches answer the same practical question, but they require different information. A derivative bound can be used even when the Taylor series is not known to converge to the function at the evaluation point. The alternating estimate can be sharper for a suitable series, but requires both the alternating, decreasing-term conditions and convergence of that series to the function value.

MethodWhat must be checkedDegree test
Lagrange remainderThe required derivatives exist on the interval, and the derivative of order \(n+1\) has a valid bound \(M\).\(M|x-a|^{n+1}/(n+1)!\leq\varepsilon\).
Alternating-series remainderThe series represents \(f(x)\) there; its terms alternate, decrease in magnitude, and tend to zero.The first omitted term’s magnitude is at most \(\varepsilon\).

In either method, test the actual evaluation point and candidate degree. If a bound is not small enough, that does not prove the approximation is inaccurate; it means only that this bound has not supplied the requested guarantee. Another valid bound may certify the same degree, or a higher degree may be needed.

Common Pitfall: Bounding a Series Is Not Yet Bounding the Function Error

A common error is to observe alternating Taylor terms and immediately apply the first-omitted-term estimate to \(|f(x)-T_n(x)|\). That conclusion skips an important step: the estimate first controls the error relative to the sum of the series. Unless that sum is known to equal \(f(x)\) at the evaluation point, it does not give the required function error.

Correction: Before using the alternating-series estimate as a Taylor remainder bound, verify that the Taylor series converges to the function value at the point. If that fact is unavailable, use a remainder estimate that directly bounds \(|f(x)-T_n(x)|\), such as a valid Lagrange bound.

Another useful distinction is between the smallest degree certified by an estimate and the smallest degree that actually achieves the tolerance. A conservative bound can fail its test even when the true error is small. Degree selection is therefore a guarantee based on stated assumptions, not a claim that every lower-degree approximation must fail.

Check Your Understanding

For each question, identify which condition or calculation is needed to justify the degree choice.

  1. For a degree-\(n\) Taylor polynomial centered at \(a\), what derivative and interval information is needed to apply the Lagrange remainder bound at \(x\)?
  2. If the Lagrange bound at degree \(n\) is below the tolerance, what has been established? What has not necessarily been established about degree \(n-1\)?
  3. Why does an alternating Taylor series with decreasing terms not automatically bound the difference between \(f(x)\) and its Taylor polynomial?
  4. For \(\cos x\), why can a degree-\(3\) Taylor polynomial have the same first omitted nonzero term as the degree-\(2\) polynomial?
  5. When selecting a degree using an alternating-series bound, which term’s magnitude is compared with the tolerance?