What It Measures
Covariance measures the relationship between two random variables. For example, we might measure whether a sample population liked drinking wine, and whether they liked eating cheese. Covariance is a form of probability theory that allows us to measure the extent to which those two random variables change together. It’s important to remember this does not imply causality—simply because one variable increases along with another does not mean there is necessarily a link between the two variables.
If the two variables tend to change together—showing that people who particularly enjoy drinking wine tend to particularly enjoy eating cheese—there is said to be positive covariance. If the two variables move in opposite directions—people who drink wine tend to be less keen on cheese—the covariance is said to be negative. Random variables that do not relate in either way are said to be uncorrelated.
Why It Is Important
For investors, covariance is an important way of seeing how one variable is related to another, particularly when analyzing the performance of stocks or investments within a portfolio.
For example, an investor might want to see the impact that multiple changes on a portfolio affect overall returns, or the relationship between a company’s debt/equity ratio and working capital cycle. Covariance is often used in measuring the performance of securities.
As a rule of thumb, a high rate of covariance suggests a portfolio that is not diversified, and which presents a high level of risk. For example, if two stock prices tend to rise and fall at the same time, these stocks would not deliver the best diversified earnings.
How It Works in Practice
Covariance provides a way of measuring the strength of correlation between two random variables. The covariance for two random variables x and y, with a sample size of n, is as follows:
Covariance xy = Σxx ÷ n
As an example, imagine we asked four men to rate their liking for both cheese and wine, on a scale of 1 to 10. The results were as follows:
Cheese (x)  Wine (y)  x  y  zy  
A  3  4  –1  –2  2 
B  1  4  –3  –2  6 
C  3  8  –1  2  –2 
D  9  8  5  2  10 
Sum  16  24  0  0  16 
Mean  4  6  0  0  4 
To calculate the covariance, we calculate a mean for both variables. Next, both variables are transformed into deviation scores by subtracting the mean from the relevant score. The products of these deviation scores can then be calculated, summed, and averaged. The result is known as the coefficient of covariance, in this case 4.
Expressed in simpler terms: the sum of the product of variables x and y is 112, and the mean is 28. Subtracting the product of the separate means (28 – 4 × 6 yields the coefficient of covariance equal to 4).
Tricks of the Trade

In probability theory, covariance is closely related to the concept of correlation—both of these tools are ways of measuring the similarity of two random variables.

The coefficient of covariance has no upper or lower limits. Some statisticians point out this indeterminacy is its main disadvantage as compared with the coefficient of correlation.

In our example, we have calculated covariance by multiplying the correlation of two random variables by the standard deviation. However, you can also calculate covariance by looking at “return surprises” (deviations from an expected return), which can be useful when analyzing securities.