# Understanding the upper bound on the error term in the trapezium rule.

For $f$ twice continuously differentiable, we have$$\displaystyle\int_a^bf(x)dx = \dfrac{1}{2}(b-a)[f(a) + f(b)] + E(f)$$ where $E(f) \leq \dfrac{(b-a)^3}{2}\text{max}|f''|$. I'm reading the proof of this equation here (Trapezoid rule), and I don't understand how the upper bound of the error term is derived.

The proof is as follows:

Let $p(x) = \bigg(x - \dfrac{a+b}{2}\bigg)^2 - \dfrac{(b-a)^2}{4}$, we have $$\begin{split}E(f)&\leq \displaystyle\dfrac{1}{2}\int_a^b\left|f''(x)p(x)\right|dx\\&\leq\dfrac{\max\left|f''\right|}{2}\int_a^b\left|\bigg(x - \dfrac{a+b}{2}\bigg)^2 - \dfrac{(b-a)^2}{2}\right|dx\\&=\dfrac{\max\left| f''\right|}{2}\int_{-h}^h\left|x^2-h^2\right|dx\\&=\max\left|f''\right|\int_0^h(h^2 - x^2)dx\\&=\dfrac{\max\left|f''\right|2h^3}{3}\\&=\dfrac{(b-a)^3 \max\left|f''\right|}{12}\end{split}$$

Question: How do you go from the first inequality to the second inequality? Why is it allowed to just take $f''$ out of the integral if you choose $x$ such that $f''$ is maximal? Furthermore, what is happening with the substitution from the second inequality to the third? If I replace $-h^2$ and $h^2$ in the integral I get an integral from $-\dfrac{b}{2} + \dfrac{a}{2}$ to $\dfrac{b}{2} - \dfrac{a}{2}$. Likewise, I don't understand how interchanging $x^2$ and $h^2$ and removing the absolute value signs allows us to take the integral from $0$ to $h^2$ instead from $-h^2$ to $h^2$. Lastly, if I calculate the integral from the fourth to fifth equality, I get a minus sign. Is this my fault or is this an error in the proof?

Thanks!

• We changed the limits from (-h to h) to (0 to h) because $\left|x^2-h^2\right|$ is even. Sketch that graph to see that the area from 0 to h is the same as the area from -h to 0. We remove the absolute value because on 0 to h, $\left|x^2-h^2\right|$ is non negative; so we dont need them there. I seem to be getting the right sign at the end. Maybe try again, carefully. Feb 25 '18 at 14:16
• We went from the first inequality to the second by simply bounding the integral. There must have been some result in lectures (or books) which showed you that this can be done. I think you misread the slides a little when you were copying down the proof and statement as well. Feb 25 '18 at 14:22
• @Newphonewhothis Thanks! How would I sketch $\left|x^2 - h^2\right|$ though? Feb 26 '18 at 15:48
• You may have a look at this answer which gives the exact error in trapezoidal rule from which you get the bound easily math.stackexchange.com/a/535304/72031 Feb 26 '18 at 16:27
• @titusAdam I think for demonstration purposes, it will be enough to just sketch it for a few values of h (0.1,0.5,1, 2). Simple sketch x^-h^2 and reflect the parts that ''dip'' under the x axis. wolframalpha.com/input/?i=abs(x%5E2-1%5E2)+plot Feb 26 '18 at 16:44

You have a lot of questions!

First of all: I think you did a typo:

where $$E(f) \leq \dfrac{(b-a)^3}{2}\text{max}|f''|$$

The correct, given the statement of Trapezoidal Rule and the context, is

$$E(f) \leq \dfrac{(b-a)^3}{12}||f''||_{\infty}$$

Where $$||f||_{\infty}$$ is the uniform norm of $$f$$ and denotes the supremum of $$|f|$$ for $$x \in [a,b]$$.

How do you go from the first inequality to the second inequality?

$$E(f)= \dfrac{1}{2} \int_{a}^{b} f''(x)p(x) dx$$

