Finding the Covariance of an Investment

by Bryan Keythman, studioD

When you analyze investments in your portfolio, it helps to look at how they relate to one another. Covariance is a statistical figure that measures how two investments move together. A covariance can be positive, negative or zero. A positive covariance means two investments typically move in the same direction. A negative covariance means they move in opposite directions. Investments with a covariance of zero generally perform independently. Two investments with a negative covariance theoretically have lower risk together than they do alone because a positive return from one investment can potentially offset a negative return on the other.

Step 1

Determine the percentage returns of two investments for two or more periods. The returns can be weekly, annually or for some other period. For example, assume you know the monthly returns of two stocks for the past three months. Assume stock A generated returns of 20 percent, -8 percent and 12 percent. Assume stock B generated returns of 10 percent, 5 percent and 3 percent.

Step 2

Add together each investment’s periodic returns and divide each result by the number of periods to determine each investment’s average return. In this example, add together stock A’s returns of 20 percent, -8 percent and 12 percent to get 24 percent. Divide 24 percent by 3 to get an 8 percent average return. The average return for stock B would be 18 percent divided by 3, or 6 percent.

Step 3

Plug your values into the following formula: (Ai - X)(Bi - Y). Use a separate formula for each period for which you have data. In the formula, “Ai” represents the first investment’s periodic return, while “Bi” represents the second investment’s periodic return for the same period. “X” represents the first investment’s average return, while “Y” represents the second investment’s average return. Continuing the example, the formulas for the first, second and third months would be (20 - 8)(10 - 6), (-8 - 8)(5 - 6) and (12 - 8)(3 - 6), respectively.

Step 4

Calculate the formula for each period. In this example, you would get 48, 16 and -12 for the first, second and third months, respectively.

Step 5

Add together your results. In this example, add together 48, 16 and -12 to get 52.

Step 6

Subtract 1 from the number of periods for which you have return data. In this example, subtract 1 from 3 to get 2.

Step 7

Divide your Step 5 result by your Step 6 result to calculate the covariance of the investments. Concluding the example, divide 52 by 2 to get a covariance of 26, which means the two stocks tend to move in the same direction.


  • The covariance of two investments does not guarantee they will move in any particular way in the future. Investments can generate returns unrelated to their covariance with another investment.

Photo Credits

  • Compound returns chart image by Gramper from

About the Author

Bryan Keythman has performed stock investment research and writing for a consulting firm since 2008. He also has prior experience sourcing and underwriting commercial real-estate investment and development opportunities for a commercial real-estate developer. Keythman holds a Bachelor of Science in finance.

Zacks Investment Research

is an A+ Rated BBB

Accredited Business.