statistics

*verified*Cite

While every effort has been made to follow citation style rules, there may be some discrepancies.Please refer to the appropriate style manual or other sources if you have any questions.

Select Citation Style

Feedback

Thank you for your feedback

Our editors will review what you’ve submitted and determine whether to revise the article.

*verified*Cite

While every effort has been made to follow citation style rules, there may be some discrepancies.Please refer to the appropriate style manual or other sources if you have any questions.

Select Citation Style

Feedback

Thank you for your feedback

Our editors will review what you’ve submitted and determine whether to revise the article.

Written by

Michael McDonough

Fact-checked by

The Editors of Encyclopaedia Britannica

Last Updated: •Article History

- Related Topics:
- Pearson’s correlation coefficient
- distribution function
- Spearman rank correlation coefficient

See all related content →

**covariance**, measure of the relationship between two random variables on the basis of their joint variability. Covariance primarily indicates the direction of a relationship and can be calculated by finding the expected value of the product of each variable’s deviations from its mean. Although its properties make covariance useful in calculating other statistical values, covariance is outclassed by measures such as correlation that show more precise information about the relationship between two variables. Despite its shortcomings, covariance still has applications in finance and science.

Covariance measures the joint variability of two random variables—that is, how much variables change together. This attribute is used to determine the direction of a relationship between two variables. However, the nature of the association does not come from the covariance’s magnitude but from its sign. If the covariance is positive, then the association between the two variables *X* and *Y* is positive, and greater values of *X* tend to occur along with greater values of *Y*. Conversely, if the covariance is negative, then the association between the two variables is negative, and they have an inverse relationship in which greater values of *X* tend to correspond with smaller values of *Y*. When the covariance is zero, the magnitude of a covariance is expressed in terms of the variables’ units and has no upper or lower bound, which limits its use as an indicator of the strength of the relationship between two variables.

If two variables have a nonzero covariance, they are considered to be dependent, wherein one variable has an effect on the other variable’s probability distribution. However, much care must be taken when using covariance to draw conclusions about independence. Although two independent variables always have a covariance of zero, the converse does not hold true. Simply because the covariance of two variables is equal to zero does not mean that they are independent of each other.

The covariance between two variables *X* and *Y*, Cov(*X*, *Y*), can be calculated by taking the expected value, or mean, *E* of the product of two values: the deviation of *X* from its mean μ_{X} and the deviation of *Y* from its mean μ_{Y}. That is, Cov(*X*, *Y*) = *E*[(*X* − μ_{X})(*Y* − μ_{Y})].The covariance can be also expressed as the expected value of the variables’ product minus the product of each variable’s expected value: Cov(*X*, *Y*) = *E*(*XY*) − *E*(*X*)*E*(*Y*).

Covariance is intrinsically related to correlation, another measure of the relationship between two variables. The correlation coefficient *r*, also known as Pearson’s r, is defined in terms of the covariance. Correlation is a normalized version of covariance and falls within the range of −1 and 1. The correlation coefficient is generally a better measure of the relationship between two variables. Not only does Pearson’s *r* use its sign to convey the direction of an association, but its magnitude also indicates the strength of the relationship between two variables, with 1 showing a perfect correlation between the two variables and −1 showing a perfect anticorrelation. Correlation does not depend on the variables’ units of measurement, which often makes it a more useful measure of association than covariance, whose magnitude is expressed in the product of the variables’ units. (For example, if one measured children’s ages in years and height in centimetres, the covariance would have the unusual and uninformative units of centimetre-years.)

While covariance may not be the most effective tool for conveying information about relationships between two variables, its properties allow it to be used to calculate other important statistical measures. The variance Var of a single variable can be expressed through the covariance between the variable and itself:Cov(*X*, *X*) = Var(*X*).Covariance can be also used to calculate the variance of a combination of two variables:Var(*X* + *Y*) = Var(*X*) + Var(*Y*) + 2Cov(*X*, *Y*).The previous property is a result of the covariance of linear combinations, which can be generally expressed as the following, where *V*, *W*, *X*, and *Y* are random variables and *a*, *b*, *c*, and *d* are constants:Cov(*aX* + *bY*, *cW* + *dV*) = *ac*Cov(*X*, *W*) + *ad*Cov(*X*, *V*) + *bc*Cov(*Y*, *W*) + *bd*Cov(*Y*, *V*).The correlation coefficient *r* even includes covariance in its numerator: *r* = Cov(*X*, *Y*)/Square root of√Var(*X*)Var(*Y*).

Special 67% offer for students! Finish the semester strong with Britannica.

Learn More

The applications of covariance extend outside pure mathematics. In finance, covariance is used to help diversify security holdings by determining whether stocks are closely related. Covariance matrices can also be used in principal component analysis, which is used to simplify the complexity of datasets. Covariance is also used in a variety of scientific fields. For example, in the Price equation, which describes evolutionary change, the covariance between a trait and fitness is used to define the action of selection.

Michael McDonough