NSE IPO - Apply Online, Check Issue Date, Price, Lot Size & Allotment Status

Apply for NSE IPO:

Skip to main content

What is Covariance? How to Calculate Covariance of Stocks

6 min readUpdated on 2nd Sept, 2026by Team Angel One
Covariance is a key risk management tool that helps investors understand how different assets interact within a portfolio.
Share

Covariance is a fundamental statistical risk-management tool that measures how the returns of two assets move in relation to each other. It helps investors determine whether two stocks, mutual funds, or exchange-traded funds (ETFs) tend to move in tandem or opposite directions.

This article will explain what covariance is, how it differs from variance and correlation, the step-by-step formula for calculating it, and how to apply it to portfolio diversification in the Indian market.

Key Takeaways

  • Covariance helps identify if two assets tend to move together or in opposite directions, making it useful for portfolio construction.
  • A positive covariance is not always beneficial, as highly correlated assets may increase portfolio risk during market downturns.
  • Covariance is most effective when combined with correlation, which standardizes the relationship between two variables.
  • Investors can use covariance to select assets that reduce overall portfolio volatility instead of simply chasing high returns.
  • Since covariance depends on the scale of data, comparing covariance values across different asset pairs may not always provide meaningful insights.

What is Covariance?

Covariance is a statistical measure that indicates the directional relationship between the returns of two variables or assets.

In the stock market, covariance measures whether two securities move together over time.

If both assets rise and fall together, covariance is positive.

If one asset rises while the other falls, covariance is negative.

If there is no consistent relationship between their movements, covariance is close to zero.

Unlike variance, which measures the volatility of a single asset, covariance compares the movement of two different assets.

For investors, covariance plays an important role in portfolio management because combining assets with different covariance values can help reduce overall investment risk.

Why Is Covariance Important in Investing?

Covariance helps investors understand how different investments behave relative to one another.

Some of its key uses include:

  • Portfolio diversification: Adding assets with negative covariance may reduce portfolio volatility.
  • Risk management: Investors can avoid concentrating investments in securities that move together.
  • Asset allocation: Portfolio managers use covariance to select stocks across sectors.
  • Modern Portfolio Theory (MPT): Covariance is one of the building blocks of Harry Markowitz's portfolio optimization model.

For example, if banking stocks and gold generally move in opposite directions during uncertain markets, combining both may help balance overall portfolio risk.

How To Calculate Covariance?

Calculating covariance requires historical returns of two assets over the same time period.

Covariance Formula

Cov(X,Y) = Σ E((X – μ) E(Y – ν)) / n-1 where:

  • X is a random variable
  • E(X) = μ is the expected value (the mean) of the random variable X and
  • E(Y) = ν is the expected value (the mean) of the random variable Y
  • n = the number of items in the data set.
  • Σ is summation notation.

The numerator measures how both assets move together, while the denominator adjusts the calculation based on the sample size.

Suppose two stocks generated the following daily returns over five trading days.

Day  Stock X  Stock Y 
1.10%  3.00% 
1.70%  4.20% 
2.10%  4.90% 
1.40%  4.10% 
0.50%  2.50% 

Step 1: Calculate The Average Return 

Average return of Stock X 

=(1.1+1.7+2.1+1.4+0.5) ÷ 5 

=1.36% 

Average return of Stock Y 

=(3.0+4.2+4.9+4.1+2.5) ÷ 5 

=3.74% 

Step 2: Find Each Observation’s Deviation 

Subtract the average return from each daily return. 

For example, 

Stock X (Day 1) 

1.10 – 1.36 = -0.26 

Stock Y (Day 1) 

3.00 – 3.74 = -0.74 

Repeat this for every observation. 

Step 3: Multiply The Deviations 

Multiply the deviations for corresponding days. 

Example: 

(-0.26) × (-0.74) 

=0.1924 

Repeat for all five observations. 

Step 4: Add The Products 

Suppose the total of all multiplied values equals 2.66. 

Step 5: Divide By (n – 1) 

Number of observations = 5 

Therefore, 

n – 1 = 4 

Covariance 

=2.66 ÷ 4 

=0.665 

Since the result is positive, both stocks generally move in the same direction. 

How to Interpret Covariance? 

The sign of covariance is more important than its numerical value. 

Covariance Value 

Interpretation 

Positive 

Both assets generally move in the same direction 

Negative 

Assets usually move in opposite directions 

Zero or near zero 

No meaningful directional relationship 

