There are two formulas for expected value in terms of CDF:
$$ E(X)=\int_{-\infty}^{\infty}xdF_X(x) $$
$$ E(X)=\int_{0}^{\infty}(1-F_X(x))dx-\int_{-\infty}^{0}F_X(x)dx $$
See e.g. Wikipedia. Are they the same?
I tried to use Riemann–Stieltjes integral and prove they are the same. However, I cannot prove that:
$$ \lim\limits_{x\rightarrow \infty}x(1-F_X(x))=0 $$
There seems to be a proof in this link but I don't get it. I think it assumes that the density function exists. Is this assumption necessary?
Thanks.
EDIT
This might be an answer:
This is how I tried to prove this. Using integration by parts: $$ \int_a^bf(x)dg(x)=f(b)g(b)-f(a)g(a)-\int_a^bg(x)df(x) $$ we have: $$ \int_{0}^{\infty}(1-F_X(x))dx=\lim\limits_{x\rightarrow \infty} x(1-F_X(x))-0-\int_{0}^{\infty}xd(1-F_X(x))\\ =\lim\limits_{x\rightarrow \infty} x(1-F_X(x))+\int_{0}^{\infty}xdF_X(x) $$
Similarly,
$$ \int_{-\infty}^{0}F_X(x)dx=-\lim\limits_{x\rightarrow -\infty} xF_X(x)-\int_{-\infty}^{0}xdF_X(x)\\ =\lim\limits_{x\rightarrow \infty} xF_X(-x)-\int_{-\infty}^{0}xdF_X(x)\\ =\lim\limits_{x\rightarrow \infty} x(1-F_X(x))-\int_{-\infty}^{0}xdF_X(x) $$
Therefore, $$ E(x)=\lim\limits_{x\rightarrow \infty} x(1-F_X(x))-\lim\limits_{x\rightarrow \infty} x(1-F_X(x))+\int_{0}^{\infty}xdF_X(x) +\int_{-\infty}^{0}xdF_X(x) $$