Suppose that the joint density for two random variables is given by
$$ f(x,y) = \frac{e^{-\frac{x}{y}} e^{-y}}{y} $$ where $x,y \in (0, \infty)^2$.
Find the $E(X|Y=y),~$ $\forall y > 0$.
My solution:
I would like to find it using the conditional density so I started as $E(X|Y=y) = \int_0^{\infty} y~ f_{X|Y=y}(x,y)dy$
Then, I found the conditional density $f_{X|Y}(x | y)$ for $X$ given that $Y = y,~ \forall y > 0$.
Using the definition, $f_{X|Y}(x | y) = \frac{f_{X,Y}(x,y)}{f_Y(y)}$.
First to find the marginal of $Y$ from the joint as $$f_Y(y)= \int_0^{\infty} \frac{e^{-\frac{x}{y}} e^{-y}}{y} dx = e^{-y}. $$
Following, $$f_{X|Y}(x | y) = \frac{f_{X,Y}(x,y)}{f_Y(y)} = \frac{\frac{e^{-\frac{x}{y}} e^{-y}}{y}}{e^{-y}} = \frac{e^{-\frac{x}{y}} }{y}$$
Finally, $E(X|Y=y) = \int_0^{\infty} y~ f_{X|Y=y}(x,y)dy = \int_0^{\infty} y \frac{e^{-\frac{x}{y}} }{y} dy $
but the integral doesn't converge. What is wrong in my solution?
EDIT: I think I did a mistake here $E(X|Y=y) = \int_0^{\infty} y~ f_{X|Y=y}(x,y)dy$ and the it should be as $E(X|Y=y) = \int_0^{\infty} x~ f_{X|Y=y}(x,y)dx = \int_0^{\infty} x \frac{e^{-\frac{x}{y}} }{y} dx = y$
Is this true? Also what is the difference between $E(X/Y)$ and $E(X/Y=y)$ or $f_{X,Y}(x,y)$ and $f_{X,Y=y}(x,y)$ ? thanks for help
$E(X|Y=y)=\frac{\int_{0}^{\infty}{xf(x,y)}dx}{\int_{0}^{\infty}{f(x,y)}dx}$
$E(X|Y=y)=\frac{\frac{e^{-y}}{y}\int_{0}^{\infty}{xe^{-\frac{x}{y}}dx}}{\frac{e^{-y}}{y}\int_{0}^{\infty}{e^{-\frac{x}{y}}}dx}$
$E(X|Y=y)=\frac{\int_{0}^{\infty}{xe^{-\frac{x}{y}}dx}}{\int_{0}^{\infty}{e^{-\frac{x}{y}}}dx}$
$E(X|Y=y)=\frac{-y(\int_{x=0}^{x=\infty}{x}d{e^{-\frac{x}{y}}})}{\int_{0}^{\infty}{e^{-\frac{x}{y}}}dx}$
$E(X|Y=y)=\frac{-y([xe^{-\frac{x}{y}}]_{x=0}^{x=\infty}-\int_{0}^{\infty}{e^{-\frac{x}{y}}}dx)}{\int_{0}^{\infty}{e^{-\frac{x}{y}}}dx}$
$E(X|Y=y)=y\frac{\int_{0}^{\infty}{e^{-\frac{x}{y}}}dx}{\int_{0}^{\infty}{e^{-\frac{x}{y}}}dx}$
$E(X|Y=y)=y$