Conditional expectation of $X+Y$ given $Y-X$

Solution 1:

Your approach was headed in the right direction, as others have pointed out. The key is to keep track of the support of the distributions. In this regard, it helps to use indicator functions or something similar while writing densities.

Here's another way of looking at the problem:

Observe that joint density of $(X,Y)$ can be factored as

$$f_{X,Y}(x,y)=e^{-y}\mathbf1_{0<x<y}=\underbrace{e^{-(y-x)}\mathbf1_{y>x}}_{f_{Y\mid X}(y\mid x)}\cdot \underbrace{e^{-x}\mathbf1_{x>0}}_{f_X(x)}$$

From the conditional density $f_{Y\mid X}(y\mid x)$, it is clear that $Y-x$ given $X=x$ has a standard exponential distribution. As this conditional distribution is free of $x$, the (unconditional) distribution of $Y-X$ is also standard exponential. In other words, $Y-X$ and $X$ are independent and identically distributed.

Therefore, $$E\left[X+Y\mid Y-X\right]=E\left[X\mid Y-X\right]+E\left[Y\mid Y-X\right]=E\left[X\right]+E\left[Y\mid Y-X\right]$$

So only need to find the conditional distribution of $Y$ given $Y-X$.

For the transformation $(x,y)\mapsto (y,y-x)=(u,v)$, the absolute value of jacobian is unity. Hence the joint density of $(Y,Y-X)$ is

$$f_{Y,Y-X}(u,v)=f_{X,Y}(u-v,u)=e^{-u}\mathbf1_{0<u-v<u}$$

So that conditional density of $Y$ given $Y-X$ is

$$f_{Y\mid Y-X}(u\mid v)=\frac{f_{Y,Y-X}(u,v)}{f_{Y-X}(v)}=\frac{e^{-u}\mathbf1_{0<u-v<u}}{e^{-v}\mathbf1_{v>0}}=e^{-(u-v)}\mathbf1_{u>v>0}$$

This is a shifted exponential distribution with shift $v$, so that for every $v>0$, $$E\left[Y\mid Y-X=v \right]=1+v$$

Finally, $$E\left[X+Y\mid Y-X\right]=2+Y-X \quad,\text{ a.e. }$$


Edit:

Actually a clever manipulation uses the independence of $Y-X$ and $X$ to good effect. Thanks to @r.e.s for spotting this:

\begin{align} E\left[X+Y\mid Y-X\right]&=E\left[2X+Y-X\mid Y-X \right] \\&=2E\left[X \mid Y-X\right]+E\left[Y-X\mid Y-X\right] \\&=2E\left[X\right]+Y-X \\&=2+Y-X \end{align}

Solution 2:

If $U = Y + X, V = Y - X ~$ and $y \gt x \gt 0$,

we have $0 \lt v \lt \infty$ and $v \lt u \lt \infty$

So, $ \displaystyle ~f_V(v) = \frac 12\int_v^{\infty} e^{-(u+v)/2} ~ du = e^{-v}$

$ \displaystyle ~E \left[U \mid V = v\right] = \frac 12\int_v^{\infty} u ~e^{(v-u)/2} ~ du = v + 2$