Advertisement
Advertisement
CALCULUS

Lagrange Error Bound Calculator — how wrong a Taylor polynomial can be

Bound the remainder of a Taylor approximation, compare that bound against the error the polynomial actually makes, and find the lowest degree that meets a tolerance you set.

For the five named functions the tool derives the derivative bound M on the interval for you and also computes the true error, so you can see the bound holding.
The point the series is expanded about. A Maclaurin series is the case a = 0.
Where you want the approximation. The bound grows like the distance from a raised to the power n plus one.
The remainder term uses the derivative of order n plus one, so degree 3 needs the fourth derivative.
The tool reports the smallest degree whose Lagrange bound falls below this, searching up to degree 20.
Lagrange error bound
 
Polynomial value Pn(x)
True value f(x)
Actual error
Degree needed for tolerance
Working:
Tip: the bound is a guarantee, not an estimate. It is usually several times larger than the error the polynomial actually makes, and that gap is the price of a result that holds for every point in the interval rather than just the one you asked about.
Advertisement

The Lagrange error bound calculator above answers the question a Taylor polynomial always raises and rarely answers on its own: how far from the truth can this approximation be? It computes the remainder bound M × |x − a|n+1 ÷ (n+1)!, and for the named functions it also computes the error the polynomial actually makes, so you can watch the bound sit above it instead of taking the inequality on trust.

Arb Digital publishes it because the bound is the part of Taylor's theorem students skip and engineers cannot. A polynomial approximation with no error bound is a guess with good manners. Our series sum calculator adds up the terms of a series; this page tells you how much of the function is still missing after you stop adding.

What This Lagrange Error Bound Calculator Does

It takes a centre a, an evaluation point x, and a degree n, and returns the Lagrange remainder bound for the degree-n Taylor polynomial of your chosen function. For sine, cosine, the exponential, the natural logarithm of one plus x, and the geometric function one over one minus x, it works out the derivative bound M itself, using the exact form of the (n+1)th derivative rather than a rule of thumb.

Alongside the bound it evaluates the polynomial and the function, so the third grid cell shows the real error. Comparing the two is the fastest way to develop a feel for how loose the bound is. For sine at x = 1 with a cubic polynomial the bound is about 0.0417 and the true error about 0.0081, a factor of five. That looseness is not a defect: the bound has to cover the worst point in the interval and the worst intermediate derivative value, and it does.

The fourth cell searches upward from degree zero for the lowest degree whose bound falls under the tolerance you set. That is the question that actually gets asked in practice — not "how bad is degree five" but "what degree do I need for four decimal places" — and it is tedious to do by hand because the factorial in the denominator makes the bound fall in jumps rather than smoothly.

How to Use It

  1. Choose the function, or pick the custom option if you are working with something not on the list and will supply your own M.
  2. Set the centre and the evaluation point. The distance between them drives everything; doubling it multiplies the bound by two to the power n plus one.
  3. Set the degree of the polynomial you are actually using. The remainder always involves the next derivative up, so degree 3 needs the fourth.
  4. Read the bound and the actual error together. If the actual error ever exceeds the bound, the M you supplied is wrong.
  5. Set a tolerance to have the tool find the smallest sufficient degree instead of guessing at one.

The Formula and How It Is Calculated

Taylor's theorem states that for a function with n+1 continuous derivatives, f(x) equals the degree-n Taylor polynomial about a plus a remainder Rn, and that the remainder can be written Rn = f(n+1)(c) × (x − a)n+1 ÷ (n+1)! for some c strictly between a and x. The NIST Digital Library of Mathematical Functions gives that statement in section 1.4(vi), Taylor's theorem for real variables, in exactly this form.

The catch is that nobody knows what c is. Taylor's theorem asserts it exists and says nothing about where. The Lagrange error bound replaces the unknown derivative value with M, the maximum of the absolute value of the (n+1)th derivative anywhere between a and x, which turns the exact equality into the inequality |Rn| ≤ M × |x − a|n+1 ÷ (n+1)!. Wolfram MathWorld's page on the Lagrange remainder states the same expression with the intermediate point written as x star.

Work the default through by hand. For sin x about a = 0 with n = 3, every derivative of sine is a sine or a cosine, so their absolute values never exceed 1 and M = 1. The bound is 1 × 14 ÷ 4! = 1 ÷ 24 = 0.0416667. The cubic Maclaurin polynomial is x − x³/6, which at x = 1 gives 0.8333333. The true value of sin 1 is 0.8414710. The actual error is 0.0081377, comfortably inside the bound.

Advertisement

Where M Comes From, and Why It Is the Hard Part

Everything in the bound except M is arithmetic. M is analysis, and it is where most mistakes live. For sine and cosine it is easy: every derivative is one of four functions, all bounded by 1, so M = 1 regardless of the interval or the degree. For the exponential the (n+1)th derivative is the exponential again, so M is e raised to the larger endpoint of the interval — it depends on where you are working but not on the degree.

For ln(1 + x) the (n+1)th derivative has absolute value n! divided by (1 + t) to the power n+1, which is largest where 1 + t is smallest. So M is set by the endpoint closest to x = −1, and it grows rapidly as you approach the singularity there. For one over one minus x, the (n+1)th derivative is (n+1)! divided by (1 − t) to the power n+2, and M is set by the endpoint nearest x = 1. The tool derives all of these directly rather than sampling.

