What is Var(X - Y)?

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


$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.