0
$\begingroup$

Let $X, Y$ be independent random variables exponentially distributed with parameter 1. Find the $E(|X-Y|)$.

My approach :

Let $Z = X - Y $. Then, the goal is to find $E(|Z|) = \int_{-\infty}^{\infty}{|z|f_Z(z)dz}$. So, in order to find the density for $Z$, I use a convolution method:

$$ F_Z(z) = P(Z \leq z) = P(X - Y \leq z) = \iint_{X-Y \leq z}{f_X(x)f_Y(y)dxdy} = \int_{-\infty}^{\infty}\int_{-\infty}^{z+y}{f_X(x)f_Y(y)dxdy} = \int_{-\infty}^{\infty}F_X(z+y)f_Y(y)dy$$

Now, differentiating with respect to z, we can get the density of z.

$$ \frac{d}{dz}\left(F_Z(z)\right) = f_Z(z) = \int_{-\infty}^{\infty}{f_X(z+y)f_Y(y)dy} $$

Since X, Y are $\sim Exp(1)$, their densities are known and the integral simplifies to:

$$ f_Z(z) = \int_{0}^{\infty}{e^{-z}e^{-2y}dy} = -\frac{1}{2}e^{-z} $$

Then, the expectation value is:

$$ E(|Z|) = \int_{-\infty}^{\infty}{-\frac{1}{2}|z|e^{-z}dz} = \int_{-\infty}^{0}{\frac{1}{2}ze^{-z}dz} + \int_{0}^{\infty}{-\frac{1}{2}ze^{-z}dz} $$

I thought that this was correct, but I am confused on the bounds of Z since evaluating this integral from $-\infty$ makes the expression divergent.

Is it the case that since $z \geq 0$, then the integral for the expectation value simplifies to:

$$ E(|Z|) = \int_{-\infty}^{\infty}{-\frac{1}{2}|z|e^{-z}dz} = \int_{0}^{\infty}{-\frac{1}{2}ze^{-z}dz} $$ ?

$\endgroup$
1
  • $\begingroup$ If you are asked to find $\mathbb Ef(X,Y)$ or $\mathbb E|f(X,Y)|$ then in most cases it is not handsome to go for finding the distribution of $Z=f(X,Y)$. A calculation based directly on the distribution of $(X,Y)$ is mostly easyer and less error prone. $\endgroup$
    – drhab
    Commented Apr 8, 2020 at 13:46

3 Answers 3

2
$\begingroup$

The issue is in your computation of $f_z$, as you do not write the indicator functions: the density of $Y$ is not $e^{-y} \: \mathrm{d} y$, but $e^{-y} 1_{\{y > 0\}} \: \mathrm{d} y$. Therefore, your integral becomes, \begin{align*} F_z(z) & = \int_{- \infty}^{+\infty} f_X(z+y) f_Y(y) \: \mathrm{d} y \\ & = \int_{- \infty}^{+\infty} e^{-(z+y)} 1_{\{z+y>0\}} e^{-y} 1_{\{y>0\}} \: \mathrm{d} y \\ & = e^{-z} \int_{- \infty}^{+\infty} e^{-2y} 1_{\{y>-z\}} 1_{\{y>0\}} \: \mathrm{d} y. \end{align*} If $z \geq 0$ then the integral is $$ \int_0^{+\infty} e^{-2y} \: \mathrm{d} y = \frac12, $$ (you made a sign mistake here, btw), while if $z < 0$, it is $$ \int_{-z}^{+\infty} e^{-2y} \: \mathrm{d} y = \frac12 e^{2z}. $$ Finally, the density of $Z$ is $$ f_z(z) = \frac12 \left ( e^{-z} 1_{\{z \geq 0\}} + e^{z} 1_{\{z < 0\}} \right) $$ Then, you readily get that $$ \mathbb{E}(Z) = \frac12+\frac12 = 1. $$

$\endgroup$
3
  • $\begingroup$ I see, I have a follow up question about the final step. Why isn't the indicator function for $z < 0$ equal to 0. If $z$ cannot be less than $0$, then shouldn't the second part of the density of $z$ be zero? $\endgroup$
    – Eoin S
    Commented Apr 8, 2020 at 13:48
  • 1
    $\begingroup$ Why couldn't $z$ be negative? You have $Z = X - Y$, so it can take any real value. $\endgroup$
    – Raoul
    Commented Apr 8, 2020 at 14:08
  • 1
    $\begingroup$ Ahh, my mistake, you are correct. Thank you for the great explanation. $\endgroup$
    – Eoin S
    Commented Apr 8, 2020 at 14:22
1
$\begingroup$

We use the first given formula, so $$ \begin{aligned} \Bbb E[Z] &= \Bbb E[\ |X-Y|\ ] \\ &= \iint_{(0,\infty)^2}|x-y|\; e^{-x}\; dx\; e^{-y}\; dy \\ &= \iint_{\substack{(x,y)\in (0,\infty)^2\\x\le y}}|x-y|\; e^{-x}\; dx\; e^{-y}\; dy \\ &\qquad + \iint_{\substack{(x,y)\in (0,\infty)^2\\y\le x}}|x-y|\; e^{-x}\; dx\; e^{-y}\; dy \\ &= 2\iint_{\substack{(x,y)\in (0,\infty)^2\\x\le y}}|x-y|\; e^{-x}\; dx\; e^{-y}\; dy \\ &= 2 \int_0^\infty e^{-x}\; dx \underbrace{\int_x^\infty (y-x)\; e^{-(y-x)}\; e^{-x}\; dy}_{e^{-x}} \\ &= 2 \int_0^\infty e^{-2x}\; dx \\ &=2\cdot\frac 12=1\ . \end{aligned} $$

$\endgroup$
1
$\begingroup$

Your mistake has been pointed out in the other answers.

Here I give you an alternative calculation:

In general $\left|x-y\right|=\max\left(x,y\right)-\min\left(x,y\right)$ so that:

$$\begin{aligned}\mathbb{E}\left|X-Y\right| & =\mathbb{E}\max\left(X,Y\right)-\mathbb{E}\min\left(X,Y\right)\\ & =\int_{0}^{\infty}P\left(\max\left(X,Y\right)>z\right)dz-\int_{0}^{\infty}P\left(\min\left(X,Y\right)>z\right)dz\\ & =\int_{0}^{\infty}P\left(X>z\vee Y>z\right)dz-\int_{0}^{\infty}P\left(X>z\wedge Y>z\right)dz\\ & =\int_{0}^{\infty}P\left(X>z\right)+P\left(Y>z\right)-2P\left(X>z\right)P\left(Y>z\right)dz\\ & =\int_{0}^{\infty}2e^{-z}-2e^{-2z}dz\\ & =\left[-2e^{-z}+e^{-2z}\right]_{0}^{\infty}\\ & =1 \end{aligned} $$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .