Covariance Calculator
Calculate sample or population covariance between two paired series, with the correlation coefficient. See how two variables move together.
Comma-separated, e.g. 2, 4, 6, 8.
Same count as X, e.g. 1, 3, 5, 7.
Covariance
6.6667
Correlation (r)
1
Pearson
Means
x̄ 5, ȳ 4
4 pairs
Positive covariance means the two series move together; negative means they move in opposite directions.
Last updated: August 2026
How this calculator is verified
Checked by True Calculator automated test suite on
- Formula verified against a published worked example in the automated test suite
- Edge cases (zero, negative, boundary and unit-mismatch inputs) covered by unit tests
The full verification method is on our how we verify page. Found an error? Tell us and we will re-check it.
When to Use This Calculator
Use the covariance calculator when you study how two variables co-move — stock prices against the index, rainfall against crop yield, ad spend against enquiries, or temperature against electricity demand. Portfolio and finance students across India use covariance to build the covariance matrix that underlies diversification and the capital asset pricing model, while analysts check whether two commodities or sectors tend to move together before pairing them in a strategy. The calculator gives both the raw covariance and the standardized correlation, so you see the direction and strength of the relationship in one screen. Because it offers sample and population modes, it matches the convention in statistical software and textbooks, letting you verify manual calculations from assignments or research reports quickly and reliably.
How to Use This Calculator
- Step 1: Enter the first variable's values in the X box, comma-separated.
- Step 2: Paste the paired values of the second variable in the Y box in the same order.
- Step 3: Choose sample or population depending on whether the data is a subset or the whole group.
- Step 4: Read the covariance, the correlation coefficient and the two means.
Worked Example
A dealer tracks four months of two commodities: X prices at 2, 4, 6, 8 and Y prices at 1, 3, 5, 7. In population mode the covariance is 5 and the correlation is exactly 1 — the series move in perfect lockstep. The sample covariance for the same data is 6.6667 because it divides by n−1 instead of n. A contrasting pair — X values 1, 3, 4, 5, 7 with Y values 5, 4, 2, 1, 0 — gives a population covariance of −3.6 and correlation −0.9705, a strong inverse relationship.
Tips and Common Mistakes
- •Tip 1: Interpret covariance with the correlation coefficient — covariance alone is scale-dependent and hard to judge.
- •Tip 2: Population mode suits full datasets like every trading day of a year; sample mode suits surveys and samples.
- •Tip 3: A near-zero covariance does not rule out a curved relationship — it only rules out a linear one.
- ✗Mistake 1: Comparing covariances of different datasets directly — the units and scale make the numbers non-comparable.
- ✗Mistake 2: Entering lists of unequal length; the pairing must be exact or the result is meaningless.
Frequently Asked Questions
What is covariance?
Covariance measures how two variables move together: positive values mean they tend to rise and fall together, negative values mean they move in opposite directions, and near zero means no consistent linear relationship. Unlike correlation, covariance is in the product of the two variables' units, so its size depends on scale.
What is the difference between covariance and correlation?
Correlation is covariance standardized by the two standard deviations, so it always lies between −1 and +1 and has no units. Covariance can be any number and is hard to compare across datasets. The calculator shows both: for the pairs (2,1), (4,3), (6,5), (8,7) the population covariance is 5 and the correlation is exactly 1.
How is sample covariance different?
Sample covariance divides the sum of cross-products by n−1 instead of n, mirroring the unbiased correction in sample variance. For the same four pairs, the population covariance is 5 but the sample covariance is 6.67. Use population when your data is the whole group, sample when it is a random sample of a larger group.
Can covariance be negative?
Yes — it is negative when higher values of one variable go with lower values of the other. For example, the pairs (1,5), (3,4), (4,2), (5,1), (7,0) give a population covariance of −3.6 with a correlation of about −0.97, a strong inverse relationship like price and quantity demanded.
Where is covariance used in practice?
Portfolio managers use the covariance matrix of stock returns to measure how assets move together before diversifying, and statisticians use it to build regression models. In India, analysts might study the covariance of monsoon rainfall with farm output, or of Sensex returns with gold returns, to understand which combinations reduce risk.
You might also need
Related calculators from other categories
Math
Midpoint Calculator
Find the midpoint between two points in 2D or 3D coordinates by averaging each pair of coordinates.
Math
Slope Calculator
Find the slope, angle, intercept and distance between two points on a graph. Get the line equation instantly.
Date
Age Difference Calculator
Find the age difference between two dates in years, months and days, plus total days, weeks and months. See who is older at a glance.
Date
Date Difference Calculator
Count the exact days, weeks, months, years and business days between two dates, with hours and minutes too. Perfect for deadlines, leave and projects.