# What is $\operatorname{Var}(X - Y)$?

I am working on a problem from probability theory and am a little bit stuck.

I know that the formula for $$\operatorname{Var}(X + Y)$$ is $$\operatorname{Var}(X) + \operatorname{Var}(Y) + 2\operatorname{Cov}(X,Y)$$

Does this mean that for $$\operatorname{Var}(X - Y)$$ it is just:

$$\operatorname{Var}(X) - \operatorname{Var}(Y) - 2\operatorname{Cov}(X,Y)$$?

• Nope, it is $\mathrm{Var}(X) + \mathrm{Var}(-Y) + 2 \mathrm{Cov}(X,-Y) = \mathrm{Var}(X) + \mathrm{Var}(Y) - 2 \mathrm{Cov}(X,Y)$.
– Hugo
Oct 8, 2018 at 23:37
• Why do we only flip the sign of the last one? Oct 8, 2018 at 23:39
• Because $\mathrm{Cov}(X,-Y) = E[-XY]-E[X]E[-Y] = -E[XY]+E[X]E[Y] = - \mathrm{Cov}(X,Y)$.
– Hugo
Oct 8, 2018 at 23:40
• Ok, thank you for the clarification. Oct 8, 2018 at 23:42
• @Ethan While on the other hand $Var(-Y)=Var(Y)$. Apr 27, 2022 at 15:54

## 2 Answers

It will be $$\text{Var}(X) + \text{Var}(Y) - 2\text{Cov}(X,Y)$$, because $$\text{Var}(-Y) = \text{Var}(Y)$$.

• Why do we only flip the sign of the last one? Oct 8, 2018 at 23:37
• @Ethan the covariance is linear in both of the variables, i.e. you can pull a scalar out of either the first or the second variable. This follows from the linearity of expectations. Since $\text{Var}(Y) = \text{Cov}(Y, Y)$, a negative sign on the variance "pulls out twice" which cancels. (Or if you prefer a more probabilistic proof, the variance indicates the [square of the] expected distance from the mean, which doesn't change if we just put a minus sign in front of all the data.) Oct 8, 2018 at 23:52

$$Var (X) = E[X^2] - E[X]^2$$

The definition of variance.

$$Var (X-Y) = E[(X-Y)^2] - E[X-Y]^2\\ E[X^2 - 2XY + Y^2] - E[X-Y]^2$$

Linearity of expectation:

$$E[X^2 - 2XY + Y^2] = E[X^2] + E[Y^2] - 2E[XY]$$ and $$E[X-Y] = E[X] - E[Y]$$

$$Var (X-Y) = E[X^2] - 2E[XY] + E[Y^2] - (E[X]^2 - 2E[X]E[Y] + E[Y]^2)\\ E[X^2] - E[X]^2 + E[Y^2] - E[Y]^2 - 2(E[XY] - E[X]E[Y])$$

Now note that: \begin{align} Cov(x,y)&=E[(x-E[x])](y-E[y])]\\ &=E[xy]-E[x E[y]]-E[y[E[x]]+ E[x]E[y]\\ &=E[xy]-E[x]E[y]-E[y]E[x]+E[x]E[y]\\ &=E[xy]-E[x]E[y] \end{align}

Which immediately gives the result desired in terms of the covariance.