# 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

$$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$$ $$\ds{\bbox[5px,#ffd]{}}$$
\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}