BAJAJ FINSERV DIRECT LIMITED

Our Products

Stocks Insights

Covariance – How to Calculate Covariance of Stocks

authour img
Anshika

Table of Contents

Learn how covariance works to discover how stock movements are compared to assess relationships and portfolio behaviour.

Understanding how two stocks move in relation to each other is a fundamental part of portfolio analysis, risk management, and asset allocation. One of the most widely used statistical tools for this purpose is covariance. Whether you're constructing a diversified portfolio or evaluating stock relationships, knowing how covariance works—and how to calculate it—helps you make informed investment decisions.

What Is Covariance

Covariance is a statistical measure that shows how two variables move together. In the context of financial markets, it describes how two stocks’ returns move relative to each other.

Key points about covariance:

  • A positive covariance means the two stocks move in the same direction.

  • A negative covariance means they move in opposite directions.

  • A covariance value close to zero indicates no strong relationship between the movements.

  • Unlike correlation, covariance is not standardised, so its value can be difficult to interpret without context.

In finance, covariance is used to understand the co-movement of asset returns and plays a central role in modern portfolio theory.

How to Calculate Covariance

Covariance can be calculated using historical return data. The calculation helps determine whether two stocks move together or diverge over time.

Below is the plain text formula for covariance:

Covariance = Σ (Ri – R̄) (Rj – J̄) / (n – 1)

Where:

  • Ri = Return of Stock A in each period

  • R̄ = Average return of Stock A

  • Rj = Return of Stock B in each period

  • J̄ = Average return of Stock B

  • n = Number of periods

Steps to calculate covariance:

  1. Collect historical prices for both stocks.

  2. Convert prices into periodic returns (daily, weekly, or monthly).

  3. Calculate the average return for each stock.

  4. Subtract each stock’s average return from its respective returns.

  5. Multiply the deviations of Stock A and Stock B for each period.

  6. Add up the products of deviations.

  7. Divide the result by (n – 1) to get the covariance.

Example:

Assume three daily returns:

Stock A returns: 1%, 2%, 3% Stock B returns: 0.5%, 1.5%, 2.0%

  1. Average return of A = (1 + 2 + 3) / 3 = 2

  2. Average return of B = (0.5 + 1.5 + 2) / 3 = 1.33

  3. Compute deviations:

    • A: -1, 0, +1

    • B: -0.83, +0.17, +0.67

  4. Multiply deviations pairwise:

    • (-1 × -0.83) = 0.83

    • (0 × 0.17) = 0

    • (1 × 0.67) = 0.67

  5. Sum = 1.50

  6. Covariance = 1.50 / (3 – 1) = 0.75

A positive covariance of 0.75 suggests the stocks move in the same direction.

Importance of Covariance in Portfolio Management

Covariance is used to analyze how assets move relative to each other. Assets with low or negative covariance exhibit less synchronized movement, which can affect overall portfolio volatility.

Key uses in portfolio management:

1. Measures Co-Movement of Assets

Understanding whether assets move together helps assess diversification benefits.

2. Helps Identify Hedging Opportunities

A stock that moves opposite to another (negative covariance) is sometimes observed in hedging strategies.

3. Essential for Calculating Portfolio Variance

Portfolio variance formula uses individual variances plus covariances between all asset pairs.

4. Supports Asset Allocation Decisions

Investors may reduce exposure to assets with high positive covariance to manage correlated risks.

5. Used in Modern Portfolio Theory (MPT)

Harry Markowitz’s Efficient Frontier is built using covariance matrices to find optimal portfolios.

Without covariance, assessing risk relationships between assets would be nearly impossible.

Common Mistakes in Covariance Calculation

Covariance is simple in theory but often prone to errors when applied incorrectly. Common mistakes include:

1. Using Price Instead of Returns

Covariance must be calculated using returns, not raw prices. Using prices gives misleading results.

2. Incorrect Time Period Selection

Different timeframes (daily, monthly) produce different covariance values. Consistency is essential.

