Covariance is a statistical measure of how two assets move in relation to each other. It provides diversification and reduces the overall volatility for a portfolio. A positive covariance indicates that two assets move in tandem. A negative covariance indicates that two assets move in opposite directions.

In the construction of a portfolio, it is important to attempt to reduce the overall risk and volatility while striving for a positive rate of return. Analysts use historical price data to determine which assets to include in a portfolio. By including assets that show a negative covariance, the overall volatility of a portfolio will be reduced.

The covariance of two particular assets is calculated by a formula that includes the historical asset returns as independent and dependent variables, as well as the historical mean of each individual asset price over a similar number of trading periods for each asset. The formula takes the daily return minus the mean return for each asset, multiplied by each other, and then divided by the number of trading periods for the respective time frames measured. The covariance formula is:

Covariance = sum(Return(A) - Average(A)) * (Return(B) * Average(B)/ Sample Size - 1
Covariance formula.  Investopedia

Covariance as a Diversification Tool

Covariance can maximize diversification in a portfolio of assets. Adding assets with a negative covariance to a portfolio reduces the overall risk. At first, this risk drops off quickly; as additional assets are added, it drops off slowly. Diversifiable risk cannot significantly be reduced beyond including 25 different stocks in a portfolio. However, including more assets with negative covariance means that the risk drops more quickly.

Covariance has some limitations. While covariance can show the direction between two assets, it cannot be used to calculate the strength of the relationship between the prices. Determining the correlation coefficient between the assets is a better way to measure the strength of the relationship.

An additional drawback to the use of covariance is that the measurement is subject to being skewed by the presence of outliers in the underlying data. Thus, large single-period price movements may skew the overall volatility of the price series and provide an unreliable statistical measurement of the nature of the direction between the assets.

Modern Portfolio Theory's Use of Covariance

Modern portfolio theory (MPT) uses covariance as an important element in the construction of portfolios. MPT assumes investors are risk averse yet still seek the best return possible. MPT thus attempts to determine an efficient frontier for a mix of assets in a portfolio, or an optimal point at which the relationship between risk and return is most beneficial. The efficient frontier calculates the maximum return for a portfolio versus the amount of risk for the combination of the underlying assets. The goal is to create a group of assets with an overall standard deviation that is less than that of the individual securities. The graph of the efficient frontier is curved, demonstrating how higher-volatility assets may be mixed with lower-volatility assets to maximize return but reduce the impact of large price fluctuations. By diversifying the assets in a portfolio, investors can reduce risk while obtaining returns on their investments.