Two rules follow. If the interval between a and x contains a point where the function or a derivative blows up, no finite M exists and the bound is meaningless — the tool detects this and says so in words. And if you supply your own M in custom mode, an M chosen too small produces a bound the actual error can exceed, which is not a small error but a false guarantee. Our factorial calculator is useful for checking the denominator by hand when the degree gets large.

Why the Bound Is Usually Loose, and When It Is Tight

Two approximations stack up. First, the true remainder uses f(n+1) at one specific unknown point c, and M replaces it with the worst value anywhere in the interval. Second, for an alternating series the successive terms partly cancel, so the real error is often close to the first omitted term while the bound is closer to its magnitude at the worst point. The result is that a factor of two to ten between bound and reality is entirely normal.

The bound tightens in two circumstances. When x is close to a, the interval is short, M is nearly the derivative at a itself, and the bound converges on the first omitted term. And when the function's derivatives are genuinely constant in magnitude — the exponential over a short interval, or sine and cosine where M is exactly 1 — there is nothing lost in replacing f(n+1)(c) by M except the sign and the specific point.

Notice also what the bound is not. It is not an estimate of the error, and using it as one will make you carry more terms than you need. It is a certificate: whatever the true error is, it is no larger than this. In numerical work that distinction matters, because a guaranteed bound composes safely through a longer calculation while an estimate does not. Our percent error calculator handles the different question of comparing a measured value against a known one.

The Divergent Case, and What the Tool Says About It

Press the third preset. It loads one over one minus x with a = 0 and x = 2, which puts the singularity at x = 1 squarely inside the interval. The (n+1)th derivative is unbounded there, so no finite M exists, the Lagrange bound does not apply, and the Taylor series does not converge at x = 2 in any case. The tool reports that in words rather than printing a number.

This case matters because the arithmetic does not warn you. Plug a = 0, x = 2, n = 5 into the formula with a carelessly chosen M and you get a small, plausible, entirely false bound. Meanwhile the degree-5 polynomial evaluated at 2 gives 63, against a true function value of −1. The bound has to fail, and the reason it fails is a condition on the interval, not on the arithmetic.

The general statement is that a Taylor series converges only within its radius of convergence, and the Lagrange bound is only informative when M is finite across the whole interval from a to x. Checking that condition is a separate act from evaluating the formula. Our logarithm calculator and exponent calculator cover the underlying functions if you want to inspect their behaviour near a singularity directly.

Need a calculator that proves its own answer?

Arb Digital builds free maths tools that show the working and check the result against an independent computation.

Browse All Free Tools Talk To Our Team

Common Mistakes to Avoid

  • Using the nth derivative instead of the (n+1)th — the remainder after a degree-n polynomial always involves one derivative more than the polynomial contains.
  • Evaluating M at the centre a — M is the maximum over the whole interval from a to x, and for most functions that maximum sits at an endpoint, not at the centre.
  • Forgetting the factorial is (n+1)! not n! — this single slip makes the bound n+1 times too large and the required degree look worse than it is.
  • Ignoring the radius of convergence — the formula returns a number even when the series diverges. The number is meaningless there.
  • Treating the bound as the expected error — it is a ceiling. Designing to it wastes terms; treating it as an estimate misreports accuracy in the other direction.

Related Free Tools From Arb Digital

Sum a series term by term with the series sum calculator, get the denominator with the factorial calculator, work with polynomial expressions using the polynomial arithmetic calculator, compare an approximation against a reference with the percent error calculator, or carry uncertainty through a chain of steps with the error propagation calculator. The full free online tools hub lists every calculus and analysis tool we publish.

Frequently Asked Questions

What is the Lagrange error bound?

It is the largest the remainder of a Taylor polynomial can be. The bound is M times the distance from the centre raised to the power n plus one, divided by n plus one factorial, where M bounds the (n+1)th derivative on the interval.

How do I find M?

M is the maximum absolute value of the (n+1)th derivative anywhere between the centre and the evaluation point. For sine and cosine it is 1; for the exponential it is e at the larger endpoint; for other functions you must examine the derivative directly.

Why is the bound bigger than the real error?

Because it replaces the derivative at one unknown intermediate point with the worst value anywhere in the interval. A factor of two to ten between the bound and the true error is normal and is the cost of a guarantee.

Does the bound work outside the radius of convergence?

No. If the interval from the centre to the evaluation point contains a singularity, no finite M exists and the formula returns a number that guarantees nothing. This tool detects that case and reports it instead.

Is this the same as the alternating series estimate?

No. The alternating series test bounds the error by the first omitted term and applies only to alternating series with decreasing terms. The Lagrange bound applies to any sufficiently differentiable function and is usually the looser of the two.

What degree do I need for a given accuracy?

The tool searches upward and reports the lowest degree whose bound falls under your tolerance. Because of the factorial the bound drops in jumps, so the answer often improves by several decimal places for one extra term.

Why does the bound grow so fast as x moves away from a?

The distance appears raised to the power n plus one. Doubling the distance multiplies the bound by two to that power, which quickly outruns the factorial in the denominator for a fixed degree.

Can the bound be zero?

Only when x equals a, where the polynomial reproduces the function exactly, or when the (n+1)th derivative is identically zero, which happens when the function is itself a polynomial of degree n or less.

This page explains a standard result of real analysis for educational purposes. The bound holds only when the stated hypotheses are met, including the existence of a finite derivative bound across the whole interval.

Advertisement
Advertisement

Take it further