Let a function f be continuous. Assume $\int_a^b f=0$ Prove $f(x)=0$ for all $x\in [a, b]$ Let $f:[a, b]\to \mathbb{R}$ be continuous. Assume $f(x)\geq 0$ for all $x\in[a, b]$, and that $$\int_a^b f\text{ }\mathrm{ d}x=0$$ Prove that $f(x)=0$ for all $x\in[a, b]$.

Would you recommend using a direct proof or a proof by contradiction by assuming there exists $y\in[a, b]$ such that $f(y)\geq 0$?
Sketch of proof:

Assume the opposite, so $f(x)&gt;0$ for some $x$. use continuity to prove $f$ is larger than a positive $l$ in a closed interval $[c,d]$ around $x$.

Use $\int_a^b\geq L\{a,c,d,b\}\geq (d-c)l&gt;0$ to conclude if $f$ is strictly positive in a point the integral is greater than zero.

Therefore if $\int_a^bf=0$ we have $f$ is never strictly positive.
Let $F'(x) = f(x)$. Then $F(b) - F(a) = 0$. The differential is defined in $b$ and $a$, and thus $(F(b) - F(a))' = 0'$, so $f(b) = f(a)$. 

Since the function $f$ is continuous, there is $c$ between $[a,b]$ such that $f(c) = f(a)$. We also have $F(b) - F(a) = F(b) - F(c) + F(c) - F(a)$, and as $f(x) \ge 0$, $F(c) = F(a)$ (because the integral is crescent) for every $c$ between $a and b$, so $f(c) = f(b) = f(a)= k$ for every $c$ in the interval and the integral reduces itself to $k(b-a)=0$, so $f(c)=k=0$.