Covariance#
Covariance is a measure of the linear relationship between two random variables. We denote the covariance between \(X\) and \(Y\) as \(\operatorname{Cov}(X, Y)\), and it is defined to be
Note that the outer expectation must be taken over the joint distribution of \(X\) and \(Y\).
Again, the linearity of expectation allows us to rewrite this as
Comparing these formulas to the ones for variance, it is not hard to see that \(\operatorname{Var}(X) = \operatorname{Cov}(X, X)\).
A useful property of covariance is that of bilinearity:
Correlation#
Normalizing the covariance gives the correlation:
Correlation also measures the linear relationship between two variables, but unlike covariance always lies between \(-1\) and \(1\).
Two variables are said to be uncorrelated if \(\operatorname{Cov}(X, Y) = 0\) because \(\operatorname{Cov}(X, Y) = 0\) implies that \(\rho(X, Y) = 0\). If two variables are independent, then they are uncorrelated, but the converse does not hold in general.