CDF and PDF of Absolute Difference of Two Exponential Random Variables

exponential distributionprobability

I'm studying probability theory and came across an exercise problem that I would like to request some help with. Here's the problem:

Let $X$ and $Y$ be i.i.d. random variables with Expo($1$), and let $Z = | X – Y |$. Find the CDF and PDF of $Z$.

My attempt

\begin{align}
F_Z(z) & = P(Z \le z)\\
& = P(|X – Y| \le z) \\
& = P(-z \le X – Y \le z) \\
& = P(X – Y \le z) – P(X – Y \le -z) \\
& = P(X \le Y + z) – P(X \le Y – z) \\
& = F_X(Y + z) – F_X(Y – z) \\
& = (1 – e^{-(Y + z)}) – (1 – e^{-(Y – z)}) \\
& = e^{-(Y – z)} – e^{-(Y + z)} \\
\end{align}

\begin{align}
f_Z(z) & = \frac{d}{dz}F_Z(z) \\
& = \frac{d}{dz}(e^{-(Y-z)} – e^{-(Y + z)}) \\
& = e^{-(Y – z)} + e^{-(Y + z)} \\
\end{align}

The problems/questions that I have are

  1. I'm not sure if this approach is even correct. I'm sure that I have to find the CDF first then differentiate it, but is this the correct way?

  2. How do I handle the $Y$ in the final equations?

Thank you.

Best Answer

Sadly, your answer cannot be correct because the random variable $Y$ remains in your CDF and PDF. The CDF of $Z$ should be only a function of $z$ and the parameters.

Your initial approach is sound, however. Let's see how to complete it.

$$\Pr[Z \le z] = \Pr[X \le Y + z] - \Pr[X \le Y - z]$$ is correct. Now, let's see how to attack each term on the right. We have $$\Pr[X \le Y + z] = \int_{y=0}^\infty \Pr[X \le y + z] f_Y(y) \, dy,$$ by the law of total probability. This in turn yields $$\Pr[X \le Y + z] = \int_{y=0}^\infty (1 - e^{-(y+z)}) e^{-y} \, dy = 1 - e^{-z}/2.$$ Similarly, $$\Pr[X \le Y - z] = \int_{y=0}^\infty \Pr[X \le y - z]f_Y(y) \, dy.$$ However, you must be careful here. Whereas in the first case we had no issues with $y + z < 0$, since $y$ and $z$ must both be nonnegative, in this situation we could have $0 \le y < z$, in which case $\Pr[X \le y-z] = 0$, because $X$ cannot be negative. Consequently, we can write this as $$\Pr[X \le Y - z] = \int_{y=z}^\infty \Pr[X \le y-z] f_Y(y) \, dy,$$ noting that the lower limit of integration can begin at $y = z$, since on the interval $y \in [0,z)$, the integrand is zero.

I have left the remaining calculations as an exercise. What is your result? Is it surprising? If so, how might you go about verifying it?