Mathematics · Statistics

Covariance Calculator

Calculate population covariance for three paired observations.

Runs locally
Your numbers

Inputs and results stay in this browser. Change one value at a time to explore the relationship.

Your inputCalculatedPassed forward in chains
Population covariance1.333333
Mean x2
Mean y4

Calculation steps

  1. Means: x̄=2, ȳ=4.
  2. Average cross-deviation=1.3333333333333333.

Understand Covariance

One idea, three depths

Choose how deeply to explain Covariance

Calculate population covariance for three paired observations.

Age 5Explain it to a 5-year-oldStart with a picture

Imagine using Covariance to answer this question: calculate population covariance for three paired observations? Enter x₁, y₁, x₂, and 3 other inputs; the calculator shows Population covariance. For example: Pairs (1,2),(2,4),(3,6) have positive covariance 4/3. The answer tells you Population covariance.

Age 15Explain it to a 15-year-oldConnect it to the formula

Covariance indicates whether paired variables tend to move in the same or opposite directions. The rule is cov(X,Y)=Σ(xᵢ−x̄)(yᵢ−ȳ)/N. Its input values are x₁, y₁, x₂, y₂, x₃, y₃, and the main result is Population covariance. For example: Pairs (1,2),(2,4),(3,6) have positive covariance 4/3.

CollegeExplain it at college levelState the model precisely

This calculator evaluates the stated covariance relation over the valid real-number domain stated below. The implemented relation is cov(X,Y)=Σ(xᵢ−x̄)(yᵢ−ȳ)/N, evaluated from x₁, y₁, x₂, y₂, x₃, y₃ to produce Population covariance. Covariance indicates whether paired variables tend to move in the same or opposite directions. Covariance magnitude depends on units and is not a standardized strength measure.

Inputs and valid domain

  • x₁ must be a finite real number.
  • y₁ must be a finite real number.
  • x₂ must be a finite real number.
  • y₂ must be a finite real number.
  • x₃ must be a finite real number.
  • y₃ must be a finite real number.

Important boundary: Covariance magnitude depends on units and is not a standardized strength measure.

The formula

cov(X,Y)=Σ(xᵢ−x̄)(yᵢ−ȳ)/N

How the calculator works through it

It substitutes x₁, y₁, x₂, y₂, x₃, y₃ into the formula and exposes every numerical step above. The main output is Population covariance, accompanied by Mean x, Mean y.

Read the result correctly

The Population covariance is the direct answer to “calculate population covariance for three paired observations.” Read it with the units shown beside the inputs; a sign, angle, percentage or rate changes what the number means.

A worked check

Pairs (1,2),(2,4),(3,6) have positive covariance 4/3.

Where this model stops being reliable

Covariance magnitude depends on units and is not a standardized strength measure.

Learn it by changing one value

Begin with the worked example, then change one value while keeping the others fixed. Compare the new result and calculation steps to identify which part of the formula changed.

Dictionary terms behind this calculator

Before studying the codeWhat you should know firstUse the calculator immediately, or check the foundations before reading the implementation.

These foundations help you understand why Covariance works. They never block the calculator, and “optional” means useful context rather than a hidden requirement.

Hard requirements

  • Reading formulas and substituting values

    Covariance uses cov(X,Y)=Σ(xᵢ−x̄)(yᵢ−ȳ)/N. You need to recognise what each side represents before substituting the stated inputs or rearranging the relationship.

    Review this foundation about 4 min

Strong support

  • Averages and representative values

    Representative values help you judge what the Covariance inputs summarise and what the result can legitimately describe.

    Review this foundation about 5 min

Optional enrichment

  • Spread and measurement variation

    Variation is not always part of the Covariance formula, but it helps you judge how stable a reported result may be.

    Review this foundation about 6 min
Learn the missing foundationsI already know these — show the code

Mathematics → algorithm → program

Implement this calculation in code

These are direct reference implementations of the calculator's principal relationship and first output. They run locally and include a small known-answer check where the language supports it.

Algorithm

  1. Read x₁, y₁, x₂, y₂, x₃, y₃.
  2. Evaluate the principal relationship: cov(X,Y)=Σ(xᵢ−x̄)(yᵢ−ȳ)/N.
  3. Return Population covariance and check the domain conditions described above.
Python
            from math import *

