I have an expression: $E[(b+X)^2|Y]$ where $X$ and $Y$ are normally distributed random variables, being two components of a final unknown outcome $Z$ ($Y$ is known, $X$ is the noise component): 


$Y$ = $Z$ + $X$. 


~~Their distributions are normal and independent: $X$ ~ $N(0,\sigma\_x^2)$ and $Y$ ~ $N(0,\sigma\_y^2)$.~~ 


Z and X are normally distributed and independent: $X$ ~ $N(0,\sigma\_x^2)$ and $Z$ ~ $N(0,\sigma\_z^2)$.


$b$ is just a linear function of, among other things, $Y$ : $b = \lambda\_yY+\lambda\_qQ+\delta$. 


Sorry, I have no idea how to solve for the expectation...



Conditional expectation of a product
Hi Apeirohedron,


your expectation is $\sigma\_x^2 + b^2$, since $E[(b+X)^2|Y] = E[X^2|Y] + 2bE[X|Y] + b^2 = \sigma\_x^2 + 2bE[X] + b^2 = \sigma\_x^2 + b^2$. $E[X|Y] = E[X]$ holds since $X$ and $Y$ are independent. 


**In the general case:**
You know that $X$ and $Z$ are Gaussian. In particular, you know that $X\sim \mathcal N(0,\sigma\_x^2)$ and $Y|X \sim \mathcal N(x,\sigma\_z^2)$. Therefore, playing with conditional Gaussians, you get $X|Y \sim \mathcal N\left(\frac{y}{\sigma\_z^2/\sigma\_x^2 + 1},(\sigma\_x^{-2}+\sigma\_z^{-2})^{-1}\right)$. You can find the formulae for that in 


*Bishop CM. Pattern Recognition and Machine Learning (Information Science and Statistics). Springer; 2007.*


on page 93. Your conditional expectation is, therefore, $E[X|Y] = \frac{y}{\sigma\_z^2/\sigma\_x^2 + 1}$. 


