Covariance proof 
Let the covariance random values X,Y be :
  $$Cov[X, Y]= E[(X- E[X])(Y - E[Y])] = E[XY]-E[X]E[Y]$$
Prove the following for random values $X_1...X_n$ :
  $$Var[\sum_{i = 1}^n X_i] = \sum_{i = 1}^n Var[X_i] + \sum_{i = 1}^n \sum_{j = 1, j\ne i}^nCov[X_i,X_j]$$

How would I go about proving this?
 A: We will use principle of mathematical induction.
Basis
$Var(X_1+X_2)=E((X_1+X_2)^2)-E^2(X_1+X_2)$
$=E(X_1^2+2X_1X_2+X_2^2)-(E(X_1)+E(X_2))^2$
$=E(X_1^2)-E^2(X_1)+E(X_2^2)-E^2(X_2)+2(E(X_1X_2)-E(X_1)E(X_2))$
$=Var(X_1)+Var(X_2)+2Cov(X_1,X_2)$
Induction Hypothesis
$Var(\sum_{i=1}^k X_i)=\sum_{i=1}^k Var(X_i)+\sum_{i=1}^k \sum_{j=1,i\neq j}^k Cov(X_i,X_j)$
Inductive step
$Var(\sum_{i=1}^{k+1} X_i)=Var(X_{k+1}+\sum_{i=1}^k X_i)$
$=Var(X_{k+1})+Var(\sum_{i=1}^k X_i)+ 2Cov(X_{k+1},\sum_{i=1}^k X_i)$
$=Var(X_{k+1})+Var(\sum_{i=1}^k X_i)+2\sum_{i=1}^k Cov(X_{k+1} X_i) $
which gives the required result on using hypothesis.
Hope it is helpful:)
A: Let $Z_i=X_i-\mathbb EX_i$ for $i=1,\dots,n$.
Then:
$$\mathsf{Var}\left(\sum_{i=1}^nX_i\right)=\mathbb E\left(\sum_{i=1}^nX_i-\mathbb E\sum_{i=1}^nX_i\right)^2=\mathbb E\left(\sum_{i=1}^nZ_i\right)^2=\mathbb E\sum_{i=1}^n\sum_{j=1}^nZ_iZ_j=$$$$\sum_{i=1}^n\mathbb EZ_i^2+\sum_{i=1}^n\sum_{j=1,j\neq i}^n\mathbb EZ_iZ_j=\sum_{i=1}^n\mathsf{Var}X_i^2+\sum_{i=1}^n\sum_{j=1,j\neq i}^n\mathsf{Cov}(X_i,X_j)$$
