TITLE: Why don't terms in the summation expression for an integral (almost) cancel out?
QUESTION [5 upvotes]: If I think of an integral, $\int_a^b f(x) dx$ as roughly $\sum f(x)\delta x$ where $\delta x$ is very very small, then can't I write this sum as
$$
f(x)x - f(x)(x-\delta x) + f(x-\delta x)(x-\delta x) +\dots -f(a)a
$$
Then, since $\delta x$ is so small, assuming $f(x)$ is "smooth" in some sense, shouldn't $f(x) \approx f(x-\delta x)$ so  $$f(x)(x-\delta x) \approx f(x-\delta x)(x-\delta x)$$
and then all terms would cancel out except for $f(x)x$ and $f(a)a$?
I.e. wouldn't this give $\int_a^b f(x)dx \approx f(x) x - f(a)a$?
Why does this not give a decent approximation?

For example, I think this is always exact for a constant function. I would then think it should be pretty good for any function that doesn't change too quickly at any point. 

but what is "too quickly" 
I thought it would also be pretty good for a linear function, but this is not the case...

REPLY [16 votes]: Sure, $f(x) \approx f(x-\delta x)$, so you can pair off most of the terms in pairs that are approximately $0$.  But they are only approximately zero, and there are a lot of them ($(b-a)/\delta x$ of them, and $\delta x$ is very small!).  So, the total sum of them may still be non-negligible because there are so many of them.
Indeed, using the same reasoning, you could just say that in $\sum f(x)\delta x$ each term is very small, since $f(x)$ is bounded and $\delta x$ is small.  Your approach would then say that $0$ is a good approximation to the integral.  Of course this is wrong, because although each term is small (roughly proportional to $\delta x$), the number of terms is large in a way that cancels it out (proportional to $1/\delta x$).
We can be more precise and say that $f(x)-f(x-\delta x)\approx f'(x) \delta x$ if $f$ is differentiable.  So, the errors in your terms are also roughly proportional to $\delta x$, at least as long as $f'(x)$ is bounded and stays away from $0$.  We can thus expect a non-negligible total error when we add up $(b-a)/\delta x$ such errors.
To be even more precise, we can expect the error to be $\int_a^b xf'(x)\, dx$, since each term of the error has the form $(x-\delta x)(f(x)-f(\delta x))\approx xf'(x)\delta x$.  We can verify this rigorously: if you integrate $\int_a^b f(x)\, dx$ by parts with $u=f(x)$ and $v=x$ (assuming $f$ is continuously differentiable) you get $$\int_a^b f(x)\,dx=xf(x)\bigg|_a^b-\int_a^b xf'(x)\,dx=(bf(b)-af(a))-\int_a^b xf'(x)\,dx.$$  The first term is exactly what you find with your approximation, so the error is indeed $\int_a^b xf'(x)\,dx$.  In this sense, then, the error you are making is akin to saying that the derivative of $xf(x)$ should be $f(x)$, which is what you get by differentiating just the $x$ factor but ignoring the fact that $f(x)$ may also be changing.