Error of integration in numerical methods

1. Homework Statement
So this is a problem for my numerical methods class. We are doing integration and derivation. The part that I am stuck on is why does the midpoint method and trapezoidal method both have error of order $h^2$, when the first one is one point integration method while the second one is a 2 points. I know how the error goes like, so I don't need to prove it mathematically, I just need to give a logical explanation.

2. Homework Equations
Trapezoidal method: $\int_a^b f = (b-a)\frac{f(b)+f(a)}{2}$
Midpoint method: $\int_a^b f = (b-a)f(\frac{a+b}{2})$

3. The Attempt at a Solution
In derivation, one point methods go like $O(h)$ while 2-point methods like $O(h^2)$, as in the 2 point methods, you have more information. But the same would be here so I am not sure why the error is different. I was thinking that $f(\frac{a+b}{2})$ uses an actual value belonging to f, while $\frac{f(b)+f(a)}{2}$ is not a value of f, but I am not sure. Can someone help me? Thank you!

Related Engineering and Comp Sci Homework Help News on Phys.org
Homework Helper
Gold Member
2018 Award
I think in general the amount of error will depend upon some assumptions made about the function. I believe the trapezoidal method (editing: Simpson's rule, not trapezoidal) actually gives an exact answer when integrating a quadratic function.

Last edited:
I think in general the amount of error will depend upon some assumptions made about the function. I believe the trapezoidal method actually gives an exact answer when integrating a quadratic function.
But the error going like $O(h^2)$ is independent of the function, with h = b-a

Homework Helper
Gold Member
2018 Award
There is a coefficient in front of the $h^2$. To some degree that coefficient will depend upon the function that is assumed.

There is a coefficient in front of the $h^2$. To some degree that coefficient will depend upon the function that is assumed.
But the coefficient has nothing to do with the way error behaves. $O(h^2)$ means a constant times $h^2$, which indeed depends on the function. My question is not about the constant, but about why it is a constant times $h^2$ in both cases and not other power of h?

I like Serena
Homework Helper
Hi Silviu,

Intuitively the midpoint gives us a rectangle such that the part of the graph that is below (or above) on the left, is compensated by the part of the graph that is above (or below) on the right.
With a point on the left at a, we don't have such compensation. It's only with a point on the right at b, that we can get a similar compensation.
In other words, points at the edge only give us half of the information we need.

Hi Silviu,

Intuitively the midpoint gives us a rectangle such that the part of the graph that is below (or above) on the left, is compensated by the part of the graph that is above (or below) on the right.
With a point on the left at a, we don't have such compensation. It's only with a point on the right at b, that we can get a similar compensation.
In other words, points at the edge only give us half of the information we need.
Hello! I am not sure I understand what do you mean by compensation. Doesn't this imply that the graph must be symmetric around that point? Why would it always be?

I like Serena
Homework Helper
Hello! I am not sure I understand what do you mean by compensation. Doesn't this imply that the graph must be symmetric around that point? Why would it always be?
The graph doesn't have to be symmetric around the midpoint, but it will be symmetric up to the first order (the tangent line at the midpoint). That's why it's O(h2).