Suppose $f$ is continuously differentiable on $[0,1]$, $|f'(x)|$ is bounded, show that $|\int_0^1 f(x) - \sum^n_{i=1}f(i/n)\cdot 1/n| \le M/n$. Problem statement: Suppose $f$ is continuously differentiable on $[0,1]$, and that $\sup_{x \in [0,1]}|f'(x)|\le M< \infty$. Show that $$\big|\int_0^1 f(x) - \sum^n_{i=1}f(i/n)\cdot 1/n\big| \le M/n.$$
My attempt at a solution: To start with, I was trying to get the derivative involved, somewhere, so I wrote
$$f(i/n) = f(0) + \int^{i/n}_0 f'(x)$$
which gives 
$$\big|\int_0^1 f(x) - \sum^n_{i=1}f(i/n)\cdot 1/n\big|  = \big|\int_0^1 f(x) - \sum^n_{i=1}\int_0^{i/n}f'(x)\cdot 1/n\big|.$$
I was hoping then to bound the integral using the bound on $f'$. But, there's that pesky minus sign in front of the sum that I'm working with, and even if there weren't, the bound doesn't seem to result in anything useful there, since we end up with
$$1/n \cdot \sum^n_{i=1}\int_0^{i/n}f'(x) \le f(0) + M/n \sum^n_{i=1}i,$$
which doesn't seem useful to me. I would really appreciate some hints as to the right way to attack this problem!

Hint:
\begin{align}\left | f(a)(b-a) - \int_a^b f(x) dx \right | & = \left | f(a)(b-a) - \int_a^b \left ( f(a) + \int_a^x f'(y) dy \right ) dx \right | \\ 
& = \left | \int_a^b \int_a^x f'(y) dy dx \right | \end{align}
Now bound this last integral (use the integral triangle inequality, replace $|f'(y)|$ by $M$, and then integrate explicitly). Then apply what you get repeatedly to get your result.
