# Covariance

The covariance is the arithmetic mean of the products of deviations of each variable to their respective means.

Covariance is denoted by cov(X,Y).  The covariance indicates the sign of the correlation between the variables.

If cov(X, Y) > 0 the correlation is positive.

If cov(X, Y) < 0 the correlation is negative.

As a disadvantage, its value depends on the chosen scale. That is, the covariance will vary if the height is expressed in meters or feet. It will also vary if money is expressed in euros or dollars.

#### Examples

The scores of 12 students in their mathematics and physics classes are:

 Mathematics 2 3 4 4 5 6 6 7 7 8 10 10 Physics 1 3 2 4 4 4 6 4 6 7 9 10

Find the covariance of the distribution.

xi yi xi · yi
2 1 2
3 3 9
4 2 8
4 4 16
5 4 20
6 4 24
6 6 36
7 4 28
7 6 42
8 7 56
10 9 90
10 10 100
72 60 431

After tabulating the data, the arithmetic means can be found:  The values of the two variables X and Y are distributed according to the following table:

Y/X 0 2 4
1 2 1 3
2 1 4 2
3 2 5 0

Next, find the covariance of the distribution.

Convert the double entry table into a simple table and compute the arithmetic means.

xi yi fi xi · fi yi · fi xi · yi · fi
0 1 2 0 2 0
0 2 1 0 2 0
0 3 2 0 6 0
2 1 1 2 1 2
2 2 4 8 8 16
2 3 5 10 15 30
4 1 3 12 3 12
4 2 2 8 4 16
20 40 41 76  