Comparing two exponential random variables

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*}


$$ \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} $$