Suppose that f: [a,b] \rightarrow \mathbb {R} is a bounded function for which there is a partition P of  [a,b] with L(f,P)=U(f,P). Prove that f:[a,b] \rightarrow R is a constant.

Proof so far.

Let P = \{ a=x_1, x_2, x_3, . . . , x_{n-1},x_n=b \}
Define M_k = sup \{ f(x) : x \in [x_k,x_{k+1} ] \} and m_k = inf \{ f(x) : x \in [x_k,x_{k+1} ] \}

Now, U(f,P)= \sum ^n _{k=1} M_k(x_{k+1}-x_k) = U(f,P)= \sum ^n _{k=1} m_k(x_{k+1}-x_k) = L(f,P)

Now, I think that  \sum ^n _{k=1} (x_{k+1}-x_k) = b-a, so we have M_k=m_k \ \ \ \forall k .

So the max and min of interval are the same, would that be enough to show that f is a constant function?