Skip to main content
Statistics LibreTexts

6.2: Covariance

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)

    Covariance is a simple measure of the way two variables move together, or “co-vary”. The covariance of two variables, XX and YY, can be expressed in population notation as:


    Therefore, the covariance between XX and YY is simply the product of the variation of XX around its expected value, and the variation of YY around its expected value. The sample covariance is expressed as:


    Covariance can be positive, negative, or zero. If the covariance is positive both variables move in the same direction, meaning if XX increases YY increases or if XX decreases YY decreases. Negative covariance means that the variables move in opposite directions; if XX increases YY decreases. Finally, zero covariance indicates that there is no covariance between XX and YY.

    6.2: Covariance is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Jenkins-Smith et al. via source content that was edited to conform to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?