Q:

How to write $E(Y|X)$ as a function of $X$? 

How to write $E(Y|X)$ as a function of $X$ ? 
If for example $X$ and $Y$ are discrete valued as below 

then $E(Y|X)$ should be equal to $-1+2X^2$ but I don't get it.  
If I write for example $\displaystyle E(Y|X=-1)=\sum_y y\Pr(Y=y|X=-1)=\sum_y y\frac{\Pr(Y=y,X=-1)}{\Pr(X=-1)}=-1\cdot \frac{\Pr(Y=-1,X=-1)}{\Pr(X=-1)}+1\cdot \frac{\Pr(Y=1,X=-1)}{\Pr(X=-1)}=0\neq1=-1+2(-1)^2$
what goes wrong ? 

A:

Your formula is correct, but I believe you plugged in the wrong probabilities.  The last part should look as follows $\space-1\cdot \frac{\Pr(Y=-1,X=-1)}{\Pr(X=-1)}+1\cdot \frac{\Pr(Y=1,X=-1)}{\Pr(X=-1)}=-1\cdot \frac{0}{\frac14}+1\cdot \frac{\frac14}{\frac14}=1=-1+2(-1)^2$.

