Im trying to prove $$E[X^2]=2\int_0^\infty x(1-F(x)) \, dx $$ Where the integral area is from 0(at the bottom of the integral) and infinity. Also X>0 with density f(x) and Distribution function F(x).
I know $$E[X^2]=\int_0^\infty x^2f(x) \, dx$$ but I don't know what value of f(x) I would substitute in if thats what I am meant to do. Thanks
Hint: write $F(x)=\int_0^x f(y) \mathop{dy}$ to obtain a double integral, then switch the order of integration.