3. Not Standardising Data Before Comparison

If return scales differ significantly, covariance may appear large or small without meaning.

4. Misinterpreting Magnitude

Covariance values are unbounded. A large value does not necessarily mean a strong relationship.

5. Ignoring Sample Size Adjustments

Population vs. sample covariance differs. For sample data, always divide by (n – 1).

6. Confusing Covariance with Correlation

Correlation is scaled between -1 and +1. Covariance is not—an important distinction.

Avoiding these mistakes ensures more accurate portfolio risk analysis.

Conclusion & Key Takeaways

Covariance is a foundational concept in finance that helps investors understand the relationship between two assets’ returns. A positive covariance suggests the securities move together, while a negative covariance indicates they move in opposite directions.

Key takeaways:

  • Covariance measures how two stocks move relative to each other.

  • It is central to portfolio variance, diversification, and risk management.

  • It is calculated using return deviations and averaged over time.

  • Covariance alone does not indicate the strength of a relationship—only its direction.

  • Correlation is a standardised version of covariance.

  • Covariance is used to analyze the relationships between assets, supporting assessment of portfolio diversification and balance.

When applied correctly, covariance provides insights into asset relationships, influencing portfolio variability and potential performance.

Disclaimer

This content is for informational purposes only and the same should not be construed as investment advice. Bajaj Finserv Direct Limited shall not be liable or responsible for any investment decision that you may take based on this content.

FAQs

What is covariance?

Covariance is a statistical measure that indicates how the returns of two assets move in relation to each other, showing whether they tend to rise together, fall together, or behave independently.

Covariance is calculated by taking the deviations of each asset’s return from its average return, multiplying the paired deviations, summing the results, and dividing by (n − 1). This determines whether movements between the two assets are aligned.

Covariance shows the direction of the relationship between two assets but does not standardise the value. Correlation standardises the relationship on a scale from −1 to +1, indicating both direction and strength.

Covariance is important because it helps evaluate diversification benefits, understand co-movement risk, identify potential hedging relationships, and calculate portfolio variance in modern portfolio theory.

View More
Hi! I’m Anshika
Financial Content Specialist

Anshika brings 7+ years of experience in stock market operations, project management, and investment banking processes. She has led cross-functional initiatives and managed the delivery of digital investment portals. Backed by industry certifications, she holds a strong foundation in financial operations. With deep expertise in capital markets, she connects strategy with execution, ensuring compliance to deliver impact. 

Academy by Bajaj Markets

eye icon 80209
share icon

All Things Credit

Unlock the world of credit! From picking the perfect card to savvy loan management, navigate wisely.

Seasons 12
Episodes 56
Durations 3.0 Hrs
eye icon 45078
share icon

Money Management and Financial Planning

Money Management and Financial Planning covers personal finance basics, setting goals, budgeting...

Seasons 5
Episodes 19
Durations 1.1 Hrs
eye icon 21638
share icon

The Universe of Investments

Explore the investment cosmos! From beginner's guides to sharp-witted strategies, explore India's treasure trove of options.

Seasons 5
Episodes 23
Durations 1.5 Hrs
eye icon 34913
share icon

All Things Tax

Navigate the tax maze with ease! Uncover Income Tax 101, demystify jargon with Terms for Beginners, and choose between Old or New Regimes.

Seasons 6
Episodes 25
Durations 1.3 Hrs
eye icon 10423
share icon

Insurance Handbook

Discover essential insights on various types of insurance in India.

Seasons 2
Episodes 6
Durations 0.5 Hrs
eye icon 4419
share icon

Tech in Finance

Welcome to Tech in Finance, where we explore the exciting intersection of technology and finance...

Seasons 1
Episodes 5
Durations 0.3 Hrs
Home
Home
ONDC_BD_StealDeals
Steal Deals
Free CIBIL Score
CIBIL Score
Free Cibil
Accounts
Accounts
Explore
Explore

Our Products