# If $Y_1, Y_2$ are exponential random variables, how can I find $P(Y_1 <Y_2)$?

If I have that $Y_1, Y_2$ are independent exponential random variables with rate parameter $\lambda_1, \lambda_2$ respectively, how can I find $P(Y_1<Y_2)$? I know that I am supposed to use the integral but cannot get the joint distribution. Thanks.

• ist there any relationship between the too? Commented Dec 12, 2015 at 3:21
• I can't get the joint distribution either. But if you tell me the $Y_i$ are independent then I can. Commented Dec 12, 2015 at 3:24
• They are independent, sorry for not mentioning that Commented Dec 12, 2015 at 3:27

You want to integrate over the region $Y_1<Y_2$:

$$P(Y_1<Y_2)=\int_0^\infty\int_0^{y_2}\lambda_1 e^{-\lambda_1 y_1}\lambda_2 e^{-\lambda_2 y_2} \, dy_1 \, dy_2.$$

This is relatively straightforward to evaluate. The answer should be

$$\frac{\lambda_1}{\lambda_1+\lambda_2}.$$

• Do you know why you have a double integral? Normally my understanding of the formula is: $\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$ thanks! Commented Dec 12, 2015 at 3:28
• @user136503: It's equivalent, since $F_X(y)=\int_0^y f_X(t)dt$. Commented Dec 12, 2015 at 3:31
• I am unconvinced that your numerator in the bottom line should be $\lambda_2$ rather than $\lambda_1$. ${}\qquad{}$ Commented Dec 12, 2015 at 3:43
• The one with the higher rate is more likely to be smaller than the other one, so the probability that $Y_1$ is smaller should get bigger as $\lambda_1$ gets bigger. Hence the numerator should be $\lambda_1$. ${}\qquad{}$ Commented Dec 12, 2015 at 3:50
• @MichaelHardy: Thanks, I stupidly thought the mean is $\lambda$ and performed the exact same analysis :). Commented Dec 12, 2015 at 3:51

$$\Pr(Y_1<Y_2) = \operatorname{E}(\Pr(Y_1<Y_2\mid Y_1)) = \operatorname{E}(e^{-\lambda_2 Y_1}) = \int_0^\infty e^{-\lambda_2 y_1} \Big( e^{-\lambda_1 y_1} (\lambda_1\,dy_1) \Big).$$

Or, if you prefer: $$\Pr(Y_1<Y_2) = \int_0^\infty \Pr(y_1<Y_2) e^{-\lambda_1 y_1} (\lambda_1\,dy_1) = \int_0^\infty e^{-\lambda_2 y_1} \Big( e^{-\lambda_1 y_1} (\lambda_1\,dy_1) \Big).$$

• I've never seen that first equality before -- what's it called, and why does it work? Reminds me of the tower property a bit Commented Dec 12, 2015 at 3:42
• @Nitin : It's the law of total probability, although that term is used in different ways. There is a law of total expectation (google it) and there is a law of total variance. The latter breaks the total variance into explained and unexplained components. ${}\qquad{}$ Commented Dec 12, 2015 at 3:45
• @Nitin : The law of total probability can be stated as $\Pr(A) = \operatorname{E}(\Pr(A\mid X))$, where $X$ is a random variable. Say for example $X$ can be equal to either $x_1$ or $x_2$. Then $\Pr(A\mid X=x_1)$ and $\Pr(A\mid X=x_2)$ are just simple conditional probabilities. And then $\Pr(A\mid X)$ is a random variable, equal to $\Pr(A\mid X=x_i)$ with probability $\Pr(X=x_i)$ for $i=1,2$. So the identity says $\Pr(A) = \Pr(A\mid X=x_1)\Pr(X=x_1) + \Pr(A\mid X=x_2) \Pr(X=x_2)$. ${}\qquad{}$ Commented Dec 12, 2015 at 3:48
• @MichaelHardy So basically in the first equality, what you did was take $E(I_{Y_1<Y_2}) = P(Y_1 <Y_2)$ and then use $P(Y_1 <Y_2) = E(I_{Y_1<Y_2}) = E(E(I_{Y_1<Y_2}|Y_1)) = E(P(Y_1 <Y_2 | Y_1))$, where $I_{Y_1<Y_2}$ is an indicator random variable? Commented Dec 12, 2015 at 3:52
• @user136503 : Certainly it can be looked at that way. ${}\qquad{}$ Commented Dec 12, 2015 at 4:02