Calculate sample covariance between two datasets ? aligned with the standard ProMathTools calculator layout.
Commas, spaces, or semicolons between values
Commas, spaces, or semicolons between values
Covariance measures how two variables move together. When values of X that are above their average tend to pair with values of Y that are above their average, the covariance is positive. When high X values pair with low Y values, it is negative, and when there is no consistent linear pattern it sits near zero. This calculator returns the sample covariance, which divides by n ? 1 and is the standard choice when your data is a sample drawn from a larger population. It is a building block for correlation, linear regression, portfolio risk in finance, and principal component analysis.
The first list of numbers. Separate values with commas, spaces, or semicolons.
The second list, paired with X by position. It must contain exactly as many values as X, and at least two.
x? = ?x? / n ? = ?y? / n cov(X, Y) = ?[(x? ? x?)(y? ? ?)] / (n ? 1) (sample) cov(X, Y) = ?[(x? ? x?)(y? ? ?)] / n (population)
The i-th paired observations from the two datasets.
The arithmetic means of X and Y.
The number of pairs. Sample covariance divides by n ? 1 to correct bias.
Means: x? = (1 + 2 + 3) / 3 = 2 and ? = (2 + 3 + 5) / 3 ? 3.3333. Deviation products: (1 ? 2)(2 ? 3.3333) = 1.3333, (2 ? 2)(3 ? 3.3333) = 0, (3 ? 2)(5 ? 3.3333) = 1.6667. Sum = 3. Sample covariance = 3 / (3 ? 1) = 1.5. The positive sign says Y tends to rise as X rises.
Means: x? = 2.5 and ? = 5. Products: (?1.5)(3) = ?4.5, (?0.5)(1) = ?0.5, (0.5)(0) = 0, (1.5)(?4) = ?6. Sum = ?11. Sample covariance = ?11 / 3 ? ?3.6667. The negative sign shows the variables move in opposite directions.
Covariance measures the linear relationship between two datasets. A positive value means the variables tend to rise together, a negative value means one tends to fall as the other rises, and a value near zero suggests no linear pattern.
Sample covariance is the sum of (xi minus the mean of x) times (yi minus the mean of y), divided by n minus 1. For population data, divide by n instead.
It uses the sample formula and divides by n - 1, which is the right choice when your data is a sample of a larger group. To get the population value, multiply the result by (n - 1) / n.
Covariance is measured in the product of the two variables' units, so its size is hard to interpret. Correlation divides covariance by both standard deviations, producing a unitless number between -1 and 1 that shows the strength of the relationship.
Yes. Negative covariance means the variables move in opposite directions. A covariance of zero means there is no linear relationship, although a non-linear relationship could still exist.
Type the numbers for X and Y in the two boxes, separated by commas, spaces, semicolons, or new lines. Both lists must have the same number of values, with at least two in each.
Covariance measures the linear relationship between two datasets
The formula for covariance is cov(X, Y) = Σ[(xi - x̄)(yi - ȳ)] / (n - 1)
cov(X, Y) = Σ[(xi - x̄)(yi - ȳ)] / (n - 1)
Calculate the covariance between two datasets: X = [1, 2, 3], Y = [2, 3, 5]
Enter the datasets in the input fields and click calculate to get the covariance
© 2025-2026 PromathTools. All rights reserved.
Built by KruskalCode – SaaS & Automation Experts · EverydayDevTools