Given $(X,Y)$, 2-dimensional probability vector, and let $g: R^2 \rightarrow R, E[g(X,Y)^2 ] < \infty$ and $h:R \rightarrow R, E[h(X)^2] < \infty $, prove the following:
$$E[h(X)\{g(X,Y)-E[g(X,Y)|X]\}]=0$$
This is what I have done so far
$E[h(X){g(X,Y)]-E[h(x) E[g(X,Y)|X]}]=0$,
Then we have to show
$E[h(X){g(X,Y)]=E[h(x) E[g(X,Y)|X]}]$
On the right-hand side, $E[h(x)E[g(X,Y)|X]]=E[h(x)]E[E[g(X,Y)|X]]=E[h(X)]E[g(X,Y)]$ by the iteration of expectation
On the left-hand side,
$E[h(X)g(X,Y)]$ to be equal to $E[h(X)]E[g(X,Y)], \phantom 2 h(X), g(X,Y)$ have to be independent from each other but is it? How should I do this?