Prove that $\mathbb P(X>Y) =\frac{b}{a + b}$ if $X, Y$ are exponentially distributed with parameters $a$ and $b$.

Let $X, Y$ be an exponentially distributed random variables with parameters $a, b$. Then $X$ has pdf: $$f_X(x) =\begin{cases} a e^{-a x},& x\geq 0\\ 0,& \text{otherwise}.\end{cases}$$ Suppose $X$ and $Y$ independent. Show that $$\mathbb P(X>Y) = \frac{b}{a+b}.$$

Now I thought the following: $$f(x,y) = f_X(x)\ f_Y(y) = abe^{-ax -by},\qquad\text{for } x,y > 0.$$ And then $$\mathbb P(X>Y) = \int_0^\infty \int_0^x a b e^{-ax -by}\,dydx$$ However, if I solve this (manually or using Wolframalpha), I can't seem to end up with $\frac{b}{a+b}$. Any ideas?


\begin{align*} P(X>Y) &= \int_{0}^\infty\int_{0}^x abe^{-ax}e^{-by}\,dydx\\ &=\int_0^\infty ae^{-ax}\left[\int_0^xbe^{-by}\,dy\right]\,dx\tag 1\\ &=\int_0^\infty ae^{-ax}\left(1-e^{-bx}\right)\,dx\\ &=\int_0^\infty ae^{-ax}-a e^{-(a+b)x}\,dx\tag 2\\ &=1-\frac{a}{a+b}\int_0^\infty(a+b)e^{-(a+b)x}\,dx\tag 3\\ &=\frac{a+b-a}{a+b}\\&=\frac{b}{a+b}. \end{align*} where in

  1. I recognize the inside integral as the cdf of $Y$
  2. The left integral is the integral of a density so it is $1$ and
  3. I make the integrand a density by multiplying and diving by the factor $a+b$ to make it equal $1$.

There is an alternative approach see this reference by first determining the pdf of $X-Y$ (or find it in tables)

$$f(x) = \frac{ab}{a+b} \begin{cases}e^{b x} & \text{if} \ x \leq 0\\ e^{-a x} & \text{if} \ x \geq 0 \end{cases} \ \ \ (*)$$

Remarks:

1) the curve of $f$ is tent-shaped (see figure below for the case $a=3$ and $b=1$).

2) a particular, rather well-known case of (*), is for $a=b$, the so-called double exponential $f(x)=\frac{1}{2}e^{-|x|}$.

Then the result is

$$\int_{x=0}^{\infty}f(x)dx=\int_{x=0}^{\infty}\frac{ab}{a+b}e^{-ax}dx=\frac{ab}{a+b}\frac{1}{a}=\frac{b}{a+b}.$$

enter image description here