Covariance Calculator
This covariance calculator works on two paired lists of the same length. Example: x = 1 to 5 and y = 2, 4, 5, 4, 5 have a sample covariance of 1.5.
Source: Wikipedia – Covariance. Updated: .
How it is calculated
Covariance measures whether two variables rise and fall together. If it is positive, large x values tend to go with large y values; if it is negative, the opposite holds; near 0 suggests no linear relationship.
Formula and steps
Find the means x̄ and ȳ. For every pair multiply the deviations (x − x̄) and (y − ȳ), add all products and divide by n − 1 for a sample or by n for a fully known population. Dividing the covariance by both standard deviations gives the correlation r.
Worked example
For x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5 we have x̄ = 3 and ȳ = 4. The products of deviations are 4, 0, 0, 0 and 2, which add up to 6. As a sample this gives cov = 6 / 4 = 1.5, as a population 6 / 5 = 1.2.
- The unit of covariance is the product of both units, such as kg·cm, so its size alone says little.
- The covariance of a series with itself is its variance.
Frequently asked questions
How do you calculate the covariance of two series?
Find both means, multiply the deviations of each pair, add all products and divide by n − 1 (sample) or n (population).
What does positive or negative covariance mean?
Positive means the series move in the same direction, negative in opposite directions. How strong the link is only shows in the correlation, which divides the covariance by both standard deviations.
Sample or population: which one do I use?
If you only hold a subset of the data, use the sample version with n − 1. The denominator n is correct only when you really have every pair of the population.
Sources and legal basis
As of: · Editorial policy
Related tools
- Correlation Coefficient CalculatorCorrelation coefficient calculator for paired data: Pearson r and Spearman ρ with p-value, confidence interval, R² and regression line. Paste a table.
- Standard deviation calculatorStandard deviation calculator for a list or frequency table: switch between sample (s) and population (σ), see every step in a table, plus a box plot.
- Average CalculatorAverage calculator: mean, median, mode and weighted average of your numbers with working and frequency table – plus the value needed for a target average.
- Sum of Squares CalculatorSum of squares calculator for a list of numbers: the sum of squared deviations Σ(x − x̄)², the raw sum Σx² and the variance, with steps and a built-in check.
- Standard Error CalculatorStandard error calculator for raw data or for standard deviation and sample size: SE = s / √n with steps, mean and variance shown for every result.
- Equation of a Line CalculatorEquation of a line from two points or from a point and slope: slope-intercept form, general form, parametric form, x-intercept and working shown at once.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- Residual CalculatorResidual calculator for linear regression: regression line, fitted value ŷ and residual y − ŷ for every data point, plus SSE, standard error and R².
- Spearman Rank Correlation CalculatorSpearman rank correlation calculator for two data lists: ranks, tied values with average ranks, Σd², the coefficient ρ and the full working shown step by step.