My question is from the book Bertsekas, "Introduction to probability".
Let's say X is continuous first
I believe I should maniputate the given expression to look the like known definiton of Expecation.
$ E[X] = \int_{-\infty}^\infty x \times f_X(x) dx $
equivalently,
$ \int_{0}^\infty P(X > x)dx = \int_{0}^\infty \Bigl(\int_{x}^\infty f_X(x) dx\Bigr) dx $
The solution is given below.
Why is a new variable y introduced? and why did the limits change from $(x,\infty)$ to $(0,y)$
Thanks.


The solution uses the definition of the tail probability for a nonnegative random variable $P(x>x)=\int_x^\infty f(\tau) d\tau$. The next step is switching the order of integration (Fubini's theorem).