How can we factor out the maximum value of f'(x) in an integral with an absolute value? I'm currently trying to understand a proof concerning the error term in the left- and right Riemann sums to approximate a definite integral. What I can't seem to understand is the last three lines of the proof where the author first factors out the maximum value of the derivative of f and sets up an inequality? The second part of my question then is how the author expands the integral to get the squared bracketed terms and the term 1/2.
[Proof Image from Research Paper]http://imgur.com/xnvgQup

By the Mean Value Theorem you have
$$
f(x)-f(x_k^*)=f'(\xi)(x-x_k^*)\leq(x-x_k^*)\max_{[a,b]}{f'}.
$$
Then, by integrating $x-x_k^*$ you get
$$
\frac{1}{2}(x-x_k^*)^2
$$
but you should be careful with the absolute value and separate the part in which $x\geq x_k^*$ and the other one where $x<x_k^*.$
