Lagrange Error Bound Calculator

Pick a function and enter the degree n, the center a and the point x to bound the error of the Taylor polynomial Pₙ(x).

Updated

Function f(x)
Auto
Enter to calculate Esc to clear

Lagrange Error Bound Calculator

Our Lagrange Error Bound Calculator finds the largest possible error when a Taylor polynomial of degree n, centered at a, is used to approximate f(x). Pick sin x, cos x, eˣ, ln(1 + x) or 1/(1 − x) and the calculator works out M for you; for any other function, type M yourself. Along with the bound it shows every part of the formula, the value of the Taylor polynomial and the actual error, so you can see the bound hold.

Quick answer

The Lagrange error bound says |Rₙ(x)| ≤ M ÷ (n + 1)! × |x − a|ⁿ⁺¹, where M is the largest value of |f⁽ⁿ⁺¹⁾(t)| between a and x. For example, the degree 4 Taylor polynomial of sin x at a = 0 is within 1 ÷ 5! × 1⁵ = 1/120 ≈ 0.0083333 of sin 1. Enter your function, n, a and x above to get the bound instantly.

  • Formula: |Rₙ(x)| ≤ M |x − a|ⁿ⁺¹ ÷ (n + 1)!
  • M: max |f⁽ⁿ⁺¹⁾(t)| for t between a and x
  • sin and cos: M = 1 always works
  • Meaning: the true error is never larger than the bound

What Is the Lagrange Error Bound?

A Taylor polynomial Pₙ(x) approximates a function f(x) near a center a. The difference f(x) − Pₙ(x) is called the remainder, Rₙ(x). Working it out exactly needs f(x) itself, which is what you were trying to avoid, so instead you put a ceiling on it.

