Covariance Calculator
Sample covariance of paired data.
About this tool
Enter one x,y pair per line to get the sample covariance. The pairs (1,2), (2,3), (3,5), (4,7) have a covariance of 2.83333.
How to use
How it works
Covariance averages the products of each pair's deviations from their means, dividing by n − 1 for a sample. Here Σ(x − x̄)(y − ȳ) = 8.5 and n − 1 = 3, so 8.5 ÷ 3 = 2.83333. Its size depends on the units, so use correlation to compare strength.
cov(x, y) = Σ(x − x̄)(y − ȳ) ÷ (n − 1)
Worked example
Evenly spaced pairs
- Input
- (2,4), (4,6), (6,8)
- Output
- 4
- Walkthrough
- x̄ = 4, ȳ = 6. Products: (−2)(−2) + 0 + (2)(2) = 8. Divide by n − 1 = 2 to get 4.
Limitations
- Uses the sample formula (n − 1), not the population one.
- The value changes with units; it is not bounded between −1 and 1.
Questions
What is the covariance of (1,2), (2,3), (3,5), (4,7)?
What is the covariance of (2,4), (4,6), (6,8)?
What does a positive covariance mean?
Features
- Sample covariance
- Instant
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Derivative as a concept
Khan Academy
Calculus entry point for derivative-related tools.
Watch on YouTubeMean, Variance and Standard Deviation
StatQuest with Josh Starmer
Clear variance/SD explanation for spread calculators.
Watch on YouTube
- Correlation
Math is Fun
Correlation vs causation notes next to correlation tools.
- Standard Deviation and Variance
Math is Fun
Worked SD formulas that match sample/population toggles.