For example: 

  • Banking and NBFC stocks often show positive covariance because both respond similarly to interest rate changes. 

  • Gold and equities may sometimes display negative covariance during periods of market uncertainty. 

However, covariance does not indicate how strong the relationship is. For that, investors use correlation. 

Covariance vs Correlation: What is the Difference? 

Although covariance and correlation are closely related, they serve different purposes.

Feature 

Covariance 

Correlation 

Measures 

Direction of relationship 

Direction and strength 

Range 

No fixed range 

-1 to +1 

Unit 

Depends on data scale 

Standardised 

Comparison 

Difficult across datasets 

Easy across datasets 

Portfolio use 

Initial relationship analysis 

Better comparison between assets 

Correlation makes covariance easier to interpret because it removes the influence of different units of measurement.

Covariance vs Variance

Feature 

Variance 

Covariance 

Variables measured 

One 

Two 

Purpose 

Measures volatility 

Measures relationship 

Indicates 

Spread around the mean 

Direction of movement 

Portfolio application 

Individual stock risk 

Relationship between investments 

For example, variance tells you how volatile a stock is, whereas covariance tells you whether two stocks move together.

Why Portfolio Managers Use Covariance

  1. Risk Reduction: Adding an asset with negative covariance to your portfolio helps cushion against losses in other holdings.
  2. Analyse: Helps investors avoid holding multiple stocks that react identically to market shocks.
  3. Modern Portfolio Theory (MPT): Developed by Harry Markowitz, MPT uses covariance matrices to determine the optimal asset mix that maximises returns for a given level of risk.

Advantages of Covariance

  • Helps diversify portfolios: Investors can combine assets that do not move together.
  • Supports better asset allocation: Portfolio managers can optimise investment combinations.
  • Measures asset relationships: Shows whether investments behave similarly over time.
  • Useful in quantitative finance: Forms the basis for portfolio optimisation models.
  • Improves risk analysis: Helps identify concentration risk within a portfolio.

Limitations of Covariance

  • Does not measure relationship strength: A positive covariance does not indicate whether the relationship is weak or strong.
  • Sensitive to scale: Larger numerical values do not necessarily imply stronger relationships.
  • Depends on historical data: Past relationships may not continue in future markets.
  • Can be misleading when used alone: Investors should combine covariance with correlation and other financial metrics.
  • Requires sufficient historical observations: Limited data may produce unreliable results.

How do Investors use Covariance in Portfolio Management?

Professional fund managers rarely analyse securities individually.

Instead, they study how investments behave together.

For example:

  • Combining two banking stocks may increase portfolio risk because both often move together.
  • Combining equities with government bonds or gold may reduce portfolio volatility if their covariance is negative or low.

Diversification works best when investments respond differently to changing economic conditions.

This principle forms the foundation of Modern Portfolio Theory, which aims to maximise returns for a given level of risk.

Mistakes Investors Make While Using Covariance

Avoid these common errors:

  • Assuming positive covariance always means a good investment.
  • Ignoring correlation while interpreting covariance.
  • Using very limited historical data.
  • Comparing covariance values across unrelated datasets.
  • Believing historical covariance guarantees future performance.

Conclusion

Covariance is a vital statistical foundation for building resilient, well-diversified portfolios. Measuring how two assets move relative to one another helps investors move beyond individual stock picking and focus on systemic portfolio risk. While a positive covariance highlights synchronised market movements, negative or low covariance provides the structural counterbalance needed to cushion against market volatility.

FAQs

Covariance is based on historical returns, so it changes as market conditions, company performance and economic factors evolve. 

Investors often compare the covariance between mutual funds to understand how different schemes may behave within a diversified portfolio. 

Negative covariance helps reduce overall portfolio risk because one investment may offset losses in another during adverse market conditions. 

High covariance only indicates that two assets move together. It does not guarantee superior returns or lower risk. 

A covariance close to zero suggests there is no consistent directional relationship between the returns of the two stocks. 

Understanding the calculation is useful for learning, but most investors use spreadsheet software or financial platforms to calculate covariance accurately and efficiently. 

There is no fixed rule. However, using a longer and consistent data series generally produces more reliable results than relying on only a few observations. 

Covariance can be applied to bonds, commodities, exchange-traded funds (ETFs), currencies and even macroeconomic variables to analyse how they move relative to one another. 

Open Free Demat Account!

Join our 3.8 Cr+ happy customers

+91

Open Free Demat Account!

Join our 3.8 Cr+ happy customers
+91