Covariance Calculator
Enter two paired data sets to calculate their covariance.
Result
How it is calculated
Enter the X list and the Y list; values can be separated by commas or spaces. They must have the same count, at least two pairs, and every item must be a number. The tool finds the two means, multiplies each pair of deviations and adds them: S = Σ (xi − x̄)(yi − ȳ). Sample mode divides by n − 1, population mode divides by n. A mode other than population is treated as sample. The result is rounded to two decimals, so a very small covariance such as that of values near 0.001 shows as 0.00. The unit is the unit of X times the unit of Y. The tool also shows the number of pairs. It does not give a correlation coefficient. Row order matters, because values are paired by position.
Worked example
X is the weekly study hours 12, 15, 11, 18, 14 and Y is the grades 3.1, 3.8, 2.9, 4.4, 3.6. The means are 14 and 3.56. Deviations of X: −2, 1, −3, 4, 0. Deviations of Y: −0.46, 0.24, −0.66, 0.84, 0.04. Products: 0.92, 0.24, 1.98, 3.36, 0, which add up to 6.5. Sample mode divides by n − 1 = 4: 6.5 ÷ 4 = 1.625, shown as 1.63 from 5 pairs. Population mode would divide by 5 and give 1.30.
Common mistakes
- Typing a decimal comma in a list, such as 3,1 for 3.1. A comma separates values, so 3,1 becomes two numbers and the pair count no longer matches.
- Giving lists of different length, or a text entry like x in the list. Either returns no result.
- Choosing population mode for data that is only a sample. Population mode divides by n, so the figure is smaller than the sample one, here 1.30 instead of 1.63.
- Reading covariance as the strength of a relationship. Its size depends on the units, so use correlation to compare relationships, and only the sign tells the direction.
- Entering the X and Y values in different orders. They are paired by position, so a shuffled Y list gives a different and meaningless answer.
About this calculator
Covariance measures the direction in which two variables move together: a positive covariance means that when one variable is above its mean, the other tends to be above its mean too, while a negative covariance means they tend to move in opposite directions. It is computed as the average of the products of each variable's deviation from its own mean, using either the population formula (dividing by n) or the sample formula (dividing by n − 1, Bessel's correction) depending on whether the data represents an entire population or a sample drawn from it.
Covariance is the building block behind the Pearson correlation coefficient (correlation is covariance normalized by the two variables' standard deviations) and underlies core techniques in finance — such as portfolio variance and the covariance matrix used in Modern Portfolio Theory to diversify risk between assets — as well as in statistics, machine learning (principal component analysis), and the sciences wherever analysts need to quantify how two measured quantities co-vary.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Be the first to comment.