Second moment from survival function Let X be a non-negative continuous random variable with probability density function f(x). Let $$G(t) = \int_{t}^{\infty} f(x)dx$$
Show that$$E(X^{2}) = 2\int_{0}^{\infty} tG(t)dt$$
My thoughts:
I know that $$E(X^{2}) = \int_{-\infty}^{\infty} x^{2}f(x)dx$$, so here I need to prove $$x^{2}f(x)dx = tG(t)dt$$
I'm stuck in this step. Can someone explain how to prove this problem? Any clue would be appreciated. Many thanks.
 A: Preamble
For any nonnegative random variable, 
$$\begin{align}
E[X] &= \int_0^\infty xf(x)\,\mathrm dx \tag{1}\\
&=\int_0^\infty [1-F(t)]\,\mathrm dt\tag{2}\\
&= \int_0^\infty P\{X > t\}\,\mathrm dt\tag{3}
\end{align}$$
where the world will end if those square brackets in the integral on the right
side of $(2)$ are ever opened and the integral is written as the difference of the integrals of $1$ and $F(t)$ over $(0,\infty)$.
These integrals calculate the area between the line at height $1$ and the curve
$F(t)$ (this is what $(2)$ is telling us) in two different ways.  
$(2)$ can be
interpreted as the
standard Riemann integral (measure theorists: please hold your fire, 
I am not talking to you) which is finding the area by breaking it up into
vertical narrow strips of height $[1-F(t)]$ and width $\Delta t$, and then making
the strips become narrower and narrower, talking of upper and lower Riemann
sums, taking limits, etc.
But, another way of finding the area is to divide it into very narrow horizontal
strips with the strip of length $x$ whose lower side
extends all the way from $0$ on the
vertical axis to the point $(x, F(x))$ on the curve. The upper side of this
horizontal strip is from the horizontal axis to the point $(x+\Delta x), F(x+\Delta x))$, that is, the width of this strip is 
$F(x+\Delta x) - F(x) \approx f(x)\Delta x$. Proceeding as before (making
the strips narrower etc,) we see
that the desired area can also be expressed as $(1)$.
End of preamble
From $(3)$, we can write
$$\begin{align}
E[X^2] &= \int_0^\infty P\{X^2 > t\}\,\mathrm dt\\
&= \int_0^\infty P\{X > \sqrt{t}\}\,\mathrm dt\\
&= \int_0^\infty 2yP\{X > y\}\,\mathrm dy&\scriptstyle{\text{substitute}~
y^2 = t, ~~2y\mathrm dy = \mathrm dt}\\
&= 2\int_0^\infty tG(t)\,\mathrm dt 
\end{align}$$
So, it is not quite as simple as proving that $x^{2}f(x)dx = tG(t)dt$
as you were trying to do (presumably by some kind of change of variable); 
we have to think about the matter a little
differently.
A: As $G(t)=\int_t^\infty f(t)dt$ so $G(t)=1-F(t)$, then we have to prove
$$E(X^2)=2\int_0^\infty t(1-F(t))\,\mathrm dt$$
Integrate the right hand side by parts taking $(1-F(t))$ as the first function
to get
$$\begin{align}
2\int_0^\infty t(1-F(t))\,\mathrm dt &=2\left((1-F(t))\frac{t^2}2 \right|^{\infty}_0 -2\int_0^\infty \frac{t^2}2(-f(t))\,\mathrm dt\\
&= 0+\int_0^\infty t^2f(t)\,\mathrm dt\\
&= \int_0^\infty t^2f(t)\,\mathrm dt\\
&= E[X^2]
\end{align}$$
and we are done. 
A: Note that, 
$$ \frac{d}{dx} \int_x^{\infty} f(t) ~ dt = -f(x) $$
(If you do not understand, ask why, and I will show you.) 
Now, rewrite the integral for $E[X^2]$ as follows, 
$$ E[X^2] = \int_{-\infty}^{\infty} x^2 \frac{d}{dx}\left\{-\int_t^{\infty} f(t) ~ dt \right\} ~ dx $$  
Now proceed with "partial integration". That is the main idea, maybe one has to adjust the limits correctly (to lazy to do that), but in either case, I leave that up to you. 
