# Error estimates for the trapezoid rule

Say we require $$\left|\int_{a}^{b}f(x)dx - T_{n}\right| < 10^{-4}$$

where $T_{n}$ is the composite trapezoid rule with $n$ subintervals. To guarantee that $T_{n}$ satisfies this error bound, we know that $$\int_{a}^{b}f(x)dx - T_{n} = -\frac{h^{2}}{12}(b-a)f''(\eta)$$

for some $\eta \in [a,b]$. So $$\left|\int_{a}^{b}f(x)dx - T_{n}\right| \le \frac{h^{2}}{12}(b-a)\max_{\eta \in [a,b]}|f''(\eta)| = 10^{-4}$$

So given an interval and a function, we could solve for $h$ and obtain the $n$ required to guarantee this order of accuracy (assuming the subintervals have equal length). Is this the correct way to approach this problem?

## 1 Answer

This is correct. If you want to find the required $N$ directly, you could rewrite $h$ as $h = \frac{b - a}{N}$ (again assuming the subintervals have equal length). In applications, the $N$ you compute will likely be a real number, so you could round up to the nearest integer and take that as the number of subintervals.