Given an absolutely continuous random variable $(X,Y)$ with piecewise continuous density function $f(x,y)$, my goal is to show that
$E[g(X) | Y] = \frac{\int_{-\infty}^\infty g(x) f(x,Y) dx}{\int_{-\infty}^\infty f(x,Y) dx}$
for all non negative measurable functions $g: R \rightarrow R$.
Intuitively this expression makes sense, and it is very similar to when we condition on a singular event. I know that $E[g(X)] = \int^\infty_{-\infty} g(x) \int^\infty_{-\infty} f(x,y) dy dx$, and that replacing the random variable $Y$ with the event $Y = y$ yields the right hand side but with $y$ in place of $Y$. Is there a way to go from the case where we condition on events to conditioning on the random variable (or rather, the $\sigma$-algebra)?
If that is not the way to go about this, I suspect is some conditional expectation trickery which must be employed. Using the equality $E[g(x)] = E[E[g(x)|Y]]$ gets us nowhere though, and I can't think of another way to come up with an expression with a "given Y" in it.
Any suggestions would be appreciated.
Since the right side is measurable w.r.t. $\sigma (Y)$ what you have to show is $\int_{Y \leq y} g(X)dP= \int_{Y\leq y}\frac{\int_{-\infty}^\infty g(x) f(x,Y) dx}{\int_{-\infty}^\infty f(x,Y) dx}dP$ for all $y$.
The left side of this equation is $$\int_{-\infty}^{y} \int_{-\infty} ^{\infty}g(x) f(x,y) dxdy$$ and the right side is $$\int_{-\infty}^{y}\frac{\int_{-\infty}^\infty g(x) f(x,y) dx}{\int_{-\infty}^\infty f(x,y)dx} f_Y(y)dy.$$ Since $\int_{-\infty}^\infty f(x,y)dx=f_Y(y)$ we see that the two sides are equal.