def covariance_three_pairs(v1, v2, v3, v4, v5, v6) -> float:
    return (((((v1 - (((v1 + v3) + v5) / 3.0)) * (v2 - (((v2 + v4) + v6) / 3.0))) + ((v3 - (((v1 + v3) + v5) / 3.0)) * (v4 - (((v2 + v4) + v6) / 3.0)))) + ((v5 - (((v1 + v3) + v5) / 3.0)) * (v6 - (((v2 + v4) + v6) / 3.0)))) / 3.0)

assert abs(covariance_three_pairs(1, 2, 2, 4, 3, 6) - 1.3333333333333333) < 1e-6 * max(1.0, abs(1.3333333333333333))
          
Current calculator valuesUpdates when you change an input above.
              
            
C
            #include <assert.h>
#include <math.h>

double covariance_three_pairs(double v1, double v2, double v3, double v4, double v5, double v6) {
    return (((((v1 - (((v1 + v3) + v5) / 3.0)) * (v2 - (((v2 + v4) + v6) / 3.0))) + ((v3 - (((v1 + v3) + v5) / 3.0)) * (v4 - (((v2 + v4) + v6) / 3.0)))) + ((v5 - (((v1 + v3) + v5) / 3.0)) * (v6 - (((v2 + v4) + v6) / 3.0)))) / 3.0);
}

int main(void) {
    const double expected = 1.3333333333333333;
    const double actual = covariance_three_pairs(1, 2, 2, 4, 3, 6);
    assert(fabs(actual - expected) < 1e-6 * fmax(1.0, fabs(expected)));
}
          
Current calculator valuesUpdates when you change an input above.
              
            
C++
            #include <cassert>
#include <cmath>
#include <numbers>

double covariance_three_pairs(double v1, double v2, double v3, double v4, double v5, double v6) {
    return (((((v1 - (((v1 + v3) + v5) / 3.0)) * (v2 - (((v2 + v4) + v6) / 3.0))) + ((v3 - (((v1 + v3) + v5) / 3.0)) * (v4 - (((v2 + v4) + v6) / 3.0)))) + ((v5 - (((v1 + v3) + v5) / 3.0)) * (v6 - (((v2 + v4) + v6) / 3.0)))) / 3.0);
}

int main() {
    constexpr double expected = 1.3333333333333333;
    const double actual = covariance_three_pairs(1, 2, 2, 4, 3, 6);
    assert(std::fabs(actual - expected) < 1e-6 * std::fmax(1.0, std::fabs(expected)));
}
          
Current calculator valuesUpdates when you change an input above.
              
            
Linux x86-64 assembly

x86-64 NASM · System V ABI · Linux · SSE2 with libm where required

            ; double covariance_three_pairs(double v1, double v2, double v3, double v4, double v5, double v6)
; Linux x86-64 NASM · System V ABI · first eight doubles in xmm0–xmm7
global covariance_three_pairs
section .text

