ArticleslgStudy

mathematics

Covariance

Covariance is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Covariance rather than just read about it. In short: In probability theory and statistics, covariance is a measure of the joint variability of two random variables. The sign of the covariance shows the tendency in the linear relationship between the variables.

Covariance — main illustration
Covariance — illustration

Key takeaways

  • Covariance belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Covariance to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Covariance from memory before moving on to harder problems.

Reference excerpt

In probability theory and statistics, covariance is a measure of the joint variability of two random variables. The sign of the covariance shows the tendency in the linear relationship between the variables. Covariance is positive when variables tend to show similar behavior and negative when variables tend to show opposite behavior. The magnitude of the covariance is the geometric mean of the variances that are shared for the two random variables, where a larger magnitude means two variables more strongly depend on each other. Covariance has units of measurement, and the magnitude of the covariance is affected by said units. This means changing the units (e.g., from meters to millimeters) changes the covariance value proportionally, making it difficult to assess the strength of the relationship from the covariance alone. In some situations, it is desirable to compare the strength of the joint association between different pairs of random variables that do not necessarily have the same units. In those situations, we use the correlation coefficient, which normalizes the covariance to a value between −1 and 1 by dividing by the geometric mean of the total variances (i.e., the product of the standard deviations) for the two random variables. A distinction is made between (1) the covariance of two random variables, which is a population parameter that can be seen as a property of the joint probability distribution, and (2) the sample covariance, which, in addition to serving as a descriptor of the sample, also serves as an estimated value of the population parameter.

Definition For two jointly distributed real-valued random variables X and Y with finite second moments, the covariance is defined as the expected value (or mean) of the product of their deviations from their individual expected values: cov⁡(X,Y)=E⁡[(X−E⁡[X])(Y−E⁡[Y])] where E⁡[X] is the expected value of X, also known as the mean of X. The covariance is also sometimes denoted σXY or σ(X,Y), in analogy to variance. By using the linearity property of expectations, this can be simplified to the expected value of their product minus the product of their expected values: cov⁡(X,Y)=E⁡[(X−E⁡[X])(Y−E⁡[Y])]=E⁡[XY−XE⁡[Y]−E⁡[X]Y+E⁡[X]E⁡[Y]]=E⁡[XY]−E⁡[X]E⁡[Y]−E⁡[X]E⁡[Y]+E⁡[X]E⁡[Y]=E⁡[XY]−E⁡[X]E⁡[Y]. This identity is useful for mathematical derivations. From the viewpoint of numerical computation, however, it is susceptible to catastrophic cancellation (see the section on numerical computation below). The units of measurement of the covariance cov⁡(X,Y) are those of X times those of Y. By contrast, correlation coefficients, which depend on the covariance, are a dimensionless measure of linear dependence. (In fact, correlation coefficients can simply be understood as a normalized version of covariance.)

Complex random variables

The covariance between two complex random variables Z,W is defined as cov⁡(Z,W)=E⁡[(Z−E⁡[Z])(W−E⁡[W])‾]=E⁡[ZW‾]−E⁡[Z]E⁡[W‾] Notice the complex conjugation of the second factor in the definition. A related pseudo-covariance can also be defined.

Discrete random variables If the (real) random variable pair (X,Y) can take on the values (xi,yi) for i=1,…,n, with equal probabilities pi=1/n, then the covariance can be equivalently written in terms of the means E⁡[X] and E⁡[Y] as cov⁡(X,Y)=1n∑i=1n(xi−E(X))(yi−E(Y)). It can also be equivalently expressed, without directly referring to the means, as cov⁡(X,Y)=1n2∑i=1n∑j=1n12(xi−xj)(yi−yj)=1n2∑i∑j>i(xi−xj)(yi−yj). More generally, if there are n possible realizations of (X,Y), namely (xi,yi) but with possibly unequal probabilities pi for i=1,…,n, then the covariance is cov⁡(X,Y)=∑i=1npi(xi−E(X))(yi−E(Y)). In the case where two discrete random variables X and Y have a joint probability distribution, represented by elements pi,j corresponding to the joint probabilities of P(X=xi,Y=yj), the covariance is calculated using a double summation over the indices of the matrix: cov⁡(X,Y)=∑i=1n∑j=1npi,j(xi−E[X])(yj−E[Y]).

