If L(P, f) = U(P, f), prove that f is a constant function on [a, b] 
That is what I have for the beginning of my proof, but I'm not sure how to conclude that the function is constant. 
 A: By definition
$$m_i=\inf_{x_{i}\le x\le x_{i+1}} f(x),\quad M_i=\sup_{x_{i}\le x\le x_{i+1}} f(x)$$
Since trivially $m_i\le M_i$ and $(x_{i+1}-x_i) >0$, if one $m_i<M_i$ we have that strict inequality holds between $L(f,P)$ and $U(f,P)$, hence $m_i=M_i$ for all $i$. Then as
$$m_i\le f(x^*)\le M_i=m_i,\qquad x_i\le x^*\le x_{i+1}$$
so equality holds and $f(x^*)=m_i$. So we have that $f(x)$ is piecewise constant on each $[x_i,x_{i+1}]$ and equal to $m_i$ on these intervals for every $0\le i<n$.
But then, we have that $m_i=f(x_i)=f(x_{i+1})=m_{i+1}$, so that $m_i=m_{i+1},\; 0\le i <n$
hence all the $m_i$ are equal, and so $f$ is constant on all of $[a,b]$ since any $x\in [a,b]$ is in one of the $[x_i,x_{i+1}]$.
A: Write
$$U(P,f)-L(P,f) = \sum (M_i-m_i) (x_{i+1}-x_i) = 0 $$
Every term in the sum is nonnegative since both $(M_i-m_i) \geq 0$ and $x_{i+1}-x_i > 0$. The only way the sum evaluates to zero is if... which means $f$ is constant on each interval... finally we make sure endpoints are okay.
