Conditional expectation of a Gaussian given a r.v.? Let $X$ be a standard Gaussian random variable and $B$ a standard Bernoulli random variable. Let $Y = B \cdot X$.
Computing $E(Y\mid X)$ is rather straightforward. I simply substitute $Y = B \cdot X$ and apply independence of  $X$ and $B$, obtaining $\frac{X}{2}$ . 
But how to compute $E(X\mid Y)$?
 A: The answer is $E(X\mid Y)=Y$. Here are two solutions, depending on which level of probability theory you are studying.

1st Way. We know that $E(X\mid Y)=u(Y)$, where $u(y)=E(X\mid Y=y)$. So we only need to determine the function $u(y)$. But


*

*If $y = 0$, then
$$E(X\mid Y=0)=E(X\mid B=0\text{ or } X=0).$$
Since $P(B=0)=\frac{1}{2}$ and $P(X=0)=0$, we may neglect the contribution from the condition $X=0$ and write
$$=E(X\mid B=0)=E(X)=0$$
where the second step follows from the independence.

*If $y \neq 0$, then
$$E(X\mid Y=y)=E(X\mid B=1\text{ and }X=y)=E(X\mid X=y)=y,$$
where the second step follows from the independence again.
Altogether, we get $u(y)=y$ and hence

$$E(X\mid Y)=Y.$$


2nd Way. We know that $E(X\mid Y)$ is the $P$-a.s. unique random variable $Z$ which is $\sigma(Y)$-measurable and satisfies
$$ E(X\mathbf{1}_A) = E(Z\mathbf{1}_A), \qquad \forall A \in \sigma(Y). \tag{*}$$
Now we claim that

$$E(X\mid Y)=Y, \qquad P\text{-a.s.}$$

This amounts to showing that $\text{(*)}$ holds with the choice $Z = Y$. Since the events of the form $\{Y\leq y\}$ generates $\sigma(Y)$, it suffices to check $\text{(*)}$ only for this form of events by the Monotone Class Theorem. Now,


*

*If $y < 0$, then $\{Y \leq y\} = \{B=1, X\leq y\}$ and hence
$$ X\mathbf{1}_{\{Y\leq y\}} = BX\mathbf{1}_{\{Y\leq y\}} = Y\mathbf{1}_{\{Y\leq y\}} .$$
This then shows that
$$ E[X\mathbf{1}_{\{Y\leq y\}}] = E[Y\mathbf{1}_{\{Y\leq y\}}]. $$

*If $y \geq 0$, then $\{Y \leq y\} = \{B=1, X\leq y\} \cup \{B = 0\}$, and so,
$$ X\mathbf{1}_{\{Y\leq y\}} = X\mathbf{1}_{\{B=1, X\leq y\}} + X\mathbf{1}_{\{B = 0\}} .$$
Similarly as before, the first term can be treated as
\begin{align*}
X\mathbf{1}_{\{B=1, X\leq y\}}
&= BX\mathbf{1}_{\{B=1, X\leq y\}} \\
&= Y\mathbf{1}_{\{B=1, X\leq y\}} \\
&= Y\mathbf{1}_{\{B=1, X\leq y\}} + Y\mathbf{1}_{\{B=0\}} \\
&= Y\mathbf{1}_{\{Y \leq y\}},
\end{align*}
where the third step follows from $ Y\mathbf{1}_{\{B=0\}} = 0 $. In light of this, we get
\begin{align*}
E[X\mathbf{1}_{\{Y\leq y\}}]
&= E[Y\mathbf{1}_{\{Y \leq y\}}] + E[X\mathbf{1}_{\{B=0\}}] \\
&= E[Y\mathbf{1}_{\{Y \leq y\}}] + E[X]P(B = 0) \\
&= E[Y\mathbf{1}_{\{Y \leq y\}}].
\end{align*}
Therefore the desired conclusion follows.
