How can I find this probability $P(X<Y)$ ? knowing that X and Y are independent random variables.
$\endgroup$ 23 Answers
$\begingroup$Assuming both variables are real-valued and $Y$ is absolutely continuous with density $f_Y$ and $X$ has cumulative distribution function $F_X$ then it is possible to do the following
$$ \Pr \left[ X < Y \right] = \int \Pr \left[ X < y \right] f_Y \left( y \right) \mathrm{d} y = \int F_X \left( y \right) f_Y \left( y \right) \mathrm{d} y $$
Otherwise, as @ThomasAndrews said in a comment, it is case-by-case.
$\endgroup$ $\begingroup$I think we can control everything by the following general solution.
Consider $Z:=X-Y$. Then, by putting condition on the value of X, we get
$$\begin{align} P(X<Y) & = P(Z<0)\\ & =\int_{-\infty}^{\infty}P(Z<0|X=x)dF_{X}(x)\\ & =\int_{-\infty}^{\infty}P(X-Y<0|X=x)dF_{X}(x)\\ & =\int_{-\infty}^{\infty}P(x-Y<0|X=x)dF_{X}(x)\\ & =\int_{-\infty}^{\infty}P(x<Y)dF_{X}(x)\\ & =\int_{-\infty}^{\infty}(1-P(Y\leq{x}))dF_{X}(x)\\ & =\int_{-\infty}^{\infty}(1-F_{Y}(x))dF_{X}(x) \end{align}$$
You may also put a condition on the value of $Y$ to get a similar result. So, the solution of this problem depends on what you want.
$\endgroup$ $\begingroup$Two of the previous answers are specific for continuous random variables. For discrete independent random variables $X$ and $Y$ the probability of $X > Y$ can be written as$$\mathbb{P}(X < Y) = \sum_{x \in R_{X}} \, \sum_{y \in R_{Y}\, | \, y > x} \mathbb{P}(x,y)$$or can be written as$$\mathbb{P}(X < Y) = \sum_{y \in R_{Y}} \, \sum_{x \in R_{X}\, | \, x < y} \mathbb{P}(x,y)$$where in each case the subscript on the second is only for $x < y$ and where
- $R_{X}$ is the range of random variable $X$
- $R_{Y}$ is the range of random variable $Y$
- $\mathbb{P}(x,y)$ is the joint probability of $X$ and $Y$
Since $X$ and $Y$ are independent random variables$$\mathbb{P}(x,y) = \mathbb{P}_{X}(x) \cdot \mathbb{P}_{Y}(y)$$where $\mathbb{P}_{X}$ is the marginal probability of $X$ and $\mathbb{P}_{Y}$ is the marginal probability of $Y$.
Thus, the summations are over each allowed pair of $X$ and $Y$
$$\mathbb{P} = \sum_{x \in R_{X}} \, \sum_{y \in R_{Y}\, | \, y > x} \mathbb{P}_{X}(x) \cdot \mathbb{P}_{Y}(y)$$or$$\mathbb{P} = \sum_{y \in R_{Y}} \, \sum_{x \in R_{X}\, | \, x < y} \mathbb{P}_{X}(x) \cdot \mathbb{P}_{Y}(y)$$In either case, the summation is over all pairs of $X$ and $Y$ such that $X < Y$.