# Expected value of X given X+Y=s?

Question:

Given $$X\sim N(\mu_X, \sigma_X^2)$$ and $$Y\sim N(\mu_Y, \sigma_Y^2)$$ are independent, and you know $$X+Y=s$$. What is the expected value of $$X$$?

I encountered this during an interview. My thoughts were to use conditional expectation $$E(X|Z=s)$$ where $$Z\sim N(\mu_X+\mu_Y, \sigma_X^2+\sigma_Y^2)$$. However, it involves a lot of calculations, which I don't think would be an interview question. Could anyone suggest?

• (1) Find the joint distribution of $(X, X+Y).$ (2) Use your understanding of univariate ordinary least square regression.
– whuber
Aug 17, 2022 at 22:58
• Aug 18, 2022 at 0:42
• I took an approach similar to the one suggested by @whuber in my answer where I replaced (2) with your understanding/knowledge of a property, the conditional expectation, of bivariate normal distributions. Arguably, for your question this is equivalent to knowing how to express the so-called population regression function in the simple linear regression model (i.e., the conditional expectation of the dependent variable $X$ given the intercept and regressor $\left(X+Y\right)$) in terms of $\mathrm{Cov}(X,X+Y)$, $\mathbb E(X)$, $\mathbb E(X+Y)$, and $\mathbb V(X+Y)$. Aug 18, 2022 at 9:44

Since $$X$$ and $$Y$$ are both univariate normal and independent, we know that all linear combinations of $$X$$ and $$X+Y$$ are univariate normal. Thus, $$\left(X,X+Y\right)^\top$$ is bivariate normal and we have $$X+Y \sim \mathcal N\left(\mu_X+\mu_Y, \sigma_X^2+\sigma_Y^2\right), \\ \mathrm{Cov}\left(X,X+Y\right)=\mathrm{Cov}\left(X,X\right)+\mathrm{Cov}\left(X,Y\right)=\sigma_X^2, \\ \begin{pmatrix} X\\ X+Y\\ \end{pmatrix} \sim \mathcal N\left(\begin{pmatrix} \mu_X\\ \mu_X+\mu_Y \end{pmatrix}, \begin{pmatrix} \sigma_X^2 & \sigma_X^2\\ \sigma_X^2 & \sigma_X^2+\sigma_Y^2 \end{pmatrix}\right).$$ The well-known formula for the conditional expectation in the bivariate normal case then yields $$\mathbb E\left(X|X+Y=s\right) = \mu_X+\frac{\sigma_X^2}{\sigma_X^2+\sigma_Y^2}\left(s-\left(\mu_X+\mu_Y\right)\right).$$