Covariance is a simple measure of the way two variables move together, or “co-vary”. The covariance of two variables, XX and YY, can be expressed in population notation as:
Therefore, the covariance between XX and YY is simply the product of the variation of XX around its expected value, and the variation of YY around its expected value. The sample covariance is expressed as:
Covariance can be positive, negative, or zero. If the covariance is positive both variables move in the same direction, meaning if XX increases YY increases or if XX decreases YY decreases. Negative covariance means that the variables move in opposite directions; if XX increases YY decreases. Finally, zero covariance indicates that there is no covariance between XX and YY.