Covariance Calculator

Covariance measures the degree to which two variables vary together. This calculator computes both sample and population covariance from paired data. Positive covariance indicates variables increase together; negative indicates they move in opposite directions. Covariance is the foundation for correlation and linear regression, though it is scale-dependent and less intuitive than correlation due to its dependence on units.

2.50
2.00

Covariance formulas

Sample Cov(X,Y) = Σ((xi - x_mean) * (yi - y_mean)) / (n - 1)
Population Cov(X,Y) = Σ((xi - x_mean) * (yi - y_mean)) / n

Interpreting covariance

  • Positive covariance: Variables tend to move together (both increase or both decrease).
  • Negative covariance: Variables move in opposite directions.
  • Zero covariance: No linear relationship between variables.
  • Magnitude: Larger absolute covariance indicates stronger relationship, but interpretation depends on data scale.
  • Use correlation instead: For comparing relationships across datasets, use correlation because it is scale-independent.

Covariance: frequently asked questions

What is covariance?

Covariance measures how two variables change together. Positive covariance means they increase together. Negative means one increases as the other decreases. Zero means no linear relationship. Unlike correlation, covariance is scale-dependent.

What is the difference between sample and population covariance?

Sample covariance divides by (n-1), providing an unbiased estimate when you have a sample. Population covariance divides by n, used when you have the entire population.

How does covariance relate to correlation?

Correlation = Covariance / (SD_x * SD_y). Correlation standardizes covariance by dividing by standard deviations, making it scale-free and easier to interpret (range -1 to 1).

Is covariance affected by the units of variables?

Yes, covariance depends on the scales of the variables. If you change units, covariance changes. Correlation is unaffected by unit changes, making it better for comparing relationships across different datasets.

Official sources

  • NIST/SEMATECH e-Handbook: NIST Handbook.
  • American Statistical Association: ASA.

Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.