PDF of |X-Y| where X,Y ~ exp($\lambda$)

1.2k Views Asked by At

I need to find the PDF of $Z=|Y-X|$ given that $X,Y\sim exp(\lambda)$ and both independent.

What I did (I want to use the CDF and not convolutions):

$f_{X,Y}(x,y)=\cases{\lambda^2 e^{-\lambda(x+y)} & if $x,y \ge 0$\cr 0 & otherwise\cr}$

$F_{Z}(z)=P(-z \le Y-X \le z)=P(-z + X \le Y \le z + X)$

I chose $z$ as a fixed point, which results in this picture :

enter image description here $$ $$ So we're interested in set $E$ which collects all the sandwiched points, we need to integrate capturing them. What I claim is that $y \in [-z+x,z+x]$ and $x \in [0, \infty)$ $$F_{Z}(z) = \int\int_{E}f_{X,Y}(x,y)dydx=\int_{0}^{\infty}\int_{-z+x}^{z+x}f_{X,Y}(x,y)dydx$$

The result I got is a wrong one : $F_{Z}(z)=-\frac{1}{2}(e^{\lambda z}-e^{-\lambda z})$

Question : Are my intervals for $x,y$ false ?

Expected result : $f_{Z}(z) = \lambda e^{-\lambda z}$

2

There are 2 best solutions below

8
On BEST ANSWER

Note that $f(x,y)=0$ for some of your integration region.

\begin{align} F_Z(z) &= \int_0^z \int_0^{z+x}f_{X,Y}(x,y) \, \, dydx + \int_z^\infty \int_{-z+x}^{z+x}f_{X,Y}(x,y) \, \, dydx \\ &= \int_0^z \int_0^{z+x}\lambda^2\exp(-\lambda(x+y)) \, \, dydx + \int_z^\infty \int_{-z+x}^{z+x}\lambda^2\exp(-\lambda(x+y)) \, \, dydx \\ \end{align}

0
On

The density function of $X$ is $\lambda e^{-\lambda x}$ (for $x \ge 0$), and $0$ elsewhere. There is a similar expression for the density function of $Y$. By independence, the joint density function of $X$ and $Y$ is $$\lambda^2 e^{-\lambda (x+y)}$$ in the first quadrant, and $0$ elsewhere.

Let $Z=|Y-X|$. Let us first attack the problem of Z = Y-X and then the Z = X-Y will be the same result as X and Y are both exponentially ditributed with same $\lambda$. We want to find the density function of $Z$. First we will find the cumulative distribution function $F_Z(z)$ of $Z$, that is, the probability that $Z\le z$.

Consider $z$ fixed and positive, and draw the line $y-x=z$. We want to find the probability that the ordered pair $(X,Y)$ ends up below that line or on it. The only relevant region is in the first quadrant. So let $D$ be the part of the first quadrant that lies below or on the line $y=x+z$. Then $$P(Z \le z)=\iint_D \lambda^2e^{-\lambda (x+y)}dx\,dy.$$

We will evaluate this integral, by using an iterated integral. First we will integrate with respect to $y$, and then with respect to $x$. Note that $y$ travels from $0$ to $x+z$, and then $x$ travels from $0$ to infinity. Thus $$P(Z\le x)=\int_0^\infty \lambda e^{-\lambda x}\left(\int_{y=0}^{x+z} \lambda e^{-\lambda y}\,dy\right)dx.$$

The inner integral turns out to be $1-e^{-\lambda(x+z)}$. So now we need to find $$\int_0^\infty \left(\lambda e^{-\lambda x}-\lambda e^{-\lambda z} e^{-(2\lambda)x}\right)dx.$$ We end up with $$P(Z \le z)=1-\frac{1}{2}e^{-\lambda z}.$$

for $|Z| = |X-Y|$

Then $P(|Z|<z) = P(Z\lt z) - P(Z\lt -z) = P(Y-X \lt z) - P(-Z\gt z)\tag 1$

$ = P(Y-X\lt z) - P(X-Y\gt z) $

But $P(X-Y\gt z) = 1- P(X-Y\lt z) $

Again $P(X-Y\lt z) = 1-\frac{1}{2}e^{-\lambda z}$

Hence $P(X-Y\gt z) = 1-1+\frac{1}{2}e^{-\lambda z} = \frac{1}{2}e^{-\lambda z}$

Going back to the $(1)$

$P(|Z|<z) = 1-\frac{1}{2}e^{-\lambda z}-\frac{1}{2}e^{-\lambda z} = 1-e^{-\lambda z}$

In other words,

$P(-z\lt Z \lt z) = 2P(Z\lt z)-1$

$P(|Z|\le z) = 2 -e^{-\lambda z}-1 = 1-e^{-\lambda z}$ For the density function $f_{|Z|}(z)$ of $|Z|$, differentiate the cumulative distribution function. We get $$f_{|Z|}(z)=\lambda e^{-\lambda z} \quad\text{for $z \ge 0$.}$$ which is nothing but $Expo(\lambda)$