Probability of random variables inequality

Let $X,Y$ be two independent continuous random variables. I have seen places that state that $$P(X\leq Y ) =\int\limits_{-\infty}^\infty \left(\int\limits_x^\infty f_Y(y) \, dy\right)f_X(x) \, dx$$ but I am trying to find a proof for this formula. The formula can be rewritten as $$P(X\leq Y) = \int\limits_{-\infty}^\infty P(x\leq Y)f_X(x) \, dx$$ I have tried to use conditional probability $$P(X\leq Y) = P(X\leq Y \mid X=x) = P(x\leq Y \mid X=x) = P(x\leq Y)P(X = x)$$ but the above vanishes since $X$ is continuous

• Someone down-voted this question. If that was intended to communicate something, it failed, since there is no indication of what objection to the question there might be. $\qquad$ – Michael Hardy Apr 12 '16 at 16:04
• In your argument, you need to apply a continuous version of law of total probability: $\Pr\{X \leq Y\} = \int_{-\infty}^{\infty} \Pr\{X \leq Y|X = x\}f_X(x)dx$. And in general the statement $\Pr\{X \leq Y\} = \Pr\{X \leq Y|X = x\}$ is wrong. – BGM Apr 13 '16 at 3:54

Consider the characteristic function $\chi_A$ of the set $$A=\{(x,y)\in\mathbb R^2:x\le y\}.$$ Then $$P(X\le Y)=\int_{-\infty}^\infty\int_{-\infty}^\infty\chi_A(x,y)f_X(x)f_Y(y)\,dx\,dy =\int_{-\infty}^\infty \left(\int_x^\infty f_Y(y) \, dy\right)f_X(x) \, dx.$$

• Any way to prove this without this notion? I have yet to learn this – Joshhh Apr 12 '16 at 15:43
• Actually this is the simplest possible proof. – John B Apr 12 '16 at 15:48

The main idea would be that $$\Pr(X\le Y) = \iint\limits_R f_{X,Y}(x,y)\,d(x,y), \tag 1$$ $$\text{where R is that region of the (x,y)-plane in which x\le y}.$$ This is a double integral (with respect to areas in the plane) as opposed to an iterated integral. The following is an iterated integral, i.e. one integral inside another: $$\int_{-\infty}^\infty \left(\int_x^\infty f_{X,Y}(x,y) \, dy\right) \, dx. \tag 2$$ The inside integral, $\displaystyle \int_x^\infty f_{X,Y}(x,y) \, dy$, since it has $y$ going from $x$ to $\infty$, stays within that part of the plane in which $x\le y$, but only for one value of $x$. The inner integral is thus a function of $x$, and that function gets integrated by the outer integral.

It can be deduced either from Fubini's theorem or from Tonelli's theorem that $(1)$ and $(2)$ are equal.

But then you add that $X$ and $Y$ are independent, and thus we can write $f_{X,Y}(x,y) = f_X(x) f_Y(y)$. Then we have $$\int_x^\infty f_X(x) f_Y(y) \, dy = f_X(x) \int_x^\infty f_Y(y)\,dy,$$ where $f_X(x)$ can be pulled out because $f_X(x)$ does not change as $y$ goes from $x$ to $\infty$. And finally our iterated integral becomes $$\int\limits_{-\infty}^\infty \left(\int\limits_x^\infty f_Y(y) \, dy\right)f_X(x) \, dx.$$ Fubini's theorem is usually stated in this form: The double integral $$\iint_{A\times B} f(x,y)\,d(x,y)$$ is equal to the iterated integral $$\int_A \left( \int_B f(x,y)\,dy\right)\,dx$$ if $$\iint\limits_{A\times B} |f(x,y)|\,d(x,y) <\infty \qquad(\text{note the absolute value}). \tag 3$$ Tonelli's theorem says the double integral is equal to the iterated integral if $f(x,y)\ge 0$ for all values of $x$ and $y$ (even if $(3)$ diverges to $\infty$).

(In some cases where the integral of the positive and negative parts of $f(x,y)$ are both infinite, the two iterated integrals converge to two different finite numbers. In those cases, the double integral is undefined.)

In this case the set over which we integrate is not of the form $A\times B$, but the whole plane is of that form, being $\mathbb R\times\mathbb R$, and we can multiply $f(x,y)$ by the indicator function of $R$, $$\mathbb 1_R (x,y) = \begin{cases} 1 & \text{if }x \le y, \\ 0 & \text{otherwise}, \end{cases}$$ and then apply Fubini's theorem to the function $f(x,y)\cdot\mathbb 1_R(x,y)$ on the whole plane $\mathbb R\times\mathbb R$.