Does $ \mathbb{E}\left[X|Y\right]=\mathbb{E}\left[X\right]\iff X,Y $ are independent? Consider $X,Y$ random variables, I want to know if $$ \mathbb{E}\left[X|Y\right]=\mathbb{E}\left[X\right]\iff X
,Y \space \space independent$$
I know that the direction $ \Leftarrow $ is true. The other direction seem wrong, but I cannot find a counter example.
Any help would be appreciated.
 A: Let's play a game. I flip a coin, $Y$. Then I flip another coin, $Z$. If $Y$ was heads, then I give you two dollars if $Z$ is heads and you give me two dollars if $Z$ is tails. If $Y$ was tails, then I give you one dollar if $Z$ is heads and you give me one dollar if $Z$ is tails.
Let $X$ be the random variable giving your profit. The expectation of $X$ is zero, and knowing the value of $Y$ doesn't change that. On the other hand, they're not independent. For example, knowing the value of $Y$ certainly changes the variance of $X$.
A: Consider the following example: $Y\sim N(0;1)$ (standard normally distributed), $\epsilon\sim B(\pm1,1/2)$, $Y$ and $\epsilon$ independent and $X=\varepsilon Y$. $X$ and $Y$ are not independent (convince yourself that this is the case), $X\sim N(0,1)$, and yet $$E[X|Y]=0=E[X]$$
More examples of this nature can be obtained easily. Suppose $Y$ and $\varepsilon$ are independent integrable random variables and that $E[\varepsilon]=0$. Define $X=\epsilon Y$. For any random variable $W$ denote by $\phi_W(t)=E[e^{it W}]$.
Notice that
\begin{align}
E[X|Y]=YE[\epsilon|Y]&=YE[\epsilon]=0\\
&=E[\epsilon]E[Y]=E[\epsilon Y]=E[X]
\end{align}
However, $X$ and $Y$ are not independent in general for
\begin{align}
E[e^{isX+itY}]=E[e^{itY}E[e^{isY\epsilon}|Y]]=E[e^{itY}\phi_\epsilon(Ys)]\\
\neq E[e^{itY}]E[e^{isX}]=\phi_Y(t)E[\phi_\varepsilon(sY)]
\end{align}
