# Determining variance from sum of two random correlated variables

I understand that the variance of the sum of two independent normally distributed random variables is the sum of the variances, but how does this change when the two random variables are correlated?

-
You have to add twice the covariance. – David Mitra Mar 2 '12 at 1:55
Can you please submit an answer so I can "check" it? Thanks. Your solution is helpful, thanks. – Soo Mar 2 '12 at 2:01
Also, what if you add three random normally distributed variables with non-zero correlations between each variable? Do you add 2 times the covariances between all of the random variables? So it would look like var(A) + var(B) + var(C) + 2*(covar(A,B)+covar(A,C)+covar(B,C))? – Soo Mar 2 '12 at 2:04
And David's answer works even when the random variables are not normally distributed. – Dilip Sarwate Mar 2 '12 at 2:05
@Dilip, is this because we only care about variances and covariances, and not the shape of the distribution? – Soo Mar 2 '12 at 2:07

For any two random variables: $$\text{Var}(X+Y) =\text{Var}(X)+\text{Var}(Y)+2\text{Cov}(X,Y).$$ If the variables are uncorrelated (that is, $\text{Cov}(X,Y)=0$), then

$$\tag{1}\text{Var}(X+Y) =\text{Var}(X)+\text{Var}(Y).$$ In particular, if $X$ and $Y$ are independent, then equation $(1)$ holds.

In general $$\text{Var}\Bigl(\,\sum_{i=1}^n X_i\,\Bigr)= \sum_{i=1}^n\text{Var}( X_i)+ 2\sum_{i< j} \text{Cov}(X_i,X_j).$$ If for each $i\ne j$, $X_i$ and $X_j$ are uncorrelated, in particular if the $X_i$ are pairwise independent (that is, $X_i$ and $X_j$ are independent whenever $i\ne j$), then $$\text{Var}\Bigl(\,\sum_{i=1}^n X_i\,\Bigr)= \sum_{i=1}^n\text{Var}( X_i) .$$

-
Can you add an addendum for the sum of 3 random variables? Is the resulting var = var(A) + var(B) + var(C) + 2*(covar(A,B)+covar(A,C)+covar(B,C)) – Soo Mar 2 '12 at 2:08
I am unfamiliar with the summation(i<j). Can you explain what this notation means? – Soo Mar 2 '12 at 2:13
@soo You calculate all covariances $\text{Cov}(X_i,X_j)$ with $i<j$ and sum them up. Another way to write $2\sum_{i<j}$ in this case is to write $\sum_{i\ne j}$. (The 2 is there in the first sum because in the second sum you calculate, e.g., $\text{Cov}(X_1,X_2)$ and $\text{Cov}(X_2,X_1)$, but these are equal. – David Mitra Mar 2 '12 at 2:17
David, excellent explanation, the 2 in the 2*cov(...) makes more sense now. Also, can you explain why you wouldn't define an upper limit "n" in the summation(i<j)? Just for my personal curiosity. Thanks – Soo Mar 2 '12 at 2:21
@soo For your first comment, that's correct. I'll just let your comment be the addendum, if that's ok. – David Mitra Mar 2 '12 at 2:23

You can also think in vector form:

$Var(a^T X) = a^T Var(X) a$

where $a$ could be a vector or a matrix, $X = (x_1, x_2, \dots, x_3)^T$, is a vector of random variables. $Var(X)$ is the covariance matrix.

If $a = (1, 1, \dots, 1)^T$, then $a^T X$ is the sum of all the $x's$

-