This is problem 6.9 in Ross.
I have the joint pdf $$f(x,y) = 6/7(x^2+xy/2), 0<x<1, 0<y<2$$ marginal pdf $f(x) = (6/7)x(2x+1)$ conditional pdf $$f(y|x) = f(x,y)/f(x) = (x+y/2)/(2x+1)$$ conditional expectation $$E(y|x) = (3x+16)/(6(2x+1))$$
Then my professor has $$E(xy) = E(xE(y|x)) = \int_0^1 E(y|x) f(x) dx$$
This is the part I don't understand. I thought $E(xE(y|x))$ would be $$\int_0^1 xE(y|x)dx$$ but instead of the $x$, she has $f(x)$.
However, in another example I have $$ E(Y|X) = \frac 12 x. $$
Then my professor has $$ E(XE(Y|X)) = E(\frac 12 x^2) $$ I don't understand why in one case you multiply by $x$ and in the other by $f(x)$