# Comparing two exponential random variables

Let $A$ and $B$ be independent random variables drawn from the exponential distribution with parameters $\lambda_A<\lambda_B$. What is the probability that $A<B$?

I'm of course aware of the probability density function and the cumulative distribution function of the exponential random variable, but I'm not sure how to use it to answer this question. Also, there seems to be no such formula on the Wikipedia page.

Since $$A$$ and $$B$$ are independent, their joint density is: $$p(a, b) = \lambda_A\lambda_Be^{-(\lambda_Aa+\lambda_Bb)}$$
In general, if we have a joint density $$p(a, b)$$ defined on non-negative reals, we want the probability that $$B$$ can take any value $$[0,\infty]$$ and that $$A$$ can take any value $$[0,B]$$: $$P(A < B) = \int_0^\infty \int_0^b p(a, b) da db$$ So $$\begin{eqnarray*} P(A < B) &=& \int_0^\infty \int_0^b p(a, b) da db \\ &=& \int_0^\infty \lambda_B e^{-\lambda_Bb} \int_0^b \lambda_A e^{-\lambda_Aa} da db \\ &=& \int_0^\infty \lambda_B e^{-\lambda_Bb} (1 - e^{-\lambda_Ab}) db \\ &=& \int_0^\infty \lambda_B e^{-\lambda_Bb} db - \int_0^\infty \lambda_B e^{-(\lambda_A + \lambda_B)b} db \\ &=& 1 - \frac{\lambda_B}{\lambda_A + \lambda_B} \\ &=& \frac{\lambda_A}{\lambda_A + \lambda_B} \\ \end{eqnarray*}$$
• Why do we know this equation for $P(A<B)$ in your second equation? – D Ford Nov 15 '17 at 20:24
• Given a joint density $p(a, b)$, the probability of a set E occurring is given by integrating over that set: $\int_{(a, b) \in E} p(a, b) da db$. Since these are non-negative random variables, $B$ can take any non-negative value (i.e. it is in $[0, \infty]$). Then the set such that $A < B$ are all those values of $A$ from $0$ up to a particular $b$. The outer integral is with respect to $db$ which is free to go from $0$ to $\infty$, but the inner one is restricted to go from $0$ to $b$ (for each possible $b$). – muaddib Nov 16 '17 at 5:08
• For clarity, I could just as well have written $P(A<B) = \int_0^\infty \int_a^\infty p(a,b) db da$. – muaddib Nov 16 '17 at 5:19
\begin{align} Pr(A\leq B) &=\int_{0}^{\infty}f_B(y)Pr(A\leq y)dy\\ &=\int_{0}^{\infty}\lambda_B e^{-\lambda_B y}(1-e^{-\lambda_A y})dy\\ &=\frac{\lambda_A}{\lambda_A+\lambda_B} \end{align}