# $X+Y=s$ but $X$ and $Y$ are independent?

From another Cross Validated 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$$?

The question makes it sound like $$Y=s-X$$ yet $$X$$ and $$Y$$ are independent. How can this be?

$$cov(X,Y)\\=cov(X,s-X)\\=-var(X)\ne 0$$

Nonzero covariance is one form of dependence and precludes independence.

• See if the image at stats.stackexchange.com/a/9073/2958 helps Aug 18, 2022 at 0:46
• It isn't that the RVs are deterministically adding to $s$, rather the question is asking about conditioning on the event.
– Ben
Aug 18, 2022 at 0:46
• @Ben That seems to be the approach taken in the other question, not an assumption of the problem faced in the interview.
– Dave
Aug 18, 2022 at 0:49
• I agree with @Ben and have interpreted the questions as asking for the conditional expectation of $X$ given $X+Y=s$ for a specific (realized) $s$. Aug 18, 2022 at 0:56
• Hi @Dave. Writing mathematical expressions in plain English necessarily leads to imprecision. "If $X+Y=s$, what is the expectation of $X$" is just slightly sloppy wording for a conditional expectation.
– Ben
Aug 18, 2022 at 1:56

Ben's comment pretty much says it all.

$$X, Y$$ being independent doesn't mean there cannot be an event where their added realisations have a particular aggregate, say $$s.$$ But the distinction must be noted: $$Y :\ne X-s;$$ the necessary condition of independence is uncorrelatedness, i.e. $$\mathbb{Cov}(X, Y) = 0,$$ but in no way $$Y$$ is defined to be $$X- s.$$

This sounds a bit like the idea behind collider bias, the reverse of confounding bias.

• Confounding bias: x and y are found to be correlated because both are caused by z.
• Collider bias: x and y are found to be correlated because they both cause z and there is a selection effect based on z.

Image from the question:Can spurious correlations exist in the (theoretical) population?

So $$X$$ and $$Y$$ may not be correlated, but when you condition on $$s$$ then they are correlated.

It is written a bit implicitly in the interview question but the statement implies a conditioning

Given that ... and you know $$X+Y=s$$

You might assume that this means a particular sampled individual case has $$X+Y=s$$. Otherwise there is a contradiction. $$X$$ and $$Y$$ can not be independent while also $$X+Y=s$$.