The Lagrange error bound (also called the Taylor remainder bound or Taylor's inequality) is that ceiling. It guarantees that Pₙ(x) is within a known distance of the true value, which is how calculators and textbooks prove how many decimal places an approximation is good for. It is a standard topic in AP Calculus BC and first-year calculus.

The Lagrange Error Bound Formula

Taylor's theorem with the Lagrange form of the remainder says that for some number c between a and x:

Rₙ(x) = f⁽ⁿ⁺¹⁾(c) (x − a)ⁿ⁺¹
÷ (n + 1)!

You do not know c, but if |f⁽ⁿ⁺¹⁾(t)| ≤ M for every t between a and x, then:

|Rₙ(x)| ≤ M |x − a|ⁿ⁺¹ ÷ (n + 1)!
  • n is the degree of the Taylor polynomial.
  • a is the center, and x is the point where you use the approximation.
  • M bounds the next derivative, the (n + 1)th, between a and x.
  • (n + 1)! grows very fast, which is why more terms usually mean a much smaller error.

How to Find M

M is the largest value of |f⁽ⁿ⁺¹⁾(t)| on the interval between a and x. Any larger number also works, but gives a weaker bound. For the functions in the calculator:

FunctionM between a and x
sin x, cos x1
eˣe to the larger of a and x
ln(1 + x)n! ÷ (1 + t)ⁿ⁺¹,
t = the smaller of a and x
1/(1 − x)(n + 1)! ÷ (1 − t)ⁿ⁺²,
t = the larger of a and x

For other functions, find the (n + 1)th derivative, then its largest absolute value on the interval: check the endpoints and any turning points, or use a simple overestimate. Many textbooks use M = 3 for eˣ on [0, 1], since e < 3.

Bound vs Actual Error

The bound is a guarantee, not a prediction. Here is sin 1 approximated by Taylor polynomials centered at 0, with M = 1:

nBoundActual error
10.50.1585290152
30.04166666670.0081376515
50.00138888890.0001956819
72.48 × 10⁻⁵2.73 × 10⁻⁶
92.76 × 10⁻⁷2.49 × 10⁻⁸

The actual error is always below the bound. A useful trick: for sin x at 0, the x⁴ term is 0, so P₃ = P₄ and you can use the n = 4 bound 1/120 ≈ 0.0083 for P₃ as well, which is much closer to the real 0.0081.

Worked Examples

sin 1 with degree 4. Every derivative of sin x is ±sin or ±cos, so M = 1.

|R₄(1)| ≤ 1 × |1 − 0|⁵ ÷ 5!
= 1/120 ≈ 0.0083333

P₄(1) = 1 − 1/6 ≈ 0.8333333 and sin 1 ≈ 0.8414710, so the actual error is 0.0081377, inside the bound.

e0.5 with degree 3. Every derivative is eᵗ, largest at t = 0.5, so M = e0.5 ≈ 1.6487:

|R₃(0.5)| ≤ 1.6487 × 0.5⁴ ÷ 4!
≈ 0.0042935

Using the rougher M = 2 gives 0.0052083, still a valid bound.

ln(1.2) with degree 2. The third derivative of ln(1 + x) is 2 ÷ (1 + t)³, largest at t = 0, so M = 2 and the bound is 2 × 0.2³ ÷ 3! ≈ 0.0026667. P₂(0.2) = 0.2 − 0.02 = 0.18, and ln 1.2 ≈ 0.1823216.

How Many Terms Do You Need?

Turn the bound around: find the smallest n that makes the bound smaller than the accuracy you need. To approximate e = e¹ with an error below 10⁻⁶, use M = 3:

n = 8: 3 ÷ 9! ≈ 8.3 × 10⁻⁶ (too big)
n = 9: 3 ÷ 10! ≈ 8.3 × 10⁻⁷ (ok)

So the degree 9 Taylor polynomial, 1 + 1 + 1/2! + … + 1/9!, gives e to within 10⁻⁶. Try different values of n in the calculator to find the cut-off quickly.

Lagrange vs Alternating Series Error Bound

When a Taylor series has terms that alternate in sign and shrink towards 0 (like sin 1 or ln 1.2), the alternating series error bound also applies: the error is at most the first term left out. For sin 1 with P₃, that term is 1/5! = 1/120, the same as the Lagrange bound with n = 4.

The Lagrange bound works for any Taylor polynomial, alternating or not (for example eˣ at x > 0, where every term is positive), so it is the one to use when the series does not alternate.

Common Mistakes

  • Using n! instead of (n + 1)!. The bound uses the next factorial and the power n + 1.
  • Bounding the wrong derivative. M bounds f⁽ⁿ⁺¹⁾, not f⁽ⁿ⁾.
  • Taking M at the wrong end. For eˣ use the larger of a and x; for ln(1 + x) the smaller.
  • Using the value at c. c is unknown; M must cover every t between a and x.
  • Reading the bound as the error. The true error is usually smaller.
  • Degrees vs radians. Taylor series for sin and cos need x in radians.

Key Terms

Pₙ(x)
The Taylor polynomial of degree n about a.
Rₙ(x)
The remainder f(x) − Pₙ(x), the true error.
Center
The point a the Taylor polynomial is built around.
M
An upper limit for |f⁽ⁿ⁺¹⁾(t)| between a and x.
Maclaurin
A Taylor polynomial centered at a = 0.

How to Use the Lagrange Error Bound Calculator

  1. Pick the function. Choose sin x, cos x, eˣ, ln(1 + x) or 1/(1 − x), and the calculator works out M for you. Choose Other for any other function and type M yourself.
  2. Enter n, a and x. Type the degree n of the Taylor polynomial (0 to 100), the center a and the point x. a and x can be decimals, fractions such as 1/2, or multiples of π such as π/6.
  3. Check M. Leave the M field empty to use the worked-out value, or type your own M, the largest value of |f⁽ⁿ⁺¹⁾(t)| between a and x.
  4. Read and copy the bound. The Lagrange error bound appears as you type. The table shows M, |x − a|, (n + 1)!, the Taylor polynomial value, f(x) and the actual error. Press Copy to copy the bound, or Clear or Esc to start again.

Example: pick sin x and enter n = 4, a = 0 and x = 1. The bound is 0.008333333333 (1/120), and the table shows P₄(1) = 0.8333333333, sin 1 = 0.8414709848 and the actual error 0.008137651475.

Who Can Use This Calculator?

AP Calculus BC StudentsChecking Lagrange error bound answers
University StudentsTaylor's theorem and series homework
TeachersShowing how the bound compares with the true error
Engineers and ProgrammersChoosing how many series terms to use

Frequently Asked Questions (FAQs)

What is the Lagrange error bound?

The Lagrange error bound is the largest possible error when a Taylor polynomial Pₙ(x) of degree n is used to approximate f(x). It guarantees |f(x) − Pₙ(x)| ≤ M |x − a|ⁿ⁺¹ ÷ (n + 1)!, so the true error is never larger than this number.

What is the Lagrange error bound formula?

|Rₙ(x)| ≤ M |x − a|ⁿ⁺¹ ÷ (n + 1)!, where n is the degree of the Taylor polynomial, a is its center, x is the point being approximated and M is the largest value of |f⁽ⁿ⁺¹⁾(t)| for t between a and x.

How do you find M in the Lagrange error bound?

Find the (n + 1)th derivative of f, then its largest absolute value on the interval between a and x. Check the endpoints and any turning points. For eˣ it is e to the larger of a and x; for sin x and cos x, M = 1. Any larger number also gives a valid, but weaker, bound.

Why is M = 1 for sin x and cos x?

Every derivative of sin x or cos x is sin x, cos x, −sin x or −cos x, and all of these stay between −1 and 1. So |f⁽ⁿ⁺¹⁾(t)| ≤ 1 for every t and every n.

What is the Lagrange error bound for sin(1) with a degree 4 polynomial?

With a = 0 and M = 1, the bound is 1 × 1⁵ ÷ 5! = 1/120 ≈ 0.0083333. The actual error is |sin 1 − (1 − 1/6)| ≈ 0.0081377, just inside the bound.

Is the Lagrange error bound the same as the actual error?

No. The bound is an upper limit, and the actual error is usually smaller because M uses the worst case between a and x. The calculator shows both for the listed functions so you can compare them.

How do I find how many terms I need for a given accuracy?

Find the smallest n for which the bound is below the accuracy you need. For e¹ with M = 3, n = 8 gives 3 ÷ 9! ≈ 8.3 × 10⁻⁶ and n = 9 gives 3 ÷ 10! ≈ 8.3 × 10⁻⁷, so degree 9 is enough for an error below 10⁻⁶.

What is the difference between the Lagrange and alternating series error bounds?

The alternating series bound only works when the terms alternate in sign and shrink towards 0; it says the error is at most the first term left out. The Lagrange bound works for any Taylor polynomial, including series with all positive terms such as eˣ for x > 0.

What if my function is not in the list?

Choose Other and type M yourself: the largest value of |f⁽ⁿ⁺¹⁾(t)| between a and x. The calculator then works out the bound from M, n, a and x.

Is the Lagrange Error Bound Calculator free?

Yes. It is completely free, needs no sign-up, and can be used as many times as you like.

Try our Lagrange Error Bound Calculator to bound any Taylor polynomial error and compare it with the actual error instantly.