Possible Duplicate:
Problems on expected value
I have the following exercise I wish to solve:
Let $X$ be a continuous random variable with distribution function $F$ and continuous density function $f$.
Assume that $X$ is nonnegative; that is, $\forall x\leq0\, F(x)=0$.
Assume that $Ex<\infty$. Prove that $EX=\int_{0}^{\infty}(1-F(x))\, dx$
Assume that $Ex=\infty$. Prove that $\int_{0}^{\infty}(1-F(x))\, dx=\infty$
What I tried:
Using integration by parts with $u=1-F(x),v'=1$ (hence $u'=-f(x),v=x)$ we get $$\int_{0}^{\infty}(1-F(x))\, dx=(1-F(x))x|_{0}^{\infty}-\int_{0}^{\infty}-f(x)x\, dx$$
$$=(x-xF(x))|_{0}^{\infty}+\int_{0}^{\infty}f(x)x\, dx$$
$$=(x-xF(x))|_{0}^{\infty}+EX$$
Since $$(x-xF(x))|_{0}=0$$
we need to prove $$\lim_{x\to\infty}x(1-F(x))=0$$ which I tried to show by L'Hôpital's rule and failed.
Can someone please help me continue with my way, or suggest another way to prove the requested equality ?