So it is very natural that

$$E(f) \leq |E(f)| \leq \dfrac{1}{2} \int_{a}^{b} |f''(x)p(x)| dx$$

Why is it allowed to just take $$f′′$$ out of the integral if you choose x such that $$f′′$$ is maximal?

I will try to explain it in a very informal way and as a consequence of the definition of $$||f''||_\infty$$:

$$| \,||f''||_{\infty}p(x) \,| \geq |f''(x)p(x)|$$ where $$||f''||_{\infty}$$ is a real constant and $$f''(x) \in \mathbb{R}$$ - notice that the statement is valid for any $$x \in \mathbb{R}$$. Then, you can take out the constant of the integral and get the result which you see in the proof. That is:

$$\int_{a}^{b} | \, ||f''||_{\infty}p(x) \, | dx\,\geq \int_{a}^{b} |f''(x)p(x)| dx \,\rightarrow ||f''||_{\infty} \int_{a}^{b} |p(x)|\,dx \geq \int_{a}^{b} |f''(x)p(x)|\,dx$$

The rest follows from the determination of $$p(x)$$.

Furthermore, what is happening with the substitution from the second inequality to the third? If I replace $$−h^2$$ and $$h^2$$ in the integral I get an integral from $$−b/2+a/2$$ to $$b/2−a/2$$.

Likewise, I don't understand how interchanging $$x^2$$ and $$h^2$$ and removing the absolute value signs allows us to take the integral from 0 to $$h^2$$ instead from $$−h^2$$ to $$h^2$$.

As the user New phone who this had noted that is relate to the property of even functions. And you need to notice that in the interval of integration $$\dfrac{b-a}{2} \geq x$$ then:

$$\dfrac{||f''||_{\infty}}{2}\int_{-h}^{h}\left|x^2-h^2\right|dx = ||f''||_{\infty}\int_{0}^{h}\left|x^2-h^2\right|dx = ||f''||_{\infty}\int_{0}^{h} {h^2 - x^2 \, dx}$$

What's more, if you change $$h ^ 2$$ to $$-h ^ 2$$ you will have implications inside the module that should be observed.

Lastly, if I calculate the integral from the fourth to fifth equality, I get a minus sign. Is this my fault or is this an error in the proof?

I believe that is your fault.

• Thanks for your elaborate answer! There is still one thing that I don't understand though. If we have that $\|f''\|_\infty \geq f''(x)$, how do you know that $\displaystyle\int_a^b\|f''\|_\infty p(x)dx\geq \int_a^bf''(x)p(x)dx$? Suppose that you have a constant $c$ that is at least twice as big as $f(x)$ for all $x$. That doesn't mean that $\int_a^bc dx\geq \int_a^b f(x)dx$ right? Feb 26 '18 at 15:49
• I'm sorry but I don't understand what you mean.. Why is it a different case? Where in your answer do you show that $\displaystyle\int_a^b\left\|f''\|_\infty p(x)\right|dx\geq \int_a^b\left|f''(x)p(x)\right|dx$? Why should this follow from the monotonicity property of the integral? Feb 26 '18 at 17:02
• "The symbol $||f||_{\infty}$ is the uniform norm of f and denotes the supremum of $|f(x)|$ for $x \in [a,b]$. If $f$ is continuous then this is the maximum of $|f(x)|$." (It is in the paper which I put in the end of the answer.) Feb 26 '18 at 17:07
• Yes it's in there but it doesn't explain why it's correct right? I understand what $\|f\|_\infty$ means, but I've never seen a theorem that implies what you're saying (and what they're saying in the proof). That is, given that $\|f\|_\infty$ is the supremum of $\left|f(x)\right|$ for $x\in[a,b]$, I can't think of a theorem that then states that $\int_a^b\left|\|f\|_\infty p(x)dx\right|\geq \int_a^b\left|f(x)p(x)\right|dx$ Feb 26 '18 at 17:12