Suppose $X$~$\mathcal{N}(0,1)$ and $Y$~$Ber(\frac{1}{2})$, X and Y are independent. Let $Z = \{X,$ if $Y=1$; $-X,$ if $Y=0$, find the distribution of $Z$.
For this problem I got a hint that $Z=YX-(1-Y)X$, but I am not sure if this is correct.
For the next step, I find $E[Z]=E[YX-(1-Y)X]=0$, but how do I calculate $\rm{Var}[Z=YX-(1-Y)X]$?
The equation $Z=YX-(1-Y)X$ is correct because it holds when $Y=0$ as well as when $Y=1$. You ar asked to find the distribution of $Z$, not just its mean and variance.
$P(Z\leq z)=P(X\leq z) P(Y=1)+P(-X \leq z) P(Y=0)=\frac 1 2 P(X\leq z)+\frac 1 2P(-X \leq z)=\Phi (z)$ since $X$ and $-X$ both have satnadard normal distrbution $\Phi$. Hence, $Z \sim N(0,1)$.