Why must a continuous function be null if its definite integral is null? Let $ f(x) = \begin{cases} f:[a,b] \rightarrow\mathbb R  \\ \int_{a}^{b}f = 0 \end{cases}$. Prove: if $f$ is continuous, then $f\equiv 0$.
I'm still trying to get the intuition on the situation. For instance, if $f(x) = sin(x), x \in {[0, 2\pi]}$, it's true that $\int_{0}^{2\pi}sin(x) = 0$, but it does not imply $sin(x) \equiv0$. What did I misinterpret here? After the understanding of the situation, I'd like to know how would a formal proof follow. 
I'm a freshman Pure Math student who barely started the course and has very few practice in writing proofs, although slightly less worse at reading them. I'd like a level of rigor in this line of thought.
EDIT: as it is noticeable from the comments below, there is a condition missing in the statement: $f \geq0$.
 A: A reasonably formal proof of the statement is:
Suppose that $f(x)\ge 0$ for $x\in [a,b]$, and that $\int_a^b f(x)\,dx = 0$. Suppose further that there is some $c\in [a,b]$ with $f(c)>0$. Then by continuity, there is some open interval $(c_0,c_1)\subset [a,b]$ such that $f(x)>0$ for $x\in (c_0, c_1)$. Now consider any partition of $[a,b]$ such that one of the subintervals $[a',b']$ of the partition is contained in $(c_0,c_1)$. The Riemann sum associated with that partition consists of the areas of various rectangles; since $f\ge 0$ everywhere, each such area is nonnegative, and since $f$ is positive on $[a',b']$, the area of that rectangle, $A$, is $(b'-a')$ times the minimum value of $f$ on $[a',b']$. Therefore the Riemann sum is positive and is $\ge A$. 
Now refine that partition so that the mesh approaches zero. Refinements of $[a',b']$ yield areas no less than $A$, while other rectangles remain nonnegative. Thus the area of any refinement is at least $A>0$, so that the integral is strictly positive.
It follows that $f$ must be zero everywhere on $[a,b]$.
A: Let $P= \lbrace t_{1},...,t_{n} \rbrace  $ a partition of $[a,b]$ and suppose there exists $c \in (a,b)$ such that $f(c) > 0$. Now, let $\epsilon > 0 $ such that $(c-\epsilon, c+\epsilon) \subset [t_{i},t_{i+1}]$ for some $i \in {1,...,n}$. 
Thus, $\int_a^{b} f(x) dx = \underbrace{\int_a^{c-\epsilon}}_{\geq 0} + \underbrace{\int_{c-\epsilon}^{c+\epsilon} f(x) dx}_{> 0} + \underbrace{\int_{c+\epsilon}^{b}f(x)dx}_{\geq 0} > 0$, which is contradiction since $\int_{a}^{b} f(x)dx = 0$ by hypothesis.   
