If integral is zero and function is continuous and non negative, then what about the function? [duplicate]

If $f$ is continuous on $[a,b]$, $f(x)≥0$ on $[a,b]$ and $$\int_{a}^{b} f(x) =0$$

then prove that $f(x)=0$ for all $x \in [a,b]$.

I tried with Riemann's definite integral definition but couldn't proceed


Something more easy. If $f$ is continuous in $[a,b]$ then we can define a map $F:[a,b]\to\Bbb R$ such that $F(x)=\int_a^x f(x) dx$ and $F'=f$.

We have $F(x)≥0$ for every $x \in [a,b]$ because $f(x)\geq0$ for every $x \in [a,b]$.

Also $F$ is increasing because $f(x)≥0$ and we have $F(a)=F(b)=0$, thus $F$ is constant and especially $F(x)=0$.

So $f(x)=0$ for every $x \in [a,b]$.


Hint: Suppose that $f$ were not identically zero, and choose $x_0 \in (a, b)$ for which $f(x_0) > 0$. Then there exists an $\epsilon > 0$ such that

$$|x - x_0| < \epsilon \implies f(x) > \frac{1}{2} f(x_0)$$

Try considering a partition of the interval containing the interval $[x_0 - \epsilon, x_0 + \epsilon]$, and compute a lower sum.