Q: Let $f$ be a continuous function on [0, 1] and its derivative $f'$ is continuous on [0, 1]. Show that$$|\frac{1}{n}\sum_{k=0}^{n-1}f(\frac{k}{n})-\int_0^1f(x)dx|\leq\frac{M}{2n}$$ where M is the maximum value of $|f'|$ on [0, 1].
I find this inequality very tricky to understand. Because the max $|f'|$ just came out of nowhere... I tried to draw a graph of $\frac{1}{n}\sum_{k=0}^{n-1}f(\frac{k}{n})$ but didn't get much information. Could somebody give me a hint or the direction of the solution?