The random variables $X$ and $Y$ have the joint density $$f_{X,Y}(x,y)= \left\{\begin{matrix}e^{-y}, \mbox{ } 0\leq x \leq y \le \infty \\ 0, \mbox{ otherwise}\end{matrix}\right.$$ Evaluate the conditional expectation $E[X|y]$.
I'm not sure if I'm doing this correctly. Please let me know if something is off in my solution. Thanks for reading.
My solution:
I'm not sure if my approach is correct since $f_{Y}(y)$ turns out to be an infinite number. Also in line 4, is the domain correct?
$$E[X|y] = \int_{-\infty}^{\infty}xf_{X|Y}(x|y)dx.$$
$$f_{X|Y}(x|y) = \frac{f_{X,Y}(x,y)}{f_{Y}(y)}.$$
$$f_{Y}(y) = \int_{-\infty}^{\infty}f_{X,Y}(x,y)dx$$
$$= \int_{0}^{\infty}e^{-y}dx = e^{-y}\int_{0}^{\infty}1dx $$
$$=e^{-y}\left [ x \right]\Big|_0^\infty $$
$$ = ??? $$
Thanks in advance for reading this and responding!
I suggest rewriting the joint density using the indicator function $\mathbf1_{a\in A}$, which equals $1$ if $a\in A$ and equals $0$ otherwise.
So you have
\begin{align} f_{X,Y}(x,y)=e^{-y}\mathbf1_{0<x<y}&=\begin{cases}\frac{1}{y}\mathbf1_{0<x<y}\,ye^{-y}\mathbf1_{y>0} \\\\e^{-(y-x)}\mathbf1_{y>x}\,e^{-x}\mathbf1_{x>0}\end{cases} \end{align}
We have expressed the joint density in two different ways, in each case $f_{X,Y}$ factors as the product of a conditional density and a marginal density.
From the first case, $$f_{X\mid Y=y}(x)=\frac{1}{y}\mathbf1_{0<x<y}$$
And from the second case, $$f_{Y\mid X=x}(y)=e^{-(y-x)}\mathbf1_{y>x}$$
At this point you can calculate the conditional means simply from definition. Or you might identify $X\mid Y$ as having a uniform distribution over $(0,Y)$ and $Y\mid X$ as having a shifted exponential distribution (i.e. $[Y\mid X]-X$ has an exponential distribution with mean $1$), from which the expectations follow easily.