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

conditional-expectationexpected valueprobability

Consider the following joint density function $$f_{X,Y}(x,y)=e^{-y}$$ if $0<x<y$ and 0 in other case.

If I want to find the following expectation $$E[X+Y|Y-X]$$

How do I calculate?
My attempt is correct?

I know that by definition $$E[X |Y]=\int x f_{X|Y}(x,Y)dx$$

So if I make the following variable change (Is allowed?)

$U=X+Y$ and $V=Y-X$ then the expectation only would be $E[U|V]$ And by above definition I need to find the conditional of U given V. To do this, I try to apply the following equation $$f_{U,V}(u,v)=f_{X,Y}(x=\frac{u-v}{2},v=\frac{u+v}{2})|J|$$

Where the Jacobian is
\begin{vmatrix}
\frac{\partial x}{\partial u} & \frac{\partial x}{\partial v}\\
\frac{\partial y}{\partial u} & \frac{\partial y}{\partial v}
\end{vmatrix}

and that is $\frac{1}{2}$

So the function with new variables is $f_{U,V}(u,v)=\frac{1}{2}e^{\frac{-u-v}{2}}$

So, now we can find the conditional,

$f_{U|V}=\frac{f_{U,V}(u,v)}{f_{V}(v)}$

where $f_{V}(v)=\int_{0}^{\infty} f_{U,V}(u,v)du = \int_{0}^{\infty}\frac{1}{2}e^{\frac{-u-v}{2}}du = \frac{1}{2}e^{-\frac{v}{2}}(2e^{\frac{-0}{2}})$

Is from 0 to $\infty$ because $0<U=x+y$ (is there something wrong here? Somebody told me that in this step there is an error but I don't know)

Finally $$f_{U|V}=\frac{1}{2}e^{-u/2}$$
So $$E[U|V]=\int_{0}^{\infty} u\frac{1}{2}e^{-u/2}du =\frac{1}{2}(0+2(0)e^{-\frac{0}{2}}+4e^{\frac{-0}{2}})=2$$

Please, if I do something wrong or all is wrong and there's another path to get the correct answer let me know please. Technically although I am in a course of probability, I am teaching to myself.

Best Answer

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}

Related Question