Covariance
Covariance of linear combinations

If X {\displaystyle X}, Y {\displaystyle Y}, W {\displaystyle W}, and V {\displaystyle V} are real-valued random variables and a, b, c, d {\displaystyle a,b,c,d} are real-valued constants, then the following facts are a consequence of the definition of covariance: cov (X, a) = 0 cov (X, X) = var (X) cov (X, Y) = cov (Y, X) cov (a X, b Y) = a b cov (X, Y) cov (X + a, Y + b) = cov (X, Y) cov (a X + b Y, c W + d V) = a c cov (X, W) + a d cov (X, V) + b c cov (Y, W) + b d cov (Y, V) {\displaystyle {\begin{aligned}\operatorname {cov} (X,a)&=0\\\operatorname {cov} (X,X)&=\operatorname {var} (X)\\\operatorname {cov} (X,Y)&=\operatorname {cov} (Y,X)\\\operatorname {cov} (aX,bY)&=ab\,\operatorname {cov} (X,Y)\\\operatorname {cov} (X+a,Y+b)&=\operatorname {cov} (X,Y)\\\operatorname {cov} (aX+bY,cW+dV)&=ac\,\operatorname {cov} (X,W)+ad\,\operatorname {cov} (X,V)+bc\,\operatorname {cov} (Y,W)+bd\,\operatorname {cov} (Y,V)\end{aligned}}}

For a sequence X 1, …, X n {\displaystyle X_{1},\ldots,X_{n}} of random variables in real-valued, and constants a 1, …, a n {\displaystyle a_{1},\ldots,a_{n}}, we have var (∑ i = 1 n a i X i) = ∑ i = 1 n a i 2 σ 2 (X i) + 2 ∑ i, j: i < j a i a j cov (X i, X j) = ∑ i, j a i a j cov (X i, X j) {\displaystyle \operatorname {var} \left(\sum _{i=1}^{n}a_{i}X_{i}\right)=\sum _{i=1}^{n}a_{i}^{2}\sigma ^{2}(X_{i})+2\sum _{i,j\,:\,i<j}a_{i}a_{j}\operatorname {cov} (X_{i},X_{j})=\sum _{i,j}{a_{i}a_{j}\operatorname {cov} (X_{i},X_{j})}}
oulipo:avoid_letter[o]