Share this free calculator
Send this tool to someone who needs the calculation.
How to use
Use this covariance calculator to compute sample covariance or population covariance for two equal-length datasets. Sample covariance uses Σ[(x−x̄)(y−ȳ)]/(n−1), while population covariance divides by n. The result shows the direction of joint variation, and Pearson correlation is included for scale-independent context.
- Enter X values.
- Enter Y values with the same count and matching order.
- Choose sample to divide by n−1 or population to divide by n.
- Review covariance, means and r for context.
How it is calculated
Example
Example: X={1,2,3,4,5} and Y={2,4,5,4,5}. In sample mode, mean X=3 and mean Y=4; paired deviations from those means are multiplied and summed before division by n−1.
Important notes
Do not compare covariance magnitudes directly across datasets with different units. Correlation standardizes the relationship to −1 through 1. Neither covariance nor correlation proves causation.
Worked examples and interpreting results
Pairs X=(1, 2, 3) and Y=(2, 4, 6) have summed deviation products 4. Sample covariance is 2 and population covariance about 1.3333.
| Case | Calculation | Result |
|---|---|---|
| Sample covariance | 4 ÷ (3 − 1) | 2 |
| Population covariance | 4 ÷ 3 | 1.333333 |
How to check the result
Enter equal-length lists in matching order, then compare sample and population. Covariance units multiply X and Y units; its value is not a standardized correlation restricted to −1 through 1.
Frequently asked questions
How do I calculate covariance?
Find the mean of X and Y, multiply each pair of deviations (x−x̄)(y−ȳ), sum those products, then divide by n−1 for a sample or n for a population. The calculator performs these steps automatically.
Sample versus population covariance?
Sample covariance divides by n−1; population covariance divides by n.
Does covariance have units?
Yes. Its unit is the product of the X and Y units.
Why show correlation too?
Correlation removes scale effects and provides context for covariance.
Does positive covariance mean a strong relationship?
Not necessarily; covariance magnitude depends on units.