Applying the Chain Rule to solve integral inequality I have the next exercise:

Suppose that $f$ has a decreasing derivative which satisfies $f'(x) \geq m \geq 0$ for all $x$ in $[a,b]$ prove that: $$\left| {\int_a^b \cos(f(x))dx}\right| \leq \frac {2}{m}$$

As a hint, I've got to first multiply and divide my function with $f'(x)$ and then apply this:  

If $f'$ is integrable and $g$ continuous  in $[a,b]$. Then exist $c \in [a,b]$ such that $$\int_a^b f(x)g(x)dx = f(a) \int_a^c g(x)dx + f(b) \int_c^bg(x)dx$$ 

I've already tried but I get a little bit confused using the Barrow's rule to get my integral and also applying the inequality $f''(x)\leq 0$ to get the main inequality. 
 A: I assume you already managed to derive something similar to the following:
$$
\def\d{\mathrm{d}}
\begin{align}
\left|\int_a^b \cos(f(x)) \, \d x \right|
&= \left|\int_a^b \frac{\cos(f(x))}{f'(x)} f'(x) \, \d x \right|\\
&= \left|\frac1{f'(a)}\int_a^c \cos(f(x)) f'(x) \, \d x + \frac1{f'(b)}\int_c^b \cos(f(x)) f'(x) \, \d x \right|\\
&= \left|\frac1{f'(a)}(\sin(c)-\sin(a)) + \frac1{f'(b)}(\sin(b)-\sin(c))\right|\\
&=\frac1{f'(b)}\left|\frac{f'(b)}{f'(a)}(\sin(c)-\sin(a)) + (\sin(b)-\sin(c))\right|
\end{align}
$$
Now the thing to note here is that $f'(a)\geq f'(b) \geq 0$ so $\frac{f'(b)}{f'(a)} \in [0,1]$. This allows us to find the upper bound as follows:
$$
\begin{align}
\frac1{f'(b)}&\left|\frac{f'(b)}{f'(a)}(\sin(c)-\sin(a)) + (\sin(b)-\sin(c))\right|\\
&\le \frac1{f'(b)} \max_{\lambda\in[0,1]} \left|\lambda(\sin(c)-\sin(a)) + (\sin(b)-\sin(c))\right|\\
&\le \frac1{f'(b)} \max_{\lambda\in[0,1]} \left|\lambda(\sin(c)-\sin(a)) + \lambda(\sin(b)-\sin(c)) + (1 - \lambda)(\sin(b)-\sin(c))\right|\\
&\le \frac1{f'(b)} \max_{\lambda\in[0,1]}  \bigl|\lambda(\sin(b)-\sin(a)) + (1-\lambda)(\sin(b) - \sin(c))\bigr|\\
&\le \frac1{f'(b)} \max_{\lambda\in[0,1]} \lambda|\sin(b)-\sin(a)| +  (1-\lambda)|\sin(b) - \sin(c)| \\
&\le \frac1{f'(b)} \max_{\lambda\in[0,1]} \lambda2 + (1-\lambda)2  \\
&\le \frac2{f'(b)} \le \frac{2}{m}
\end{align}
$$
Basically what we used here is the fact that the absolute value is a convex function, in the sense that for all $x,y$ and  $\lambda\in[0,1]$:
$$|\lambda x + (1-\lambda)y| \leq \lambda|x|+ (1-\lambda)|y|.$$
In fact since we're maximizing a convex function on a convex set we could have immediately concluded that the maximum had to be at the boundary, i.e. $\lambda=0$ or $\lambda=1$, both giving an upper bound of $\frac{2}{m}$, but in your case you probably can't just state that without proof.
