# Changing order of integration of $\int_0^{\infty}\int_{a}^{\infty} f_{Y}(x) dx\ dy$?

I am trying to follow a proof where $Y$ is a continuous random variable with probability density function $f_{Y}$.

What I don't get is how or why changing order of integration of the following

1. $\int_0^{\infty} P(Y \gt a) dy = \int_0^{\infty}\int_{a}^{\infty} f_{Y}(x) dx\ dy$ leads to

2. $= \int_0^{\infty}(\int_{0}^{x}\ dy) f_{Y}(x)\ dx$

What are the explicit algebraic or calculus manipulations which take us from 1 to 2?

• They are applying Fubini's theorem. What exactly do you want to know? I am not really understanding what is your question. Are you having trouble with the integral bounds? – Patrick Da Silva Oct 26 '13 at 1:30
• By the way, there is a little problem with $$\int_0^{\infty} P(Y > a) dy$$ because $y$ does not appear in the integrand. There is also a problem with $2.$ because there $a$ has disappeared. – Patrick Da Silva Oct 26 '13 at 1:32
• what's the problem? $a$ is just some constant. The integral $\int_0^{\infty}$ just happens to contain the expression $P(Y \gt a)$. – T. Webster Oct 26 '13 at 1:33
• @PatrickDaSilva I realize they are applying Fubini's theorem, but what is the algebra that takes us from the equation in 1 to the one in 2? – T. Webster Oct 26 '13 at 1:34
• The lower bound of the inner integral should be $y$ not $a$. – Mhenni Benghorbal Oct 26 '13 at 1:36

I will guess what would've been the correct expression. I am guessing $$\int_0^{\infty} P(Y > y) dy$$ is the integral you want to compute (there is a theorem in which this expression appears...). $$\int_0^{\infty} P(Y > y) dy = \int_0^{\infty} \int_y^{\infty} f_Y(x) \, dx \, dy.$$ Now you want to start integrating this integral with respect to $y$ instead of $x$ first. The region of the $xy$-plane you are integrating over is $$\{ (x,y) \, | \,0 \le y \le x \}$$ because $y$ has no constraint except being positive, but $x$ has the constraint of being greater than $y$. If you swap these conditions around, $x$ has no constraint, but $y$ has the constraint of being smaller than $y$. This means that by Fubini's theorem, $$\int_0^{\infty} \int_y^{\infty} f_Y(x) \, dx \, dy = \int_0^{\infty} \int_0^x f_Y(x) \, dy \, dx.$$ Note that the order of integration has changed, so that since $f_Y(x)$ does not depend on $y$, the first integral can be factored : $$\int_0^{\infty} \int_0^x f_Y(x) \, dy \, dx = \int_0^{\infty} \left( \int_0^x \, dy \right) f_Y(x) \, dx = \int_0^{\infty} x \, f_Y(x) \, dx = \mathbb E [ Y ],$$ which I'm guessing was the point of this computation.
• Yes that helps and you guess correct. The reason I took $a$ to be the place of $y$ was just confusion over application of e.g. $P(Y \le a) = F_y(a) = \int_0^a f_y(a) dy$. Here the proof specifically intends to prove $\mathrm{E}[Y] = \int_0^{\infty} P(Y > y) dy$ – T. Webster Oct 26 '13 at 21:46
• Did you mean $y$ has the constraint of being smaller than $x$? – T. Webster Oct 26 '13 at 22:00
• Well essentially if you first integrate over $y$ then over $x$, then $y$ is free and $x \ge y$. But if you integrate first over $x$ and then over $y$, then $x$ is free and $0 \le y \le x$. But of course this is just two different ways of saying that $0 \le y \le x$. – Patrick Da Silva Oct 27 '13 at 0:58