Covariance is a measure of joint-variability of two random variables.

Mathematically speaking, it is defined as: cov(X,Y)=E[(XE[X]).(YE[Y])] Where:

  • X, Y = two random variables
  • cov(X,Y) = covariance between X, Y
  • E[.] = expectation of the input random variable

This can be further simplified to: cov(X,Y)=E[X.Y]E[X].E[Y]