Let $f:\mathbb{R}\rightarrow \mathbb{R}$ be a differentiable function such that $f'$ is bounded. Given a closed and bounded interval $[a,b]$ and partition $P=\{a=a_0<a_1<\dots< a_n=b\}$
Let $M(f,P)$ and $m(f,P)$ denote upper and lower Riemann sum of $f$ with respect to $P$?
then $|M(f,P)-\int_{a}^{b} f dx|\leq (b-a)^2 \sup\{|f'(x)|:x\in [a,b]\} $
How to prove this inequality??
I know basic results like $$m(b-a)\leq L(f,P)\leq \int f\leq M(f,P)\leq M(b-a),$$ where $m,M$ are lower and upper bounds of $f$ respectively.
I am offering a stronger inequality. We have $$0\leq M(f,P)-\int_a^bf(x)dx\leq \frac12(b-a)^2\sup_{x\in[a,b]}\big|f'(x)\big|\tag{1}$$ for all Lipschitz-continuous, differentiable function $f:[a,b]\to\mathbb{R}$. The inequality on the left is an equality if and only if $f$ is a constant function. The inequality on the right is an equality if and only if $f$ is a constant function and $P$ is an arbitrary partition of $[a,b]$, or $f$ is a nonconstant linear function and $P=\{a,b\}$.
The inequality on the left is trivial. I will only prove the inequality on the right. For $i=1,2,\ldots,n$, let $c_i\in[a_{i-1},a_i]$ be such that $f(c_i)=\sup\limits_{x\in[a_{i-1},a_i]}f(x)$. We have $$M(f,P)=\sum_{i=1}^nf(c_i)(a_{i}-a_{i-1})=\sum_{i=1}^n\int_{a_{i-1}}^{a_i}f(c_i)dx.$$ Thus, $$M(f,P)-\int_a^bf(x)dx=\sum_{i=1}^n\int_{a_{i-1}}^{a_i}f(c_i)dx-\sum_{i=1}^n\int_{a_{i-1}}^{a_i}f(x)dx=\sum_{i=1}^n\int_{a_{i-1}}^{a_i}\big(f(c_i)-f(x)\big)dx.$$ By the mean-value theorem, there exists $d_i(x)$ between $x$ and $c_i$ such that $$f(c_i)-f(x)=(c_i-x)f'\big(d_i(x)\big).$$ That is, $$M(f,P)-\int_a^bf(x)dx=\sum_{i=1}^n\int_{a_{i-1}}^{a_i}(c_i-x)f'\big(d_i(x)\big)dx.$$ By the triangle inequality, we get $$M(f,P)-\int_a^bf(x)dx\leq \sum_{i=1}^n\int_{a_{i-1}}^{a_i}|c_i-x|\Big|f'\big(d_i(x)\big)\Big|dx.$$ Let $D$ be the supremum of $\big|f'(x)\big|$ for $x\in[a,b]$. We then have $$M(f,P)-\int_a^bf(x)dx\leq \sum_{i=1}^nD\int_{a_{i-1}}^{a_i}|c_i-x|dx=D\sum_{i=1}^n\left(c_i^2-(a_i+a_{i-1})c_i+\frac{a_i^2+a_{i-1}^2}{2}\right).$$ It can be easily seen that $$c_i^2-(a_i+a_{i-1})c_i+\frac{a_i^2+a_{i-1}^2}{2}=-(c_i-a_{i-1})(a_i-c_i)+\frac{(a_i-a_{i-1})^2}{2}\leq \frac{(a_i-a_{i-1})^2}{2}.$$ That is, $$M(f,P)-\int_a^bf(x)dx\leq D\sum_{i=1}^n\left(\frac{(a_i-a_{i-1})^2}{2}\right)\leq \frac12D(b-a)^2,$$ since $\sum\limits_{i=1}^n(a_i-a_{i-1})^2\leq \left(\sum\limits_{i=1}^n(a_i-a_{i-1})\right)^2= (b-a)^2$.
Similarly, we have $$0\leq \int_a^bf(x)dx-m(f,P)\leq \frac12(b-a)^2\sup_{x\in[a,b]}\big|f'(x)\big|$$ for all Lipschitz-continuous, differentiable function $f:[a,b]\to\mathbb{R}$. The equality conditions are the same as the equality conditions of (1).