Expected value of absolute difference of two random variables

303 Views Asked by At

I am trying to walk through the following problem, which has been discussed in this thread: Expectation of absolute difference of two uniform random variables

The problem is as follows:

Let ∼(0,1) and ∼(0,2) be independent random variables. Find [|−|]

The answer in the responses states that:

$$(|−|)=∫_0^2∫_0^1\frac{|x-y|}{2}=\frac{2}{3}.$$

In the comments below this answer, the following formula is provided to solve the above integral: $$∫_0^1|−|=∫_0^y(−)+∫_^1(−)$$

However, when I try to solve the above integral using this formula, I get a different answer. Here is my work:

$$∫_0^2∫_0^1\frac{|x-y|}{2}$$ $$=\frac{1}{2}∫_0^2∫_0^1|x-y|$$ $$=\frac{1}{2}∫_0^2(∫_0^y(−)+∫_^1(−))$$ $$=\frac{1}{2}∫_0^2(yx-\frac{x^2}{2})\Big|_0^y + (\frac{x^2}{2}-xy)\Big|_y^1$$ $$=\frac{1}{2}∫_0^2((y^2-\frac{y^2}{2}) - (y\cdot0 - \frac{0^2}{2}) + ((\frac{1^2}{2}-1\cdot y) - (\frac{y^2}{2} - y^2)$$ $$=\frac{1}{2}∫_0^2((\frac{y^2}{2}) + (\frac{1}{2} - y) + \frac{y^2}{2}$$ $$=\frac{1}{2}∫_0^2(y^2 - y + \frac{1}{2})$$ $$=\frac{1}{2}(\frac{y^3}{3} - \frac{y^2}{2} + \frac{y}{2})\Big|_0^2$$ $$=\frac{1}{2}(\frac{8}{3} - \frac{4}{2} + \frac{1}{2} - (0 - 0 + 0))$$ $$=\frac{1}{2} \cdot \frac{5}{3}$$ $$=\frac{5}{6}$$

Is there something wrong with my math here? Or is the formula from the comment I'm using to solve this incorrect? If so, what is the correct formula?

1

There are 1 best solutions below

2
On BEST ANSWER

The comment you linked suggests that the formula for the integral of the absolute difference is valid when $y$ is in the range $(0,1)$, which is indeed the case. For $y > 1$ it no longer holds. So in order to apply this formula to solve the double integral you should first split the $y$-integration into two integrals, one from $0$ to $1$ and one from $1$ to $2$.

For the second integral notice that when $y>1$ and $x\in (0,1)$ you always have $|x-y| = y-x$. I'll leave the details for you to fill out.