TITLE: If $f\in C^1[0,1]$, then $\left|\int_0^1f(x)dx-\frac{1}{n}\sum_{k=0}^{n-1}f\left(\frac{k}{n}\right)\right|\leq\frac{\int_0^1|f'(x)|dx}{n}$
QUESTION [5 upvotes]: I want to show that if $f\colon[0,1]\to\mathbb{R}$ is continuously differentiable, then
$$\left|\int_0^1f(x)dx-\frac{1}{n}\sum_{k=0}^{n-1}f\left(\frac{k}{n}\right)\right|\leq\frac{\int_0^1|f'(x)|dx}{n}$$
I'm not quite sure where to start - some things I thought about are that the left hand side approaches 0 because Riemann sums approach the integral as $\lambda(\Pi)\to0$, and that it's almost tempting to use the Newton-Leibniz theorem on the right hand side but I can't because of the absolute value.
I would love to get a hint.

REPLY [2 votes]: There's even no need to use the mean value theorem. For any $t\in\left(0, \tfrac{1}{n}\right)$ we have:
\begin{align}
\left\vert
f\left(\tfrac{k}{n} + t\right) - 
f\left(\tfrac{k}{n}\right)
\right\vert
=
\left\vert
\int_{0}^{t} f'\left(\tfrac{k}{n} + s\right)\ ds
\right\vert
\leq
\int_{0}^{t} 
\left\vert
f'\left(\tfrac{k}{n} + s\right)
\right\vert\ ds
\leq
\int_{0}^{1/n} 
\left\vert
f'\left(\tfrac{k}{n} + s\right)
\right\vert\ ds
\end{align}
Note that the expression on the right does not depend on $t$ anymore. Thus:
\begin{align}
\int_{0}^{1/n} 
\left\vert
f\left(\tfrac{k}{n} + t\right) - 
f\left(\tfrac{k}{n}\right)
\right\vert\ dt
\leq
\frac{1}{n}
\int_{0}^{1/n} 
\left\vert
f'\left(\tfrac{k}{n} + s\right)
\right\vert\ ds
\end{align}
Now, focusing on the main problem, try to apply the above considerations:
\begin{align}
\left\vert
\int_0^1 f(x)\ dx - 
\frac{1}{n} \sum_{k=0}^{n-1} f\left(\tfrac{k}{n}\right) 
\right\vert
&=
\left\vert
\sum_{k=0}^{n-1} \int_{0}^{1/n} f\left(\tfrac{k}{n} + t\right)\ dt - 
\sum_{k=0}^{n-1} \int_{0}^{1/n} f\left(\tfrac{k}{n}\right)\ dt 
\right\vert
\\&=
\left\vert
\sum_{k=0}^{n-1} \int_{0}^{1/n} 
\left(
f\left(\tfrac{k}{n} + t\right) - 
f\left(\tfrac{k}{n}\right)\right)\ dt 
\right\vert
\\&\leq
\sum_{k=0}^{n-1} \int_{0}^{1/n} 
\left\vert
f\left(\tfrac{k}{n} + t\right) - 
f\left(\tfrac{k}{n}\right)
\right\vert\ dt
\\&\leq
\frac{1}{n}
\sum_{k=0}^{n-1}
\int_{0}^{1/n} 
\left\vert
f'\left(\tfrac{k}{n} + s\right)
\right\vert\ ds
\\&=
\frac{1}{n}
\int_{0}^{1} 
\left\vert
f'\left(x\right)
\right\vert\ dx
\end{align}