Suppose that $f'$ exists and $\left\lvert f'(x)\right\rvert\le M$ on $[a,b]$. Show that any Riemann sum $\sigma$ of $f$ over any partition $P$ of $[a,b]$ satisfies$$\left\lvert\sigma - \int_a^bf(x)dx\right\rvert\le M(b-a)\lVert P\rVert$$.
I am having trouble with this one and haven't been able to find the answer anywhere. I've tried applying the Mean Value Theorem for integrals to obtain:$$\begin{aligned}\left\lvert f'(c_j)\right\rvert=\frac{\left\lvert f(x_j)-f(x_{j-1})\right\rvert}{x_j-x_{j-1}}&\le M\:(\text{for some }c_j\in[x_{j-1},x_j])\\\implies\left\lvert f(x_j)-f(x_{j-1})\right\rvert&\le M(x_j-x_{j-1})\\\implies\sum_{j=1}^n\left\lvert f(x_j)-f(x_{j-1})\right\rvert&\le\sum_{j=1}^nM(x_j-x_{j-1})\\\implies\left\lvert f(b)-f(a)\right\rvert&\le M(b-a)\end{aligned}$$
but I don't know where to go from here or if I'm even on the right track. Would appreciate some help.
(This question is from page 151 of Trench: Introduction to Real Analysis).
 A: First suppose $P : a \leq b$ is the trivial partition.  Then $\sigma = f(c^*)(b-a)$ for some $c^* \in [a,b]$ and, by the integral mean value theorem, there is some $c \in [a,b]$ such that $\int_a^b f(x)\,dx = f(c)(b-a).$  Therefore,
$$\left|\sigma - \int_a^b f(x)\,dx\right| = \Big|f(c^*)(b-a) - f(c)(b-a)\Big| = \Big|f(c^*)-f(c)\Big| \cdot (b-a)$$
To estimate this last quantity, use the derivative mean value theorem to show there is some $d$ between $c^*$ and $c$ such that $$\Big|f(c^*)-f(c)\Big| = |f'(d)| \cdot |c^*-c| \leq M (b-a)$$
so that
$$\left|\sigma - \int_a^b f(x)\,dx\right| \leq M(b-a)^2$$

Now suppose $P : a = x_0 \leq x_1 \leq \ldots \leq x_n = b.$  Then if we write
$$\sigma = \sum_{k=1}^n\sigma_k \quad \text{ where } \quad \sigma_k = f(c_k)(x_k-x_{k-1})\\ \int_a^b f(x)\,dx = \sum_{k=1}^n \int_{x_{k-1}}^{x_k} f(x)\,dx$$
then by the triangle inequality and the previous work applied to each subinterval of the partition:
$$\left|\sigma - \int_a^b f(x)\,dx\right| = \left|\sum_{k=1}^n\left(\sigma_k - \int_{x_{k-1}}^{x_k} f(x)\,dx\right)\right| \leq \sum_{k=1}^n \left|\sigma_k - \int_{x_{k-1}}^{x_k} f(x)\,dx\right| \leq \sum_{k=1}^n M(x_k-x_{k-1})^2$$
We finish by noting that $x_k - x_{k-1} \leq \|P\|,$ so
$$\left|\sigma - \int_a^b f(x)\,dx\right| \leq M \sum_{k=1}^n (x_k-x_{k-1})(x_k-x_{k-1}) \leq M\sum_{k=1}^n(x_k-x_{k-1})\|P\| = M(b-a)\|P\|$$