covariance_three_pairs:
    push rbp
    mov rbp, rsp
    sub rsp, 352
    movsd [rbp-8], xmm0
    movsd [rbp-16], xmm1
    movsd [rbp-24], xmm2
    movsd [rbp-32], xmm3
    movsd [rbp-40], xmm4
    movsd [rbp-48], xmm5
    movsd xmm0, [rbp-8]
    addsd xmm0, [rbp-24]
    movsd [rbp-112], xmm0
    movsd xmm0, [rbp-112]
    addsd xmm0, [rbp-40]
    movsd [rbp-104], xmm0
    mov rax, 0x4008000000000000
    movq xmm0, rax
    movsd [rbp-120], xmm0
    movsd xmm0, [rbp-104]
    divsd xmm0, [rbp-120]
    movsd [rbp-96], xmm0
    movsd xmm0, [rbp-8]
    subsd xmm0, [rbp-96]
    movsd [rbp-88], xmm0
    movsd xmm0, [rbp-16]
    addsd xmm0, [rbp-32]
    movsd [rbp-152], xmm0
    movsd xmm0, [rbp-152]
    addsd xmm0, [rbp-48]
    movsd [rbp-144], xmm0
    mov rax, 0x4008000000000000
    movq xmm0, rax
    movsd [rbp-160], xmm0
    movsd xmm0, [rbp-144]
    divsd xmm0, [rbp-160]
    movsd [rbp-136], xmm0
    movsd xmm0, [rbp-16]
    subsd xmm0, [rbp-136]
    movsd [rbp-128], xmm0
    movsd xmm0, [rbp-88]
    mulsd xmm0, [rbp-128]
    movsd [rbp-80], xmm0
    movsd xmm0, [rbp-8]
    addsd xmm0, [rbp-24]
    movsd [rbp-200], xmm0
    movsd xmm0, [rbp-200]
    addsd xmm0, [rbp-40]
    movsd [rbp-192], xmm0
    mov rax, 0x4008000000000000
    movq xmm0, rax
    movsd [rbp-208], xmm0
    movsd xmm0, [rbp-192]
    divsd xmm0, [rbp-208]
    movsd [rbp-184], xmm0
    movsd xmm0, [rbp-24]
    subsd xmm0, [rbp-184]
    movsd [rbp-176], xmm0
    movsd xmm0, [rbp-16]
    addsd xmm0, [rbp-32]
    movsd [rbp-240], xmm0
    movsd xmm0, [rbp-240]
    addsd xmm0, [rbp-48]
    movsd [rbp-232], xmm0
    mov rax, 0x4008000000000000
    movq xmm0, rax
    movsd [rbp-248], xmm0
    movsd xmm0, [rbp-232]
    divsd xmm0, [rbp-248]
    movsd [rbp-224], xmm0
    movsd xmm0, [rbp-32]
    subsd xmm0, [rbp-224]
    movsd [rbp-216], xmm0
    movsd xmm0, [rbp-176]
    mulsd xmm0, [rbp-216]
    movsd [rbp-168], xmm0
    movsd xmm0, [rbp-80]
    addsd xmm0, [rbp-168]
    movsd [rbp-72], xmm0
    movsd xmm0, [rbp-8]
    addsd xmm0, [rbp-24]
    movsd [rbp-288], xmm0
    movsd xmm0, [rbp-288]
    addsd xmm0, [rbp-40]
    movsd [rbp-280], xmm0
    mov rax, 0x4008000000000000
    movq xmm0, rax
    movsd [rbp-296], xmm0
    movsd xmm0, [rbp-280]
    divsd xmm0, [rbp-296]
    movsd [rbp-272], xmm0
    movsd xmm0, [rbp-40]
    subsd xmm0, [rbp-272]
    movsd [rbp-264], xmm0
    movsd xmm0, [rbp-16]
    addsd xmm0, [rbp-32]
    movsd [rbp-328], xmm0
    movsd xmm0, [rbp-328]
    addsd xmm0, [rbp-48]
    movsd [rbp-320], xmm0
    mov rax, 0x4008000000000000
    movq xmm0, rax
    movsd [rbp-336], xmm0
    movsd xmm0, [rbp-320]
    divsd xmm0, [rbp-336]
    movsd [rbp-312], xmm0
    movsd xmm0, [rbp-48]
    subsd xmm0, [rbp-312]
    movsd [rbp-304], xmm0
    movsd xmm0, [rbp-264]
    mulsd xmm0, [rbp-304]
    movsd [rbp-256], xmm0
    movsd xmm0, [rbp-72]
    addsd xmm0, [rbp-256]
    movsd [rbp-64], xmm0
    mov rax, 0x4008000000000000
    movq xmm0, rax
    movsd [rbp-344], xmm0
    movsd xmm0, [rbp-64]
    divsd xmm0, [rbp-344]
    movsd [rbp-56], xmm0
    movsd xmm0, [rbp-56]
    leave
    ret
          
Current calculator valuesUpdates when you change an input above.
              
            
MATLAB
            function result = covariance_three_pairs(v1, v2, v3, v4, v5, v6)
    result = (((((v1 - (((v1 + v3) + v5) / 3.0)) * (v2 - (((v2 + v4) + v6) / 3.0))) + ((v3 - (((v1 + v3) + v5) / 3.0)) * (v4 - (((v2 + v4) + v6) / 3.0)))) + ((v5 - (((v1 + v3) + v5) / 3.0)) * (v6 - (((v2 + v4) + v6) / 3.0)))) / 3.0);
end
          
Current calculator valuesUpdates when you change an input above.
              
            
Wolfram Language
            ClearAll[mwCalculate];
