Covariance measures the direction of the linear relationship between two variables by showing how they move together relative to their respective means. When both variables tend to be above their means at the same time, covariance is positive. When one tends to be above its mean while the other is below, covariance is negative. A covariance near zero indicates little or no linear relationship. Unlike correlation, covariance is not constrained to a fixed scale, so a covariance of 1.5 could represent a weak relationship if the variables have large standard deviations, or a strong one if they are tightly distributed. This is why covariance is often used as a building block for other statistics, such as the Pearson correlation coefficient, rather than as a standalone measure. The key distinction between sample and population covariance is the denominator: population covariance divides by n (the number of pairs), while sample covariance divides by n minus 1. The n minus 1 version applies Bessel's correction to give an unbiased estimate when your data are a sample drawn from a larger population. Enter your x and y values as comma-separated lists of equal length and the calculator returns both versions of covariance, the mean of each variable, and the number of pairs used in the calculation. It suits students, researchers, and data analysts who need to check the direction and raw magnitude of association between two continuous variables before computing correlation or building a regression model.
The calculator parses the two comma-separated lists and takes the shorter length as n. It computes the mean of x and the mean of y. For each pair it calculates (xi minus x-bar) times (yi minus y-bar) and sums those products. Population covariance is that sum divided by n. Sample covariance divides by n minus 1 instead, applying Bessel's correction to reduce bias when working with a sample rather than the whole population.
With x values 1, 2, 3, 4, 5 and y values 2, 4, 5, 4, 5, the mean of x is 3 and the mean of y is 4. The sum of (xi minus 3) times (yi minus 4) across all five pairs is (1-3)(2-4) + (2-3)(4-4) + (3-3)(5-4) + (4-3)(4-4) + (5-3)(5-4) = 4 + 0 + 0 + 0 + 2 = 6. Population covariance is 6 / 5 = 1.2000. Sample covariance is 6 / 4 = 1.5000. These match the default values pre-filled above.
If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.
Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.
Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.
All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.
Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.
Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.
Calculate.co.nz is hosted in Auckland by SiteHost New Zealand.
All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.
About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use
Reviewed and maintained. Last reviewed 2026-07-29 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.
© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.