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.
 A: $$
\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}
$$
A: 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*}
