# The Probability of $X<Y$ using Calculus

$X$,$Y$ are independent random variables, whose density function is $f(x,y)$.

To get the Probability of $X<Y$, I use the integration of the area $[-\infty,y]\times[-\infty,+\infty]$.

$P(X<Y)=\int\int{}f(x,y)=\int_{-\infty}^ydx\int_{-\infty}^{+\infty}f(x,y)dy$

$f(x,y)=f_{X}(x)f_{Y}(y)$

$\int_{-\infty}^ydx\int_{-\infty}^{+\infty}f(x,y)dy=\int_{-\infty}^ydx\int_{-\infty}^{+\infty}f_{X}(x)f_{Y}(y)dy=\int_{-\infty}^y[f_{X}(x)\int_{-\infty}^{+\infty}f_{Y}(y)dy]dx=\int_{-\infty}^y[f_{X}(x)\int_{-\infty}^{+\infty}f_{Y}(y)dy]dx=\int_{-\infty}^yf_{X}(x)dx=F_X(y)$

But we know that

$P(X<Y)=\int_{-\infty}^{+\infty}f_X(x)F_Y(x)dx$

What's wrong with my calculation?

-
We want $P(X<Y)$, so $x$ can only go up to $y$. Despite too many years integrating, I still always sketch the region. – André Nicolas May 9 '12 at 14:00

It is not true that you should integrate over $(-\infty,y] \times (-\infty,\infty)$. In order $X < Y$ to be true, for every given $y \in (-\infty,\infty)$ variable $x$ varies over $(-\infty,y]$ hence for every given $y$ you should integrate in $x$ over $(-\infty,y]$. Thus $$P(X < Y) = \int_\mathbb{R} dy \int_{(-\infty,y)} f(x,y) dx.$$ You should also observe that $P(X < Y)$ is a number. This implies that it cannot depend on $x$ or $y$.
Oh, what a naive mistake i've made! then how to calculate $P(X < Y) = \int_\mathbb{R} dy \int_{(-\infty,y)} f(x,y) dx$. – Charles Bao May 9 '12 at 10:39
You calculate this in the same way as you did. $\int_{(-\infty,y)} f_X(x) dx = F_X(y)$. – xen May 9 '12 at 11:10
It depends on $y$ but there is also the integral over $y$. – xen May 10 '12 at 4:59