# Let $X$ and $Y$ be independent exponential random variables with means $\beta_1$ and $\beta_2$ . What is the probability distribution of $Z=|X-Y|$?

We know that $$X\sim\text{Exp}(\beta_1)$$ and $$Y\sim\text{Exp}(\beta_2)$$ with the exponential pdf given by

$$F_X(x) = \frac{1}{\beta_1}e^{-x/\beta_1}$$.

My attempt was to try

$$P(Z < z) = P(X < Y+z) - P(X < Y-z)$$,

and got it to

$$P(X < Y + z) = 1 - \frac{\beta_1 e^{-z/\beta_1}}{\beta_1 + \beta_2}$$,

but couldn't work out the other probability since I got that the integral diverges. Any help moving forward is appreciated =)

• $P(X < Y-z) = P(Y > X+z) = 1-P(Y<X+z)$ and you seem to know how to work that out Dec 8 '20 at 1:54
• Here is an alternative approach: First, you calculate the distribution of $Z=X-Y$. Then you consider the distribution of $|Z|$. Here $X$ and $Y$ are independent, so the cases are symmetric. Dec 8 '20 at 1:55

\begin{align} \on{P}_{Z}\pars{z} & \equiv \bbox[5px,#ffd]{\int_{0}^{\infty}{\expo{-x/\beta_{1}} \over \beta_{1}} \int_{0}^{\infty}{\expo{-y/\beta_{2}} \over \beta_{2}}\, \delta\pars{z - \verts{x - y}}\dd y\,\dd x} \\[5mm] & = {\bracks{z > 0} \over \beta_{1}\beta_{2}}\int_{0}^{\infty}\expo{-x/\beta_{1}} \int_{0}^{\infty}\expo{-y/\beta_{2}}\ \times \\[2mm] &\ \phantom{= {\bracks{z > 0} \over \beta_{1}\beta_{2}}}\braces{\delta\pars{y - \bracks{x - z}} + \delta\pars{y - \bracks{x + z}}}\dd y\,\dd x \\[5mm] & = {\bracks{z > 0} \over \beta_{1}\beta_{2}}\int_{0}^{\infty}\expo{-x/\beta_{1}} \,\expo{-\pars{x - z}/\beta_{2}}\,\,\bracks{x - z > 0}\dd x \\[2mm] & + \,\,{\bracks{z > 0} \over \beta_{1}\beta_{2}}\int_{0}^{\infty}\expo{-x/\beta_{1}} \,\expo{-\pars{x + z}/\beta_{2}}\,\,\bracks{x + z > 0}\dd x \\[5mm] & = {\bracks{z > 0} \over \beta_{1}\beta_{2}}\expo{z/\beta_{2}} \int_{z}^{\infty}\expo{-x/\beta}\,\dd x \\[2mm] & + \,\,{\bracks{z > 0} \over \beta_{1}\beta_{2}}\expo{-z/\beta_{2}} \int_{0}^{\infty}\expo{-x/\beta}\,\dd x \end{align} where $$\ds{{1 \over \beta} \equiv {1 \over \beta_{1}} + {1 \over \beta_{2}}}$$.
Then, \begin{align} \on{P}_{Z}\pars{z} & = {\bracks{z > 0} \over \beta_{1}\beta_{2}} \pars{\expo{z/\beta_{2}}\beta\expo{-z/\beta} + \expo{-z/\beta_{2}}\beta} \\[5mm] & = {\bracks{z > 0} \over \beta_{1} + \beta_{2}} \bracks{\expo{-z/\beta_{1}} + \expo{-z/\beta_{2}}} \end{align} \begin{align} \mbox{} \\ &\bbx{\on{P}_{Z}\pars{z} = \bracks{z > 0} {\expo{-z/\beta_{1}} + \expo{-z/\beta_{2}} \over \beta_{1} + \beta_{2}}} \\ & \end{align}