How to calculate $P(XI want to calculate the following probability of two random variables (we don't know if they are independant) $P(X<Y)$.
In the case they are discrete it is easy: $P(X<Y)=\sum_{-k=\infty}^{+\infty}P(X < Y \cap Y=k)=\sum_{-k=\infty}^{+\infty}\sum_{j=-\infty }^kP(X=j\cap Y=k)$
The question is the following: What is $P(X<Y)$ in the case of $X,Y$ being continuous ? The intuitive answer would be to replace $P(X=j\cap Y=k)$ with the joint density function $f_{X,Y}$ and so to have $\int_{-\infty}^{\infty}\int_{-\infty}^{y}f_{X,Y}(x,y)dxdy$
Is this correct or is there a mistake somewhere? 
 A: If $X$ and $Y$ have joint density $f(x,y)$, then for any Borel subset $D\subset{\bf R}^2$, one has
$$
P((X,Y)\in D) = \iint_{D}f(x,y)\,dxdy.
$$
In your example, you have $D = \{(x,y)\in{\bf R}^2\mid x<y\}$. By the Fubini theorem, 
$$
P(X<Y) = \iint_{\{x<y\}}f(x,y)\,dxdy = \int_{-\infty}^{\infty}\int_{-\infty}^yf(x,y)\,dxdy.
$$
So the integral you have is correct.
A: The idea is to apply the law of total probability :
\begin{align*}
\mathbb{P}(X<Y) &= \int_\mathbb{R} \mathbb{P}(X<Y \mid Y = y) f_Y(y) dy\\
&= \int_{-\infty}^\infty\int_{-\infty}^y f_{X\mid Y}(x\mid y)f_Y(y) dx dy\\
&= \int_{-\infty}^\infty\int_{-\infty}^y f_{X, Y}(x, y) dx dy\\
\end{align*}
Another way of doing that is using expectation :
\begin{align*}
\mathbb{P}(X<Y) &= \mathbb{E} [ \mathbb{1} (X<Y) ]\\
&= \int_{-\infty}^\infty\int_{-\infty}^{\infty} \mathbb{1} (x<y) f_{X, Y}(x, y) dx dy\\
&= \int_{-\infty}^\infty\int_{-\infty}^{y} f_{X, Y}(x, y) dx dy\\
\end{align*}
I prefer the second one since it matches better with measure theory.
