# Combination of Normal random variable and Bernoulli

I have a random variable $Y=aX+Z$ where $a>0, Z\sim \mathcal{N}(0,1), P(X=1)=P(X=-1)=1/2$.

I would like to compute the $E(Y|X)$ and $E(X|Y)$. I was trying to find the joint pdf of $XY$.

$Y$ seems like a mixture of Guassians, in particular I thought it is distributed according to a Normal r.v. with mean $a$ and variance $1$ with probability $1/2$ and a Normal r.v. with mean $-a$ and variance $1$ with probability $1/2$. Is it a Normal r.v. with $\mu=0, \sigma^2=1/2$?

How can I compute the joint pdf now? Is it a Normal r.v. with $\mu=0, \sigma^2=1/4$?

Is $E(Y|X=x)=\int_y y \frac{f_{XY}(x,y)}{P(X=x)}$? Is $E(X|Y)=\int_x x f_{X|Y}(x|y)$?

• Well, $Y\mid X\sim\mathcal N(aX,1)$, so it's mean is $aX$. – StubbornAtom Apr 30 '18 at 15:57
• And what about $X|Y$? @StubbornAtom – user1868607 Apr 30 '18 at 15:59
• By the same logic I think one would get $X\mid Y\sim \mathcal N(Y/a,1/a^2)$. – StubbornAtom Apr 30 '18 at 16:10
• I agree but it seemed too easy! – user1868607 Apr 30 '18 at 16:19

The comments show how to find $E[Y|X]$. For $E[X|Y]$, note that $X$ is discrete, so you need only find $P(X=1|Y)$ and $P(X=-1|Y)$.
To do this, use this continuous analog of Bayes' theorem : $$P(X=1|Y=y)=\frac{f_{Y|X=1}(y)\cdot P(X=1)}{f_Y(y)}=\frac{f_{Y|X=1}(y)\cdot P(X=1)}{f_{Y|X=1}(y)\cdot P(X=1)+f_{Y|X=-1}(y)\cdot P(X=-1)}$$
• I had a typo, see edit, my answer shows how to find $E[X|Y]$. In more detail, $E[X|Y]=1\cdot P(X=1|Y)+(-1)\cdot P(X=-1|Y)$, then use Bayes' theorem. – Mike Earnest Apr 30 '18 at 16:46
• And so, if $X=1$ then $Y\sim \mathcal{N}(a,1)$ and this is the cdf of $Y|X=1$? Same for $X=-1$? @Mike Earnest – user1868607 Apr 30 '18 at 16:49