# Finding variance of joint probability function of discrete random variables

I've been working on a problem, and it's quite lengthy, so I'm going to restrict the problem while not losing too much information.

I'm given a table of the discrete random variables $X$ and $Y$. I'm asked to find the variance of $Y-X$. The solution breaks down each possible case of $Y-X$ and provides the probability of it. Then it found the expected value of $Y-X$. Neither were a problem for me. However, when attempting to find the variance, the solution simply gave a long sum of numbers. I tried to generalize it (hopefully without any mistakes) and obtained this: $$\text{Var}(Y-X) = \sum_{w \in W}\text{P}(W=w)\cdot[w - \text{E}(W)]^2, \text{ where } W = Y-X \tag{1}$$ Again, I haven't seen this before. I am however, familiar with $$\text{Var}(aX+bY) = a^2\text{Var}(X) + b^2\text{Var}(Y) + 2ab\cdot\text{Cov}(X,Y).$$ Are the two somehow equivalent? If not, where does $(1)$ come from?

-
If $W = Y-X$, and you spent a fair amount of time determining the distribution of $W$ already (that is, finding $P(W=w)$ for all choices of $w$, as well as calculating its expected value $E[W]$), what formula would you use in calculating the variance of $W$? – Dilip Sarwate Mar 5 '13 at 23:29