<s>[INST] Finding $ E ( X Y \mid X + Y = w ) $ when $ X $ and $ Y $ are i.i.d $\mathcal N ( 0 , 1 ) $ variables $ X $ and $ Y $ are both independent and identically distributed random variables with normal distributions $ \mathcal N ( 0 , 1 ) $. What is $ E ( X Y \mid X + Y = w ) $?
I know this means that $ W=X+Y $ must be normally distributed as well with mean $ 0 $ and variance $ 2 $. I also know that $ E ( X Y ) = E ( X ) E ( Y ) $ because of independence. However, I am confused as to how we calculate the conditional expectation in this situation. Do we just take the integral of the normal pdf? What would the boundaries be?
 [/INST] Letting $W = X + Y$ then you can write out the joint Gaussian as
\begin{align*}
\begin{bmatrix}
X \\ Y \\ W 
\end{bmatrix} \sim \mathcal{N} \left( 
\begin{bmatrix}
0 \\ 0 \\0
\end{bmatrix},
\begin{bmatrix}
1 & 0 & 1 \\
0 & 1 & 1 \\
1 & 1 & 2
\end{bmatrix}
\right) 
\end{align*}
without worrying too much that this covariance matrix is singular, therefore partitioning and conditioning we have
\begin{align*}
\begin{bmatrix} X \\ Y \end{bmatrix} \bigg| W = w \sim \mathcal{N}\left(
\begin{bmatrix}
\frac{w}{2} \\ \frac{w}{2} , 
\end{bmatrix}
\begin{bmatrix}
\frac{1}{2} & -\frac{1}{2} \\
-\frac{1}{2} & \frac{1}{2}
\end{bmatrix}
\right) 
\end{align*}
Still singular but that's ok because of course this Gaussian is supported on the one dimensional space $X + Y = w$. Anyway we get
\begin{align*}
\mathbb{E}\left[ X Y | X + Y = w \right] &= \mbox{Cov}_{X + Y = w}(X,Y) + (\mathbb{E}[X|X+Y=w])^2 \\
&= \frac{w^2}{4} - \frac{1}{2}.
\end{align*}
</s>