Lagrange Error Bound Calculator
Enter the degree of the Taylor polynomial, the evaluation point, the center of the expansion, and the maximum absolute value of the next derivative to find the largest possible error in your Taylor approximation. The result updates instantly as you type, and the show-your-work panel walks through every step of the calculation.
Formula
Worked example
Approximate sin(pi/3) using a 4th-degree Taylor polynomial centered at a = pi/6. The maximum absolute value of the 5th derivative of sin is 1 (since all derivatives of sin are bounded by 1), so M = 1. Distance: |pi/3 - pi/6| = pi/6 approx 0.5236. Error bound = 1 x (0.5236)^5 / 5! = 0.03956 / 120 approx 0.000330. The actual error is about 0.000266, confirming the bound holds.
What is the Lagrange error bound?
When you approximate a function with a Taylor polynomial of degree n, you introduce some error because the polynomial is not the function itself - it is merely an approximation that agrees with the function and its first n derivatives at the center point a. The Lagrange error bound, also called the Taylor remainder theorem, gives you the worst-case size of that error at any evaluation point x. The formula is e_max = M * |x - a|^(n+1) / (n+1)!, where M is the maximum absolute value of the (n+1)th derivative of the function on the interval between a and x. If the true error ever exceeds this bound, something has gone wrong with how M was estimated.
How to find M for common functions
M is the hardest part of the formula. For sin(x) and cos(x), every derivative is itself a sine or cosine, so the absolute value is always at most 1 and M = 1 for any interval. For e^x, the (n+1)th derivative is still e^x, so M = e^(max endpoint). For ln(1+x), the (n+1)th derivative grows quickly as x approaches -1, so use the maximum of the absolute value on the closed interval [a, x] or [x, a]. When in doubt, take the derivative symbolically or numerically on a fine grid and choose the largest absolute value you observe on that interval.
How this calculator works
Enter the four values into the calculator above and the error bound appears instantly. The degree n is the highest power in your Taylor polynomial. The evaluation point x is where you want to use the approximation. The center a is the point around which the Taylor series was built. M is the maximum absolute value of the (n+1)th derivative over the interval from a to x. The calculator computes M * |x - a|^(n+1) / (n+1)! and also shows you the intermediate values: the distance |x - a|, the power (n+1), and the factorial (n+1)!. The chart below the result shows how the bound shrinks as you increase the polynomial degree, which illustrates why higher-degree Taylor polynomials are far more accurate far from the center.
Practical tips for tighter error bounds
Three strategies reduce the Lagrange error bound without changing the function. First, increase the polynomial degree n: each extra term shrinks the bound by a factor of roughly |x - a| / (n+2), and factorials grow faster than powers, so convergence is rapid. Second, choose a center a closer to the evaluation point x: the bound scales with |x - a|^(n+1), so halving that distance cuts the bound by 2^(n+1). Third, use a tighter estimate of M: if you can show that the derivative is bounded by a smaller number on the actual interval, the bound tightens proportionally. In AP Calculus BC problems, M is usually given or easy to bound because the function is one of the standard examples (sin, cos, e^x, ln).
Example error bounds for sin(x) approximated at x = pi/3, center a = pi/6
| Degree (n) | Error bound | Accuracy |
|---|---|---|
| 1 | 0.118712 | Poor |
| 2 | 0.013882 | Low |
| 3 | 0.001213 | Moderate |
| 4 | 0.000284 | Good |
| 6 | 0.0000041 | Excellent |
| 10 | 1.76 x 10^-11 | Excellent |
The maximum absolute value of any derivative of sin(x) is 1, so M = 1 for all degrees. Error bound = |x - a|^(n+1) / (n+1)!
Frequently asked questions
What does the Lagrange error bound tell you?
It gives you the maximum possible absolute error when you use a degree-n Taylor polynomial to approximate a function at a point x. The true error |f(x) - P_n(x)| is guaranteed to be less than or equal to M * |x - a|^(n+1) / (n+1)!. If the bound is small, the polynomial is a reliable stand-in for the function. If the bound is large, you need a higher-degree polynomial or a center closer to x.
How do I find M in the Lagrange error bound formula?
M is the maximum absolute value of the (n+1)th derivative of the function on the closed interval between a and x. For sin(x) and cos(x) every derivative is bounded by 1, so M = 1. For e^x, M = e^(|x| or |a|, whichever is larger). For other functions, differentiate n+1 times, then find the maximum of that expression on the interval. In many textbook problems a bound for M is given to you directly.
Why does increasing the polynomial degree reduce the error?
The error formula has (n+1)! in the denominator. Factorials grow much faster than any power, so as n increases, (n+1)! eventually dominates |x - a|^(n+1) and the bound collapses toward zero. This is why Taylor series for smooth functions converge: more terms always mean a tighter error guarantee, as long as M does not grow too fast with n.
Is the Lagrange error bound the actual error or just a worst case?
It is a worst-case upper bound. The true error is often much smaller. For sin(x) approximated by a degree-4 polynomial in the worked example, the bound is about 0.000284 but the actual error is only 0.000266. The bound is guaranteed to hold, but it can be conservative, especially if your choice of M is not tight.
What is the difference between the Lagrange error bound and the alternating series error bound?
They apply in different situations. The alternating series error bound applies only to alternating series where the absolute values of the terms decrease to zero - in that case the error is bounded by the absolute value of the first omitted term. The Lagrange error bound is more general and works for any smooth function, whether or not the series alternates. When both apply, the alternating series bound is often simpler to compute.
Can the error bound ever be larger than the actual function value?
Yes. If the evaluation point x is far from the center a, or if you use a low-degree polynomial, the bound can be larger than the function itself. The bound does not say the approximation is good - only that the error cannot exceed it. A large bound just tells you to use a higher-degree polynomial or a closer center.