# Covariance of conditional expectation is “orthogonal”

I'm trying to prove some basic Covariance relationships, specifically this: $$\operatorname{cov}(E(Y\mid X),Y-E(Y\mid X))=0$$ I managed to show that: $$\operatorname{cov}(E(Y\mid X),Y-E(Y\mid X))=E\left[Y\cdot E(Y\mid X)-(E(Y\mid X))^2\right]$$ but I don't know what to do now. The main theorem that I'm using for this is the law of iterated expectations: $$E\left(E\left(X\mid Y\right)\right)=E(X)$$ and I don't know how to apply it in this situation. Can anyone give me some hints or ideas?

Thanks for helping!!! :D

What you have to use is: $$E(Y\cdot E(Y\mid X))=E\left(E(Y\cdot E(Y\mid X)\mid X))\right)=E(E(Y\mid X)E(Y\mid X)) =E((E(Y\mid X))^2)$$ where the first equality is given by the law of iterated expectations, and the second by noticing that $E(Y\mid X)$ is already a function of $X$.