Covariance Calculator

Sample covariance of paired data.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

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

1
Step 1
Type one x,y pair per line, like 2,4.
2
Step 2
Press Calculate.
3
Step 3
Read the sample covariance.

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)?
2.83333.
What is the covariance of (2,4), (4,6), (6,8)?
The sample covariance of those three pairs is 4.
What does a positive covariance mean?
The two variables tend to rise and fall together.

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 YouTube
  • Mean, Variance and Standard Deviation

    StatQuest with Josh Starmer

    Clear variance/SD explanation for spread calculators.

    Watch on YouTube