0

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}$

Oleg
  • 499

2 Answers2

2

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)$

1

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}

Siong Thye Goh
  • 149,520
  • 20
  • 88
  • 149
  • the first line with integrals would've been enough :), could you please explain when f(x,y) = 0 ? x and y are allowed to be only positive , right ? – Oleg Sep 19 '18 at 10:11
  • when at least one of them is not positive, the correponding density is $0$. Hence there is no point integrating over those places. If we integrate using $\lambda^2 \exp(-\lambda (x+y))$ over those region, then we are integrating its upper bound and we will get a higher value for the CDF there. – Siong Thye Goh Sep 19 '18 at 10:15
  • could you provide a small example ? say z = -100, x = 10 and y then will be negative ? but z can't be negatve – Oleg Sep 19 '18 at 10:19
  • we should only consider $z$ that are positive, otherwise, the CDF and pdf are $0$ at those points. – Siong Thye Goh Sep 19 '18 at 10:25
  • yes, exactly, so why do you say that f(x,y) = 0 for some of my integration region ? if I can get this one, then question is solved :) I'll be able then to understand why you split up your integration in such a way. – Oleg Sep 19 '18 at 10:27
  • I do not know what is your next step after you write down the region of integration. Did you replace $f_{X,Y}(x,y)$ by $\lambda^2 \exp(-\lambda (x+y))$? – Siong Thye Goh Sep 19 '18 at 10:33
  • yes , of course, but again I'm just trying to understand why did you split your integral over those regions (unlike me, I only took $y$ to be between $-z+x$ and $z+x$) – Oleg Sep 19 '18 at 10:37