# Trapezoid rule error analysis

How can I prove that the max error of the trapezoid rule for the integral $\int_{a}^{b}{f(x)\, \mathrm{d}x}$ is: $$\Delta=-\frac{1}{12n^2}f''(c)(b-a)^3 \text{for } c \in (a,b) \ ?$$

I know that to obtain that result first you have to prove that $$\exists \;c \in (a,b); \int_{a}^{b}f(x)\,dx = \frac{b - a}{2}\{f(a) + f(b)\} - \frac{1}{12}f''(c)(b-a)^3$$ But I'm stuck here, I tried using the mean value theorem but got nowhere. Anyone got any ideas?

If it helps: $\forall x_0 \in (a,b) \;\exists\;\xi_0 \in (a,b);\; f(x_0) - p(x_0) = f''(\xi_0)\frac{(x_0 - a)(x_0 - b)}{2}$, where p(x) is the linear function that interpolates f(x) in the points a and b ($p(x) = f(a) + \frac{f(b) - f(a)}{b-a}(x-a)$)

-
Guess that, if true, when ∫f(x)dx relates to f″(c), it basically says that (just for purpose, assuming that f is C^3), for any such function there exists c such that : f'''(c) =-12(b-a)^(-3)*(f(b)-f(a)) – Newben Feb 23 '13 at 23:45
Btw, I think that finding that c such that ∫f(x)dx=−1/12*f″(c)(b−a)^3, fails for the identity function – Newben Feb 23 '13 at 23:54
It doesn't fail beacause when you're dealing with linear functions, $\int{f-p} = 0$, since p = f, $\forall x \in \mathbb R$ – Pedro Amorim Feb 24 '13 at 0:16

Let $p = (a + b)/2$ and $2h = b - a$ so that $a = p - h, b = p + h$. We further define the functions $g(t)$ and $r(t)$ by $$g(t) = \int_{p - t}^{p + t}f(x)\,dx - t\{f(p - t) + f(p + t)\},\,\, r(t) = g(t) - \left(\frac{t}{h}\right)^{3}g(h)$$ Then we can see that $$g'(t) = -t\{f'(p + t) - f'(p - t)\},\,\, r'(t) = g'(t) - \frac{3t^{2}}{h^{3}}g(h)$$ By Mean Value theorem we can see that $$g'(t) = -2t^{2}f''(t')$$ for some $t' \in (p - t, p + t)$. Thus we have $$r'(t) = -t^{2}\left(2f''(t') + \frac{3}{h^{3}}g(h)\right)$$ Clearly we can see that $r(0) = r(h) = 0$ so that (by Rolle's Theorem) there is some point $t_{0} \in (0, h)$ such that $r'(t_{0}) = 0$. This means that $$-t_{0}^{2}\left(2f''(t') + \frac{3}{h^{3}}g(h)\right) = 0$$ and therefore we have $$g(h) = -\frac{2h^{3}}{3}f''(t')$$ where $t' \in (p - t_{0}, p + t_{0}) \subset (p - h, p + h) = (a, b)$. We finally arrive at (by putting values of $h = (b - a)/2,\, p - h = a,\, p + h = b$ and definition of $g(t)$) $$\int_{a}^{b}f(x)\,dx = \frac{b - a}{2}\{f(a) + f(b)\} - \frac{(b - a)^{3}}{12}f''(t')$$ where $t' \in (a, b)$
Hint: Use the Lagrange Remainder of the Taylor Expansion: $$f(x)\sim f(x_1) +f'(x_1)(x-x_1)+f''(x^*)\frac{(x-x_1)^2}{2!}$$ For some $x^*$ in $[x_1,x]$, and integrate the error term over $[x_1,x_2]$.