so I need to show that: $$ E(X^n) = n\int_0^\infty x^{n-1}P(X>x) \, dx $$ where $X$ has density $f$, and $f(x)=0$ for all $x<0$, $n>0$. Here's what I did so far: $$ E(X^n) = \int_{-\infty}^\infty x^nf(x) \, dx = \int_0^{\infty} x^n f(x) \, dx $$ Now I've tried using integration by parts by letting $u = x^n, du=nx^{n-1}\,dx; dv=f(x)\,dx, v=F(x)$, so the integral becomes: $$ x^nF(x)|_0^{\infty} - \int_0^{\infty} nx^{n-1}F(x)\,dx= x^nF(x)|_0^{\infty} -\int_0^{\infty} nx^{n-1}P(X \le x)\,dx=\\ x^nF(x)|_0^{\infty} -\int_0^{\infty} nx^{n-1}P(X \le x)\,dx= x^nF(x)|_0^{\infty} -\int_0^{\infty} nx^{n-1}(1-P(X>x))\,dx $$ I think I'm really close, but just don't know where to go from here. Any ideas?
So sorry about that, I copied down the question wrong and never realized it. I hope this makes more sense now.
NOTE The original portion of the answer refers to the previous edit of the question that concerned the non-positive RVs instead of nonnegative ones.
This cannot be true: since $P(X>x)=0 \,\forall{x}>0$, your right - hand side is always zero.
Actually, you have arrived at a correct expression in the end.
EDIT For your corrected problem formulation,
$$ EX^n=\int_0^\infty x^nf(x)dx = -\int_0^\infty x^n(P(X>x))^\prime_xdx=-x^nP(X>x)|_0^\infty + \int_0^\infty nx^{n-1}P(X>x)dx=\int_0^\infty nx^{n-1}P(X>x)dx. $$