Integrable function Please help me prove this.
Suppose $f$ is defined in$\left [ a,b \right ]$ ,$f\geq 0$, $f$ is integrable in$ [a,b]$ and $\displaystyle\int_{a}^{b}fdx=0$
prove:
$\displaystyle\int_{a}^{b}f(x)^2dx=0$  
Thanks a lot!
 A: Let's assume we're working with the Lebesgue integral.
Define
$$
f_k(x)=\left\{\begin{array}{}f(x)&\text{if }k\le f(x)<k+1\\0&\text{otherwise}\end{array}\right.
$$
Since $f$ is measurable, so is each $f_k$.
Then since $f=\sum\limits_{k=0}^\infty f_k$ and each $f_k\ge0$, we have by dominated convergence
$$
\begin{align}
\sum_{k=0}^\infty\int_a^bf_k(x)\;\mathrm{d}x
&=\int_a^bf(x)\;\mathrm{d}x\\
&=0\tag{1}
\end{align}
$$
Since $f_k(x)\ge0$, we have $\int_a^bf_k(x)\;\mathrm{d}x\ge0$. $(1)$ says that the sum of non-negative terms is $0$; therefore, each $\int_a^bf_k(x)\;\mathrm{d}x=0$. Furthermore, by dominated convergence,
$$
\begin{align}
\int_a^bf^2(x)\;\mathrm{d}x
&=\sum_{k=0}^\infty\int_a^bf_k^2(x)\;\mathrm{d}x\\
&\le\sum_{k=0}^\infty(k+1)\int_a^bf_k(x)\;\mathrm{d}x\\
&\le\sum_{k=0}^\infty(k+1)\cdot0\\
&=0\tag{2}
\end{align}
$$

Let's assume we're working with the Riemann integral.

To be integrable, $f$ must be bounded (otherwise, for the partition interval on which $f$ is unbounded, the upper sum is infinite). Let $M=\sup\limits_{[a,b]}f$. Since $f\ge0$,
$$
\begin{align}
\int_a^bf^2(x)\;\mathrm{d}x
&\le M\int_a^bf(x)\;\mathrm{d}x\\
&=M\cdot0\\
&=0\tag{3}
\end{align}
$$
A: My first inclination would be to say that since $f\geq0$ and $\int_a^bfdx=0$, $f(x)=0$ for $x$ such that $a\leq x\leq b$.  Because of this, $\int_b^af(x)^2dx=0$.  You will probably need to fill in a fair amount of reasoning to make this hold up, though.  
Also, suggestion - accept some answers to your questions.  It makes people more likely to answer in the future.
A: Intuitively $f$ must be zero almost everywhere (term from Lebesgue theory). Now, if $f$ is zero almost everywhere then so is $f^2$, and then $\int f^2=0$ too.
That this is really the case is in fact trivial because $$0=\int_a^b f(x) dx =\int_a^b |f(x)|dx=\|f\|_{L^1(a,b)}$$
in other words the $L^1$-norm of $f$ is zero and then (because it is a norm) $f$ must be the $L^1$-zero function, that is $f$ must be zero almost everywhere. 
If we did not know that $f\mapsto\|f\|_{L^1(a,b)}$ is a norm, it is sufficient to prove that the set $A=\{x: \, f(x)>0\}$ has measure zero $\mu(A)=0$ (where $\mu$ is the Lebesgue measure). In order to do that we need some argument where we use $\int f = 0$ in simpler terms, one such method is to split the set into a countable number of disjoint sets that  we can control (similar to robjohn's argument). Having said that, let us consider 
$$A= \bigcup_{n=1}^\infty A_n$$
where $A_n=\{x: 1/n\le f(x) < 1/(n-1)\}$ (where in the exceptional case $n=1$ we mean $A_1=\{x : \,f(x)\ge1\}$ ).
Then since the sets are disjoint we have
$$\mu(A)=\sum_{n=1}^\infty\mu(A_n)=\sum_{n=1}^\infty\int_{A_n}1dx$$
and since $f(x)\ge 1/n$ on $A_n$ we have
$$\int_{A_n}1dx\le n\int_{A_n}f(x)dx\le n\int_a^bf(x)dx=n\cdot0=0$$
That is each $A_n$ has measure 0, and hence so has $A$.
