Covariance

Definition

The covariance is a measure of the joint variability between two variables. When the two variables show similar behaviors, then the covariance is positive. When the two variables show opposite behaviors, then the covariance is negative.

Mathematically, the covariance between variables X and Y can be described as:

cov(X,Y)=E[(X−E[X])(Y−E[Y])].

This can also be expressed (through the linearity property of Expectation):

cov(X,Y)=E[(X−E[X])(Y−E[Y])]=E[(XY−XE[Y]−E[X]Y+E[X]E[Y])]=E[XY]−E[X]E[Y]−E[X]E[Y]+E[X]E[Y]=E[XY]−E[X]E[Y]

Fun fact, you can also do it for Imaginary numbers.

Properties

  1. Location invariance: Cov(x,y)=Cov(x−a,y)
  2. Multilinearity: λCov(x,y)=Cov(λx,y)
  3. Symmetry: Cov(x,y)=Cov(y,x)

Notes:

cov(X,Y)σXσY