# Confusion about Trapezoid rule error

The error of the trapezoid rule is often derived using the Mean Value Theorem, which is used to get that $$\frac{f'(b)-f'(a)}{b-a}=f''(c)$$ for some $$c\in[a,b]$$. The actual error is $$-\frac{(b-a)^3}{12N^2}f''(c)$$, so it is in proportion to $$f''(c)$$. Obviously, without calculating the actual integral, we can't know $$c$$, since otherwise would imply that we could do any definite integral without actually integrating. However, since by the Mean Value Theorem $$f''(c)=\frac{f'(b)-f'(a)}{b-a}$$, we have a definite expression for $$f''(c)$$. In terms of only of the derivative at the end points and the $$x$$-value of the endpoints. And therefore a term for the error, and thus the exact area in terms of only those two things and the number of trapezoids. I know that must be wrong, so where did I make a mistake in reasoning?

This is the proof as given in Concepts of Calculus II by A.H. Lightstone:

Note that he does not use $$[a,b]$$, instead using $$[a-h,a+h]$$.

He starts by proving this theorem:

Given a function $$f(x)$$ that is $$C^2$$ over $$[a-h,a+h]$$, then $$f(a+h)+f(a-h)+2f(a)=h^2f''(c)$$, for some $$c\in[a-h,a+h]$$.

Proof: Consider the function $$f(a+h)+f(a-h)+2f(a)-Bh^2=0$$. Differentiate both sides with respect to $$h$$, and we get $$f'(a+h)-f'(a-h)-2hB=0$$, which can be rearranged into $$\frac{f'(a+h)-f'(a-h)}{2h}=B$$. Now, we use the Mean Value Theorem to get $$B=f''(c)$$.

Q.E.D.

The rest is just some algebraic manipulation with the definition of the trapezoid rule: I don't have that part on hand right now, but I will edit in in as soon as possible.

• You just do not know the exact solution, else you would not need numerical approximations and error estimates. – Lutz Lehmann Jul 3 '19 at 21:20
• I'm not sure I understand what you are getting at. – H Huang Jul 3 '19 at 22:27
• Probably $c$ is not obtained the way you say: you should check the proof of the error formula. – Tony Piccolo Jul 4 '19 at 16:09
• I am sure it is obtained with the Mean Value Theorem. – H Huang Jul 5 '19 at 21:52
• Can you give me your source ? – Tony Piccolo Jul 5 '19 at 22:24

I believe the answer is that in deriving the error $$-\frac{(b-a)^3}{12N^2}f''(c)$$ one typically applies the mean value theorem twice.

First time we use the MVT:

We want to evaluate $$\int\limits_a^b f(x) \mathrm dx$$ and so our first idea is to Taylor expand and integrate term by term (truncating after some desired finite number of terms), because polynomials are easy to integrate. But we realize that we can improve the accuracy of the integral by sampling at several points. So instead of finding the Taylor polynomial that passes through a single point, we find a polynomial that is guaranteed to pass through many points that we are certain about. That is, we replace $$f(x)$$ with some polynomial interpolation, then integrate that polynomial.

The trapezoid rule arises in the case where we choose the interpolating polynomial to be one of the simplest choices: the Lagrange polynomial of degree $$1$$ (which passes through two nodes). Approximating $$f(x)$$ by a finite degree polynomial introduces an error term. Explicitly:

\begin{align} f(x) &= p_1(x) + E_1(x) \\ &= \frac{f(a)(x-b)}{a-b} + \frac{f(b)(x-a)}{b-a} +E_1(x) \end{align}

We can use Rolle's theorem (you can think of it as using the Mean Value Theorem if you want to) to find the error term. We find that for each $$x \in [a,b]$$ there must exists some $$\xi(x)$$ such that

\begin{align} E_1(x) = \frac{f''(\xi(x))}{2}(x-a)(x-b) \end{align}

It's really important that we indicate that this number $$\xi(x)$$ may be different for each $$x$$! This may in fact be the source of your difficulty.

Second time we use the MVT:

Now we want to derive the error in the trapezoid rule. So we have

\begin{align} \int\limits_a^b f(x) \mathrm dx &= \int\limits_a^b p_1(x) \mathrm dx + \int\limits_a^b E_1(x) \mathrm dx \end{align}

You can check that $$\int\limits_a^b p_1(x) \mathrm dx$$ gives the trapezoid rule, so what about the error? We want to calculate

\begin{align} \int\limits_a^b E_1(x) \mathrm dx = \frac{1}{2}\int\limits_a^b f''(\xi(x))(x-a)(x-b) \mathrm dx \end{align}

Notice how important it was that we noted that $$\xi(x)$$ is a function of $$x$$. Since we don't know what function it is, we get around this by using the mean value theorem again (specifically, the integral version). Explicitly, there exists some $$c \in [a,b]$$ such that

\begin{align} \int\limits_a^b f''(\xi(x))(x-a)(x-b) \mathrm dx &= f''(c)\int\limits_a^b (x-a)(x-b) \mathrm dx \end{align}

and now the integral is easy to do and we have an explicit form for the error.

Does this make it clear why we can't just "go backwards" with the Mean Value Theorem? Because that $$c$$ takes us back to an integral of something involving a $$\xi(x)$$, which takes us back to another error term corresponding to the error in approximating $$f(x)$$ by a finite degree polynomial. So we both have to be careful that the MVT was used twice, and think about what the points $$c$$ and $$\xi(x)$$ really correspond to.

Perhaps you will add some more about what your textbook specifically says, but this is my understanding of things. I could not find a copy of that particular book.

I'll try to reconstruct how the cited proof was supposed to go:

If you consider the function $$g(s)=f(a+s)-2f(a)+f(a-s)-Bs^2 \tag1$$ and adapt $$B$$ such that $$g(h)=0$$, then together with $$g(0)=0$$ (where you need the correct sign at $$2f(a)$$) and the theorem of Rolle you get that there exists a point $$h_1\in(0,h)$$ with $$0=g'(h_1)=f'(a+h_1)-f'(a-h_1)-2h_1B. \tag2$$ The same could be obtained from an appropriate application of the extended mean value theorem.

Now this can be transformed to $$B=\frac{f'(a+h_1)-f'(a-h_1)}{2h_1}. \tag3$$ In general, this is different from the difference quotient $$\frac{f'(a+h)-f'(a-h)}{2h}$$ over the original interval.

Now the application of the usual mean value theorem gives you a point $$c\in(a-h_1,a+h_1)\subset [a-h,a+h]$$ with $$B=f''(c). \tag4$$