why is epsilon uncorrelated with any function h(X) Im currently reading mostly harmless econometrics. The three relevant pages are here: http://econ.lse.ac.uk/staff/spischke/mhe/ex_ch3.pdf
My issue is the following. They claim that epsilon is uncorrelated with any function of $h(X)$ in theorem 3.1.1 and later they claim that it is uncorrelated with $E(Y | X)$ in theorem 3.1.3. So far I always thought that its just an assumption that epsilon is uncorrelated with $X$ in a data analysis. How am I to understand their proof?
 A: by conditional expectation:
$$E(h(X)\varepsilon) = E(h(X) E(\varepsilon|X)) = E(h(X)0) = 0,$$
i.e. $h(X)$ and $\varepsilon$ are uncorrelated.

To shed some light on the first part of the theorem in the satement, note that one can always write $Y=E(Y|X) + \varepsilon$, where $\varepsilon = Y-E(Y|X)$ yielding  $E(\varepsilon|X)=0$, since $$E(Y|X) = E(Y|X) + E(\varepsilon|X) \quad \Rightarrow \quad E(\varepsilon|X)=0.$$

However, this is pretty boring since it doesn't give you any helpful information about the relationship of $Y$ and $X$. In order to model the relationship you will assume $Y=g(X) + \varepsilon$ for some specific $g(X)$. For this specific model to be meaningful (as in $g(X) = E(Y|X)$) you then need to assume $E(\varepsilon|X)=0$:
For a model of the form $Y=g(X)+\varepsilon$ we have $$E(\varepsilon|X) = 0  \Leftrightarrow g(X)=E(Y|X).$$ 
Indeed, If $E(\varepsilon|X)=0$ then $$E(Y|X)=E(g(X)|X)+E(\varepsilon|X)= g(X).$$
On the other hand, if $g(X)=E(Y|X)$ then  $Y=E(Y|X) + \varepsilon$ and we have $$E(Y|X) = E(Y|X) + E(\varepsilon|X) \quad \Rightarrow \quad E(\varepsilon|X)=0.$$
