Assume $X$ and $Y$ are jointly continuous random variables and $g$ is a linear combination of them. I am confused about the applicability of the two approaches I met to compute $E[g(X,Y)|Y=y]$. The first is to make use of $f_{X|Y}$ (the conditional pdf), and the second is to directly compute $E[g(X,y)]$.
Could anyone explain when can I use the first method and when can I use the second? My current thought is that we can always use the first one but can only use the second one if $X$ and $Y$ are independent. Is that correct? How to verify that if so?
Any answers or comments would be appreciated.