Double integration proof for expectation of a random variable.

1.1k Views Asked by At

Let X $\ge 0$ be a continious random variable. Prove $E(X) = \int_0^\infty P (X>t)dt$.

Here is the proof: Denote by f the density of X, then

$\int_0^\infty P(X > t)dt = \int_0^\infty\int_t^\infty f(x)dxdt = \int_0^\infty f(x) \int_0^xdt dx = \int_0^\infty f(x)*x dx = E(X).$

I don't understand how $\int_0^\infty\int_t^\infty f(x)dxdt = \int_0^\infty f(x) \int_0^xdt dx$.