Sample Covariance
The sample covariance estimator uses the sample data for the expectation operator.The sample correlation is generated from the sample covariance.
Sample covariance is a statistic that measures how two variables move together, calculated from a sample of data rather than a whole population. It's a foundational tool in finance and statistics — the building block behind correlation, portfolio risk and much of modern investment theory. This guide explains what sample covariance is, how it's calculated, how to interpret it, and why it matters, building on the broader idea of covariance. It's a core quantitative topic, featured in qualifications like the FRM.
What is sample covariance?
Covariance measures the direction of the relationship between two variables — whether they tend to move in the same direction or opposite ones. Sample covariance is the version you calculate when you only have a sample of observations (a set of data drawn from a larger population), which is almost always the case in practice. For example, you might have two years of monthly returns for two shares and want to know how they have moved relative to each other.
The sign of the result is what you read first:
- Positive sample covariance: the two variables tend to move together — when one is above its average, the other tends to be too.
- Negative sample covariance: they tend to move in opposite directions — when one is above average, the other tends to be below.
- Near zero: there's little linear tendency for them to move together either way.
How sample covariance is calculated
The calculation captures, on average, how far the two variables stray from their means at the same time:
- Find the mean of each variable across the sample.
- For each observation, work out how far each variable is from its own mean, and multiply those two deviations together.
- Sum those products across all observations.
- Divide by n − 1 (one less than the number of observations).
That final step — dividing by n − 1 rather than n — is the key difference between sample covariance and population covariance. Using n − 1 (known as Bessel's correction) corrects for the fact that a sample tends to understate the true variability of the full population, giving a less biased estimate. When two deviations share the same sign they contribute a positive product; when they have opposite signs the product is negative — which is how the overall sign emerges.
Covariance and its limitation: enter correlation
Sample covariance tells you the direction of a relationship, but not its strength in any standardised way. Its size depends on the units of the variables, so a large covariance doesn't necessarily mean a strong relationship — it might just reflect large numbers. This is why covariance is usually converted into correlation, which rescales it to a fixed range of −1 to +1, making the strength of the relationship directly comparable across different pairs of variables.
Why it matters in finance
Sample covariance is central to portfolio theory. The risk of a portfolio depends not just on the risk of each individual asset but on how those assets move relative to each other — precisely what covariance measures. Combining assets whose returns have low or negative covariance is the statistical engine of diversification: it's how a portfolio can be less risky than the sum of its parts. Covariances between many assets are assembled into a covariance matrix, which underpins portfolio optimisation and risk models throughout the industry.
Why it matters for finance professionals
Anyone working in investment or risk needs to understand covariance. It's the measure that turns "these assets behave similarly" into a precise number, and it sits at the heart of how diversification and portfolio risk are quantified. Grasping sample covariance — and why it leads naturally to correlation — is fundamental to quantitative finance and a regularly examined topic in professional qualifications.
Frequently asked questions
What is sample covariance?
A statistic measuring how two variables move together, calculated from a sample of data. A positive value means they tend to move in the same direction; a negative value means opposite directions.
Why divide by n − 1?
Dividing by n − 1 (Bessel's correction) corrects the tendency of a sample to understate the full population's variability, giving a less biased estimate. Population covariance divides by n instead.
What's the difference between covariance and correlation?
Covariance shows the direction of a relationship but its size depends on the variables' units. Correlation rescales covariance to a fixed −1 to +1 range, so the strength of the relationship is directly comparable.
Why is covariance important in finance?
It measures how assets move relative to each other, which drives portfolio risk and diversification. Combining assets with low or negative covariance can reduce overall portfolio risk.
Build your quant skills with Learnsignal
Covariance is the foundation of diversification and portfolio risk. Learnsignal's tutor-led courses, including the FRM, develop the statistical and portfolio understanding that topics like this build on — with clear teaching that makes the maths genuinely click.
This page was last updated:
Owais Siddiqui
Expert Tutor at Learnsignal
Qualified professional with years of experience in teaching and helping students achieve their accounting qualifications.
View all posts by Owais Siddiqui

