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[Y|x]$.
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:
(My expected value is negative, which I'm pretty sure can never be the case. Also in line 4 and 8, are the domains correct?)
$$E[Y|x] = \int_{-\infty}^{\infty}yf_{Y|X}(y|x)dy.$$
$$f_{Y|X}(y|x) = \frac{f_{X,Y}(x,y)}{f_{X}(x)}.$$
$$f_{X}(x) = \int_{-\infty}^{\infty}f_{X,Y}(x,y)dy$$
$$= \int_{0}^{\infty}e^{-y}dy $$
$$=\left [ -e^{-y} \right]\Big|_0^\infty $$
$$ = -e^{-\infty}-(-e^{0})=1. $$
$$f_{X}(x) = 1, x \geq 0.$$
Thus,
$$E[Y|x] = \int_{0}^{\infty}-ye^{-y}dy$$
$$= -\int_{0}^{\infty}ye^{-y}dy$$
After integration by parts,
$$E[Y|x] = \left [ ye^{-y}+e^{-y} \right]\Big|_0^\infty$$
$$=0-[e^{0} + 0]=-1$$
Therefore, $E[Y|x] = -1.$
Thanks in advance for reading this long problem and responding!
Best Answer
The limits in your fourth line are wrong since you know the joint density is $0$ unless $0\leq x \leq y \le \infty$ so it should be $$f_{X}(x) = \int_{x}^{\infty}e^{-y}dy , \mbox{ } 0\leq x \le \infty $$ leading to $$f_{X}(x)= \left\{\begin{matrix}e^{-x}, \mbox{ } 0\leq x \le \infty \\ 0, \mbox{ otherwise}\end{matrix}\right.$$
That will then give you
$$f_{Y \mid X=x}(y)= \left\{\begin{matrix}\dfrac{e^{-y}}{e^{-x}}, \mbox{ } 0\leq x \leq y \le \infty \\ 0, \mbox{ otherwise}\end{matrix}\right.$$ and $$E[Y \mid X=x]= \int_{x}^{\infty}y\frac{e^{-y}}{e^{-x}}dy = x+1$$
which is an example of the memorylessness property of the exponential distribution