Let X be Uniform Random Variable on [0,1]. Y is Uniform Random Variable on [0,2]. Given that X and Y are independent, calculate E[|X-Y|].
I have tried calculating the answer using two different methods - both of which I think are correct approaches - but each produces differing results of 2/3 and 3/4.
Method 1) $$\int_{0}^2\int_{0}^1 (|x-y|/2)dxdy$$ I plug the following into Wolfram Alpha and get 2/3: Wolfram calculation
I'm pretty sure this a correct way of going about getting the expected value, since in general for independent x and y, E[g(x,y)] = $$\int_{a}^b\int_{c}^d g(x,y)f(x)f(y)dxdy$$ where of course f(x) and f(y) are the respective distributions of random variables X and Y, and in this particular instance is (1/2)*(1) = (1/2).
Method 2) E[X-Y|X>Y] + E[Y-X|Y>X]. This method yields me 3/4 when I calculate it. The first integral is $$\int_{0}^1\int_{0}^x (.5(x-y))dydx$$ This equals 1/12. The second integral is $$\int_{0}^2\int_{0}^y (.5(y-x))dxdy$$ This equals 2/3. (2/3) + (1/12) = (3/4).
I'm also fairly certain this is a correct procedure, since there are 3 cases: X>Y, X=Y, and X<Y. X=Y will always produce |X-Y|=0. If X>Y, then |X-Y| = X-Y. If X<Y, then |X-Y| = Y-X. Summing the expectations should yield me a correct result.
Which answer is correct (or neither)? Have I made a careless computational blunder in one of the methods? Or is one of the methods I used a fundamentally incorrect approach to solving the given problem?
EDIT: So, Method 2 is full of errors on my part, which can be noted in the comment section. While I'm certain the correct answer is 2/3, I have found a line of reasoning that yields 3/4 using conditional expectation that I am not able to disprove.
E[|X-Y|] = Pr(Y>1)(E[Y-X|Y>1]) + Pr(X>Y)(E[X-Y|X>Y]) + Pr(Y>X And 0<Y<1)*(E[Y-X|Y>X And 0<Y<1])
Pr(Y>1) = 1/2
Pr(X>Y) = 1/4
Pr(Y>X and 0<Y<1) = 1/4
E[Y-X|Y>1] = 1 (this is intuitive if you think about the symmetry)
E[Y-X|Y>X And 0<Y<1] = E[X-Y|X>Y] (once again intuitive by symmetry)
Now, by linearity of expectation, E[X|X>Y] - E[Y|X>Y] = E[X-Y|X>Y] = 0.5. Given what we know about Y, it is fair to treat Y as uniform on [0,1] in this instance. Therefore, if we expect X to be 0.5, then Y is uniform on [0,0.5], giving expectation of 0.25. The same logic applies in reverse to give us E[X|X>Y] = 0.75. You can see integral proof here: OSU Conditional Expectation Slides.
Finally, summing it all up, (1/2)(1) + (1/4)(1/2) + (1/4)*(1/2) = 3/4.
Can anyone see where I went wrong with my logic on the conditional expectation? In general, when you apply the above procedure, I think what is being spit back is actually the average of the means of X and Y. However, I'm unsure where the logic is breaking down.