Examples Consider three independent random variables A,B,C and two constants q,r. X=qA+BY=rA+Ccov⁡(X,Y)=qrvar⁡(A) In the special case, q=1 and r=1, the covariance between X and Y is just the variance of A and the name covariance is entirely appropriate.

Suppose that X and Y have the following joint probability mass function, in which the six central cells give the discrete joint probabilities f(x,y) of the six hypothetical realizations (x,y)∈S={(5,8),(6,8),(7,8),(5,9),(6,9),(7,9)}:

X can take on three values (5, 6 and 7) while Y can take on two (8 and 9). Their means are μX=5(0.3)+6(0.4)+7(0.1+0.2)=6 and μY=8(0.4+0.1)+9(0.3+0.2)=8.5. Then, cov⁡(X,Y)=σXY=∑(x,y)∈Sf(x,y)(x−μX)(y−μY)=(0)(5−6)(8−8.5)+(0.4)(6−6)(8−8.5)+(0.1)(7−6)(8−8.5)+(0.3)(5−6)(9−8.5)+(0)(6−6)(9−8.5)+(0.2)(7−6)(9−8.5)=−0.1.

Properties

Covariance with itself The variance is a special case of the covariance in which the two variables are identical: cov⁡(X,X)=var⁡(X)≡σ2(X)≡σX2.

Covariance of linear combinations If X, Y, W, and V are real-valued random variables and a,b,c,d are real-valued constants, then the following facts are a consequence of the definition of covariance: cov⁡(X,a)=0cov⁡(X,X)=var⁡(X)cov⁡(X,Y)=cov⁡(Y,X)cov⁡(aX,bY)=abcov⁡(X,Y)cov⁡(X+a,Y+b)=cov⁡(X,Y)cov⁡(aX+bY,cW+dV)=accov⁡(X,W)+adcov⁡(X,V)+bccov⁡(Y,W)+bdcov⁡(Y,V) For a sequence X1,…,Xn of real-valued random variables and constants a1,…,an, we have var⁡(∑i=1naiXi)=∑i=1nai2var⁡(Xi)+2∑i,j:i<jaiajcov⁡(Xi,Xj)=∑i,jaiajcov⁡(Xi,Xj)

Hoeffding's covariance identity A useful identity to compute the covariance between two random variables X,Y is the Hoeffding's covariance identity: cov⁡(X,Y)=∫ℝ∫ℝ(F(X,Y)(x,y)−FX(x)FY(y))dxdy where F(X,Y)(x,y) is the joint cumulative distribution function of the random vector (X,Y) and FX(x),FY(y) are the marginals.

Uncorrelatedness and independence

… excerpt ends here. Continue reading the full article.

Illustrations

Covariance: Geometric interpretation of the covariance example. Each cuboid is the axis-aligned bounding box of its point (x, y, f (x, y)), and the X and Y means (magenta point). The covariance is the sum of the volumes of the cuboids in the 1st and 3rd quadrants (red) and in the 2nd and 4th (blue).
Geometric interpretation of the covariance example. Each cuboid is the axis-aligned bounding box of its point (x, y, f (x, y)), and the X and Y means (magenta point). The covariance is the sum of the volumes of the cuboids in the 1st and 3rd quadrants (red) and in the 2nd and 4th (blue).

Worked examples

Example 1 — a first encounter with Covariance

Start with the simplest possible case. Write down what Covariance claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Covariance before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Covariance ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Covariance

In research
Covariance appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Covariance in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Covariance is common in secondary-school and first-year university syllabi. It links to neighbouring topics Algebra of random variables, Covariance and correlation, so understanding it makes those chapters shorter.
In everyday life
Look for Covariance outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Covariance” →

How to study Covariance in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Covariance means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Covariance out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Covariance in simple terms?

In probability theory and statistics, covariance is a measure of the joint variability of two random variables. The sign of the covariance shows the tendency in the linear relationship between the variables.

Why does Covariance matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Covariance?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Covariance.

Tags

  • Algebra of random variables
  • Covariance and correlation

Keep exploring