# Derivation of variance of a sum of correlated random variables with equal mean

Suppose we have a sequence $$x_i, \ldots, x_n$$ of correlated random variables with pairwise covariances $$\Sigma_{ij}$$, (the $$(i,j)$$-entry of the covariance matrix $$\Sigma$$). Consider $$\hat{x}=\sum_{j}c_jx_j$$, where $$c_j=\frac{\sum_i K_{ij}}{\sum_{i,m} K_{im}}$$ (here $$K_{ij}$$ denotes the $$(i,j)$$-entry of the inverse of the covariance matrix $$K = \Sigma^{-1}$$). If each $$x_j$$ has mean $$\mu$$, then one can easily see that $$\mathbb{E}[\hat{x}]=\mu$$. However, I'm having trouble proving that $$Var[\hat{x}]=Cov[\hat{x},\hat{x}]=(\sum_{i.j}K_{ij})^{-1}$$. Can anyone shed some light on how to obtain this value for the variance? My instinct was to use $$Var[X]=E(X^2)-[E(X)]^2$$, but this only creates more trouble when we get to the $$[E(X)]^2$$ term. Any help is much appreciated.

Substituting in the formula for the variance the definition of the variable $$\hat{x}$$ and the fact that $$E[\hat{x}]=\mu$$:

$$Var[\hat{x}]=E(\hat{x}^2)-E(\hat{x})^2=\sum_{jk}c_jc_kE(x_jx_k)-\mu^2$$

We know that $$E(x_jx_k)=\text{Cov}[x_j,x_k]+E[x_j]E[x_k]=\Sigma_{jk}+\mu^2$$

and now we would like to try and compute the sum in the first expression. First we notice that $$\sum_{i}c_i=1$$. Then we substitute the 2nd equation into the sum and decompose:

$$\sum_{jk}c_jc_kE(x_jx_k)=\sum_{jk}{c_jc_k\Sigma_{jk}}+\mu^2\sum_{j}c_j\sum_{k}c_k=\sum_{jk}{c_jc_k\Sigma_{jk}}+\mu^2$$

so the mean of the variable cancels and we are left with the evaluation of sum which can be performed as follows:

$$\sum_{jk}{c_jc_k\Sigma_{jk}}=\frac{1}{(\sum_{im}K_{im})^2}\sum_{i_1i_2}\sum_{jk}K_{i_1j}\Sigma_{jk}K^{T}_{ki_2}\\=\frac{1}{(\sum_{im}K_{im})^2}\sum_{i_1i_2}(K\Sigma K^{T})_{i_1i_2}\\=\frac{1}{(\sum_{im}K_{im})^2}\sum_{i_1i_2}(K^{T})_{i_1i_2}\\=\frac{1}{(\sum_{im}K_{im})^2}\sum_{i_1i_2}K_{i_1i_2}=(\sum_{ij}K_{ij})^{-1}\\$$

and finally we conclude that:

$$Var[\hat{x}]=\sum_{jk}{c_jc_k\Sigma_{jk}}+\mu^2-\mu^2=(\sum_{ij}K_{ij})^{-1}$$