# Why is $\operatorname{Var}(X+Y) = \operatorname{Cov}(X,X) + \operatorname{Cov}(X,Y) + \operatorname{Cov}(Y,X) + \operatorname{Cov}(Y,Y)$

I know $\operatorname{Cov}(X,Y) = E[(X-u_x)(Y-u_y)]$ and

$$\operatorname{Cov}(X+Y, Z+W) = \operatorname{Cov}(X,Z) + \operatorname{Cov}(X,W) + \operatorname{Cov}(Y,Z) + \operatorname{Cov}(Y,W),$$

but how does one get $$\operatorname{Var}(X+Y) = \operatorname{Cov}(X,X) + \operatorname{Cov}(X,Y) + \operatorname{Cov}(Y,X) + \operatorname{Cov}(Y,Y)?$$

-
The last ingredient is the formula $$\Bbb{V}(X) = \mathrm{Cov}(X, X).$$ –  sos440 Nov 18 '12 at 4:42

A quick way: Note from the definition of variance that $\text{Var}(T)=\text{Cov}(T,T)$. Now in your formula for $\text{Cov}(X+Y, Z+W)$, set $Z=X$ and $Y=W$. You will get exactly the formula you want to derive.

A slow way: We can work with just your basic defining formula for covariance. Note that $$\text{Var}(X+Y)=E(((X+Y)-(\mu_X+\mu_Y))^2).$$ Rearranging a bit, we find that this is $$E(((X-\mu_X)+(Y-\mu_Y))^2).$$ Expand the square, and use the linearity of expectation. We get $$E((X-\mu_X)^2) +E((Y-\mu_Y)^2)+2E((X-\mu_X)(Y-\mu_Y).$$ The first term is $\text{Var}(X)$, which is the same as $\text{Cov}(X,X)$. A similar remark can be made about the second term. And $\text{Cov}(X,Y)=\text{Cov}(Y,X)=E((X-\mu_X)(Y-\mu_Y))$.

Remark: There is a variant of the formula for covariance, and variance, which is very useful in computations. Suppose we want the covariance of $X$ and $Y$. This is $E((X-\mu_X)(Y-\mu_Y))$. Expand the product, and use the linearity of expectation. We get $$E(XY)-E(\mu_XY)-E(\mu_Y X+E(\mu_X\mu_Y).$$ But $\mu_X$ and $\mu_Y$ are constants. So for example $E(\mu_X Y)=\mu_XE(Y)=\mu_X\mu_Y)$. So we conclude that $$\text{Cov}(X,Y)=E(XY)-\mu_X\mu_Y.$$ A special case of this is the important $$\text{Var}(X)=E(X^2)-\mu_X^2=E(X^2)-(E(X))^2.$$

The above formulas for covariance would have made it easier to derive the formula of your problem, or at least to type the answer. For $$\text{Var}(X+Y)=E((X+Y)^2)-(\mu_X+\mu_Y)^2.$$ Expand each square, use the linearity of expectation, and rearrange. We get $$(E(X^2)-\mu_X^2)+(E(Y^2)-\mu_Y^2)+2(E(XY)-\mu_X\mu_Y),$$ which is exactly what we want.

-