mwCalculate[v1_, v2_, v3_, v4_, v5_, v6_] := (((((v1 - (((v1 + v3) + v5) / 3.0)) * (v2 - (((v2 + v4) + v6) / 3.0))) + ((v3 - (((v1 + v3) + v5) / 3.0)) * (v4 - (((v2 + v4) + v6) / 3.0)))) + ((v5 - (((v1 + v3) + v5) / 3.0)) * (v6 - (((v2 + v4) + v6) / 3.0)))) / 3.0);
          
Current calculator valuesUpdates when you change an input above.
              
            

Continue in mathematical software

The downloaded file includes your current inputs and first calculated result. It is created locally.

Floating-point answers can differ slightly by language, compiler and processor. Compare within a suitable tolerance rather than assuming every decimal representation will be identical.

Supporting sourcesAcademic referencesPrimary standards, textbooks and complete citations

Standards, reading and academic references

Use the calculator as the worked interaction, then consult the primary standards and academic textbooks listed below. MW SysArc links to the original sources; the explanation on this page is original and does not reproduce them.

Introductory Statistics 2e

Read the free OpenStax statistics textbook
Cite this book
APA 7
Illowsky, B., & Dean, S. (2023). Introductory statistics 2e. OpenStax. https://openstax.org/books/introductory-statistics-2e/pages/1-introduction
MLA 9
Illowsky, Barbara, and Susan Dean. Introductory Statistics 2e. OpenStax, 2023, https://openstax.org/books/introductory-statistics-2e/pages/1-introduction.
Chicago author-date
Illowsky, Barbara, and Susan Dean. 2023. Introductory Statistics 2e. Houston, TX: OpenStax. https://openstax.org/books/introductory-statistics-2e/pages/1-introduction.

OpenStax entries are free to read online. Follow the licence shown on each linked source before redistributing or adapting its content.

Reuse the page responsiblyCite this pageAPA, MLA, Chicago, Harvard, BibTeX and RIS

These formats cite this calculator page itself. They are separate from the academic references above, which support the mathematical method and terminology.

APA 7

MW SysArc. (2026, July 21). Covariance Calculator. MW SysArc Tools. https://math.mwsysarc.com/statistics/covariance-three-pairs

MLA 9

MW SysArc. “Covariance Calculator.” MW SysArc Tools, 21 July 2026, https://math.mwsysarc.com/statistics/covariance-three-pairs. Accessed 31 Aug. 2026.

Chicago 17

MW SysArc. “Covariance Calculator.” MW SysArc Tools. Published July 21, 2026. Accessed August 31, 2026. https://math.mwsysarc.com/statistics/covariance-three-pairs.

Harvard

MW SysArc (2026) ‘Covariance Calculator’, MW SysArc Tools. Published 21 July 2026. Available at: https://math.mwsysarc.com/statistics/covariance-three-pairs (Accessed: 31 August 2026).

BibTeX and RIS records

BibTeX

@misc{mwsysarc_covariance_three_pairs_2026,
  author = {{MW SysArc}},
  title = {Covariance Calculator},
  howpublished = {MW SysArc Tools},
  year = {2026},
  url = {https://math.mwsysarc.com/statistics/covariance-three-pairs},
  note = {Published July 21, 2026; accessed August 31, 2026}
}

RIS

TY  - ELEC
AU  - MW SysArc
TI  - Covariance Calculator
T2  - MW SysArc Tools
PY  - 2026
DA  - 2026-07-21
Y2  - 2026-08-31
UR  - https://math.mwsysarc.com/statistics/covariance-three-pairs
N1  - Published July 21, 2026
ER  -

Clear answers

Frequently asked questions

What does the Covariance do?

Calculate population covariance for three paired observations.

How does the Covariance work?

The calculator applies cov(X,Y)=Σ(xᵢ−x̄)(yᵢ−ȳ)/N. Covariance indicates whether paired variables tend to move in the same or opposite directions.

What can I learn from the Covariance?

It connects the mathematical rule to your chosen numbers and shows each calculation step. Change one input at a time to see how the result responds.

Does MW SysArc receive or store what I enter?

No. The calculation runs locally in your browser. MW SysArc does not receive or store your calculation inputs.

How should I use the result?

Use the steps to understand the method, then verify important school or professional work using the notation and rounding rules required in your setting.

Last reviewed . Calculations tested .

MW SysArc Certified