Covariance is a measure used to determine the extent to which two variables change in tandem. It’s a critical statistic for understanding the relationship between two variables. The covariance () between two variables and is given by:
where and are the means of and , respectively. A positive covariance indicates that the variables tend to move in the same direction, while a negative covariance indicates that they move in opposite directions.
If the (real) random variable pair can take on the values for , with equal probabilities , then the covariance can be equivalently written in terms of the means and as
It can also be equivalently expressed, without directly referring to the means,