Table of Contents
- What Is Covariance?
- Key Takeaways
- Understanding Covariance
- Formula for Covariance
- Types of Covariance
- Applications of Covariance
- Covariance vs. Variance
- Covariance vs. Correlation
- Example of Covariance Calculation
- What Does a Covariance of 0 Mean?
- What Is Covariance vs. Variance?
- What Is the Difference Between Covariance and Correlation?
- How Is a Covariance Calculated?
- The Bottom Line
What Is Covariance?
Let me explain covariance directly: it's a statistical measurement that shows the relationship between two variables, and in finance, I usually see it applied to the returns of two assets. As a tool, covariance tells you how much these variables change together. If you get a positive covariance, the asset returns are moving in the same direction; a negative one means they're going opposite ways. You calculate it by looking at standard deviations from expected returns or by multiplying the correlation between the variables by each one's standard deviation.
Key Takeaways
Covariance calculates the relationship between two random variables, so when two stocks move together, they have positive covariance, and when they move inversely, it's negative. Remember, this is different from the correlation coefficient, which measures the strength of that relationship. In modern portfolio theory, covariance helps decide which securities belong in a portfolio. You can reduce risk and volatility by pairing assets with negative covariance.
Understanding Covariance
Covariance looks at how the mean values of two random variables move together. Take stocks, for instance: if stock A's return goes up whenever stock B's does, and the same when they drop, that's positive covariance. In finance, we use covariances to diversify holdings. Beyond finance, you'll find covariance in statistics and machine learning too.
Formula for Covariance
When you have price data from a stock or fund, use this formula to calculate covariance: Covariance = Σ [(Ret_abc - Avg_abc) × (Ret_xyz - Avg_xyz)] / (Sample Size - 1), where Ret_abc is the day's return for ABC stock, Avg_abc is ABC's average return over the period, Ret_xyz is for XYZ stock, Avg_xyz is its average, and Sample Size is the number of days sampled. This setup lets you compute it step by step with your data.
Types of Covariance
The covariance equation determines if two variables move in the same or opposite directions, based on whether the value is positive or negative. For positive covariance, the variables tend to be higher or lower together—if stock one is above average when stock two is, and vice versa, the data points slope upward on a graph. Negative covariance means an inverse relationship: when one is below average, the other is above, and so on.
Applications of Covariance
Covariance plays a big role in finance and modern portfolio theory. In the capital asset pricing model, for example, it helps calculate beta, which measures a security's volatility against the market—drawing from covariance to assess risk. Portfolio theory uses it to lower overall risk through diversification informed by covariance. If assets have similar covariances, that doesn't diversify much, so mix in varying ones for better protection against volatility.
Covariance vs. Variance
Covariance relates to variance, which measures the spread of data points around a mean. Variance looks at one axis, while covariance checks the directional tie between two variables. In investing, covariance shows how assets perform relative to each other—positive means they do well together, negative means opposites, which investors use for diversification.
Covariance vs. Correlation
Covariance differs from correlation: it measures direction, but correlation measures strength via a coefficient from -1 to +1. Covariance doesn't indicate strength; for that, use correlation. A coefficient near +1 or -1 shows a strong link, while near zero means a weak one.
Example of Covariance Calculation
Let's walk through an example with four days of returns for stocks ABC and XYZ: Day 1: 1.2% and 3.1%; Day 2: 1.8% and 4.2%; Day 3: 2.2% and 5.0%; Day 4: 1.5% and 4.2%. First, find averages: ABC 1.675%, XYZ 4.125%. Then compute deviations and products for each day, sum them to 0.943, and divide by 3 (sample size minus 1) to get 0.314. This positive covariance suggests similar return patterns.
What Does a Covariance of 0 Mean?
A zero covariance means no clear directional relationship—the variables could pair high with high or low just as easily.
What Is Covariance vs. Variance?
Both measure data distribution, but variance is for one variable's closeness to the average, while covariance is the directional relationship between two—positive for same-direction moves, negative for opposites.
What Is the Difference Between Covariance and Correlation?
Covariance gives direction; correlation gives strength, always between -1 and +1, with extremes showing strong ties.
How Is a Covariance Calculated?
Take differences from means for each variable, multiply them, sum across data points, and divide by sample size minus one.
The Bottom Line
Covariance is a vital statistical metric for comparing variable relationships, and in investing, it helps identify diversifying assets for portfolios.
Other articles for you

Momentum trading involves capitalizing on the speed of price changes in securities to profit from ongoing trends using technical tools.

A middleman acts as an intermediary in transactions or supply chains, facilitating deals between buyers and sellers for a fee, though the internet has enabled more direct sales.

Rent control is a government program that limits landlord rent charges to keep housing affordable, though it's controversial and limited in the US.

Near-Field Communication (NFC) is a short-range wireless technology enabling devices to exchange data quickly and securely for payments, sharing, and more.

Accounting policies are the specific procedures a company uses to prepare its financial statements while adhering to broader accounting principles.

Functional currency is the primary currency a company uses for its business operations and financial reporting, requiring translation of foreign transactions according to accounting standards.

This text explains what headhunters are, their roles in recruiting talent for employers, how they get paid, and key considerations for working with them.

Imprest is a fixed-balance cash account for managing small business expenses, replenished regularly to prevent unauthorized spending and ensure oversight.

The sharing economy enables peer-to-peer transactions of underused assets via online platforms, facing growth, criticisms, and alternatives like the gift economy.

MRP II is an advanced system for optimizing manufacturing resources through integrated planning and data processing.