I have the following problem:
Show that E[X] = $\int_0^\infty [1 - F_x(x)]dx$ where x is a continuous, non-negative random variable.
The solution is as follows:
$$\int_0^\infty [1 - F_x(x)]dx = \int_0^\infty P(X \gt x)dx \qquad(1)$$ $$ = \int_0^\infty \int_x^\infty f_x(y)dydx \qquad(2) $$ $$ = \int_0^\infty \int_0^y dx f_x(y)dy \qquad(3) $$
$$= \int_0^\infty yf_x(y)dy = E[X] \qquad(4)$$
I get the train of thought but I don't understand how the coefficients on the inner integral go from x to infinity in step 2 to 0 to y in step 3.