If $f$ is continuous on $[a,b],$ $f(x)\geq 0 $ $(\forall x\in [a,b])$ and $\int^{b}_{a} f = 0,$ then $f = 0$ on $[a,b].$ Here is my proof:
Given $\epsilon>0, \exists$ partition $P = \{x_0 =a,...,x_n =b\}$ of $[a,b]$ such that $\sum^{n}_{i=1} (M_i-m_i)\Delta x_i < \epsilon,$ where $M_i = \sup\{f(x): x\in \Delta x_i\}$ and $m_i =\inf\{f(x): x\in \Delta x_i\}.$ Since $m_i = 0,$ we have $\sum^{n}_{i=1} M_i\Delta x_i < \epsilon$ and hence $M_i < \epsilon.$ Since $\epsilon>0$ is arbitrary, $f = 0 $ on $[a,b]. $ 
May I know why we need $f$ to be continuous on $[a,b]?$ Why couldn't we just have  $f(x)\geq 0 $ $(\forall x\in [a,b])$ and $\int^{b}_{a} f = 0 ?$  Could there be something wrong with my proof? Please advise,thank you.  
 A: You need $f$ to be continuous, else you can just take $f:[0,1]\to \mathbb{R}$ which is zero everywhere except one point.
Now for the proof, something is wrong - why is $m_i = 0$?
The usual proof goes something like this : If $f \neq 0$, then $\exists p \in (a,b)$ such that $\epsilon := f(p) > 0$ (because if not, then continuity would force it to be zero on the boundary as well).
Now by continuity, there is an open interval $(p-\delta, p+\delta)$ such that
$$
f(x) > \epsilon/2 \quad\forall x\in (p-\delta,p+\delta)
$$
Now let $I = [p-\delta/2,p+\delta/2]$, then
$$
\int_a^b f(x)dx \geq \int_I f(x)dx \geq \frac{\epsilon\delta}{2} > 0
$$
where the first inequality follows from the fact that $f(x) \geq 0$ for all $x\in [a,b]$.
A: A different proof: pick any $x_0 \in (a,b)$. Let $\delta>0$. Since $f \geq 0$, we deduce that
$$
\int_{x_0-\delta}^{x_0+\delta} f(x)\, dx =0.
$$
Therefore, by the mean value theorem for integrals,
$$
f(x_0)= \lim_{\delta \to 0} \frac{\int_{x_0-\delta}^{x_0+\delta} f(x)\, dx}{2\delta}=0.
$$
Hence $f=0$ in $(a,b)$. By continuity again, $f(a)=0=f(b)$.
