If you are studying statistics or probability, you probably need to learn to calculate covariance, a measurement of how two variables change. Some variables covary positively. For example, you might predict that a hotter summer means higher electrical usage: as one of the variables increases, so does the other. Other variables covary negatively: as temperatures increase, you might expect sweater purchases to decrease. Finally, zero covariance indicates that two variables  such as eye color and birth date  are independent of each other. The calculations involved are relatively simple: Cov(x,y) = E{xy}  E{x}E{y}.

Calculate the mean, or average, of the first variable, x. Add all the data points and then divide by the number of data points. For example, if you have the data set {1, 3, 3, 5} for x, the mean is (1 + 3 + 3 + 5) / 4 = 3.

Calculate the mean for the second variable, y, the same way. Suppose you have the data set {12, 12, 11, 7} for y. The mean is (12 + 12 + 11 + 7) / 4 = 10.5.

Multiply each data point for x by the corresponding data point for y. For example, for these two data sets, you would calculate {12 x 1, 12 x 3, 11 x 3, 7 x 5} = {12, 36, 33, 35}.

Calculate the mean of the data set you just created. This is the E{xy}. Continuing the example: (12 + 36 + 33 +35) / 4 = 29.

Calculate E{x}E{y} by multiplying the mean of x and the mean of y you calculated earlier. In our example, that's 3 x 10.5 = 31.5.

Calculate the covariance by using the equation Cov(x,y) = E{xy}  E{x}E{y}. Finishing the example, 29  31.5 = 2.5. This is a negative covariance, indicating that in general, as one variable increases, the other decreases.
Tips & Warnings
 Because comparing covariances is like comparing apples and oranges, covariances are often converted to correlation coefficients.
References
 Photo Credit keypad image by vashistha pathak from Fotolia.com