# 6.2: Covariance

- Page ID
- 7231

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:

cov(X,Y)=E[(X−μx)(Y−μy)](6.2)(6.2)cov(X,Y)=E[(X−μx)(Y−μy)]

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:

cov(X,Y)=∑(X−¯X)(Y−¯Y)(n−1)(6.3)(6.3)cov(X,Y)=∑(X−X¯)(Y−Y¯)(n−1)

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

*; if XX increases YY decreases. Finally, zero covariance indicates that there is no covariance between XX and YY.*

*variables move in opposite directions*