ArticleslgStudy

mathematics

Covariance matrix

Covariance matrix 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 matrix rather than just read about it. In short: In probability theory and statistics, a covariance matrix (also known as auto-covariance matrix, dispersion matrix, variance matrix, or variance–covariance matrix) is a square matrix giving the covariance between each pair of elements of a given random vector. Intuitively, the covariance matrix generalizes the notion of variance to multiple dimensions.

Covariance matrix — main illustration
Covariance matrix — illustration

Key takeaways

  • Covariance matrix 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 matrix to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Covariance matrix from memory before moving on to harder problems.

Reference excerpt

In probability theory and statistics, a covariance matrix (also known as auto-covariance matrix, dispersion matrix, variance matrix, or variance–covariance matrix) is a square matrix giving the covariance between each pair of elements of a given random vector. Intuitively, the covariance matrix generalizes the notion of variance to multiple dimensions. As an example, the variation in a collection of random points in two-dimensional space cannot be characterized fully by a single number, nor would the variances in the x and y directions contain all of the necessary information; a 2×2 matrix would be necessary to fully characterize the two-dimensional variation. Any covariance matrix is symmetric and positive semi-definite and its main diagonal contains variances (i.e., the covariance of each element with itself). The covariance matrix of a random vector 𝐗 is typically denoted by K𝐗𝐗, Σ or S.

Definition Throughout this article, boldfaced unsubscripted 𝐗 and 𝐘 are used to refer to random vectors, and Roman subscripted Xi and Yi are used to refer to scalar random variables. If the entries in the column vector 𝐗=(X1,X2,…,Xn)𝖳 are random variables, each with finite variance and expected value, then the covariance matrix K𝐗𝐗 is the matrix whose (i,j) entry is the covariance KXiXj=cov⁡[Xi,Xj]=E⁡[(Xi−E⁡[Xi])(Xj−E⁡[Xj])] where the operator E denotes the expected value (mean) of its argument.

Conflicting nomenclatures and notations Nomenclatures differ. Some statisticians, following the probabilist William Feller in his two-volume book An Introduction to Probability Theory and Its Applications, call the matrix K𝐗𝐗 the variance of the random vector 𝐗, because it is the natural generalization to higher dimensions of the 1-dimensional variance. Others call it the covariance matrix, because it is the matrix of covariances between the scalar components of the vector 𝐗. var⁡(𝐗)=cov⁡(𝐗,𝐗)=E⁡[(𝐗−E⁡[𝐗])(𝐗−E⁡[𝐗])𝖳]. Both forms are quite standard, and there is no ambiguity between them. The matrix K𝐗𝐗 is also often called the variance-covariance matrix, since the diagonal terms are in fact variances. By comparison, the notation for the cross-covariance matrix between two vectors is cov⁡(𝐗,𝐘)=K𝐗𝐘=E⁡[(𝐗−E⁡[𝐗])(𝐘−E⁡[𝐘])𝖳].

Properties

Relation to the autocorrelation matrix The auto-covariance matrix K𝐗𝐗 is related to the autocorrelation matrix R𝐗𝐗 by K𝐗𝐗=E⁡[(𝐗−E⁡[𝐗])(𝐗−E⁡[𝐗])𝖳]=R𝐗𝐗−E⁡[𝐗]E⁡[𝐗]𝖳 where the autocorrelation matrix is defined as R𝐗𝐗=E⁡[𝐗𝐗𝖳].

Relation to the correlation matrix

An entity closely related to the covariance matrix is the matrix of Pearson product-moment correlation coefficients between each of the random variables in the random vector 𝐗, which can be written as corr⁡(𝐗)=(diag⁡(K𝐗𝐗))−12K𝐗𝐗(diag⁡(K𝐗𝐗))−12, where diag⁡(K𝐗𝐗) is the matrix of the diagonal elements of K𝐗𝐗 (i.e., a diagonal matrix of the variances of Xi for i=1,…,n). Equivalently, the correlation matrix can be seen as the covariance matrix of the standardized random variables Xi/σ(Xi) for i=1,…,n. corr⁡(𝐗)=[1E⁡[(X1−μ1)(X2−μ2)]σ(X1)σ(X2)⋯E⁡[(X1−μ1)(Xn−μn)]σ(X1)σ(Xn)E⁡[(X2−μ2)(X1−μ1)]σ(X2)σ(X1)1⋯E⁡[(X2−μ2)(Xn−μn)]σ(X2)σ(Xn)⋮⋮⋱⋮E⁡[(Xn−μn)(X1−μ1)]σ(Xn)σ(X1)E⁡[(Xn−μn)(X2−μ2)]σ(Xn)σ(X2)⋯1]. Each element on the principal diagonal of a correlation matrix is the correlation of a random variable with itself, which always equals 1. Each off-diagonal element is between −1 and +1 inclusive.

Inverse of the covariance matrix The inverse of this matrix, K𝐗𝐗−1, if it exists, is the inverse covariance matrix, also known as the precision matrix (or concentration matrix). Just as the covariance matrix can be written as the rescaling of a correlation matrix by the marginal variances: cov⁡(𝐗)=[σx10σx2⋱0σxn] ×[1ρx1,x2⋯ρx1,xnρx2,x11⋯ρx2,xn⋮⋮⋱⋮ρxn,x1ρxn,x2⋯1] ×[σx10σx2⋱0σxn] So, using the idea of partial correlation, and partial variance, the inverse covariance matrix can be expressed analogously: cov⁡(𝐗)−1=[1σx1∣x2…01σx2∣x1,x3…⋱01σxn∣x1…xn−1] ×[1−ρx1,x2∣x3…⋯−ρx1,xn∣x2…xn−1−ρx2,x1∣x3…1⋯−ρx2,xn∣x1,x3…xn−1⋮⋮⋱⋮−ρxn,x1∣x2…xn−1−ρxn,x2∣x1,x3…xn−1⋯1] ×[1σx1∣x2…01σx2∣x1,x3…⋱01σxn∣x1…xn−1] This duality motivates a number of other dualities between marginalizing and conditioning for Gaussian random variables.

Basic properties For K𝐗𝐗=var⁡(𝐗)=E⁡[(𝐗−E⁡[𝐗])(𝐗−E⁡[𝐗])𝖳] and 𝝁𝐗=E⁡[𝐗], where 𝐗=(X1,…,Xn)𝖳 is an n-dimensional random variable, the following basic properties apply:

K𝐗𝐗=E⁡(𝐗𝐗𝖳)−𝝁𝐗𝝁𝐗𝖳 K𝐗𝐗 is positive-semidefinite, i.e. 𝐚TK𝐗𝐗𝐚≥0for all 𝐚∈ℝn

K𝐗𝐗 is symmetric, i.e. K𝐗𝐗𝖳=K𝐗𝐗 For any constant (i.e. non-random) m×n matrix 𝐀 and constant m×1 vector 𝐚, one has var⁡(𝐀𝐗+𝐚)=𝐀var⁡(𝐗)𝐀𝖳 If 𝐘 is another random vector with the same dimension as 𝐗, then var⁡(𝐗+𝐘)=var⁡(𝐗)+cov⁡(𝐗,𝐘)+cov⁡(𝐘,𝐗)+var⁡(𝐘) where cov⁡(𝐗,𝐘) is the cross-covariance matrix of 𝐗 and 𝐘.

Block matrices The joint mean 𝝁 and joint covariance matrix 𝜮 of 𝐗 and 𝐘 can be written in block form 𝝁=[𝝁X𝝁Y],𝜮=[K𝐗𝐗K𝐗𝐘K𝐘𝐗K𝐘𝐘] where K𝐗𝐗=var⁡(𝐗), K𝐘𝐘=var⁡(𝐘) and K𝐗𝐘=K𝐘𝐗𝖳=cov⁡(𝐗,𝐘). K𝐗𝐗 and K𝐘𝐘 can be identified as the variance matrices of the marginal distributions for 𝐗 and 𝐘 respectively. If 𝐗 and 𝐘 are jointly normally distributed, 𝐗,𝐘∼ 𝒩(𝝁,𝜮⁡), then the conditional distribution for 𝐘 given 𝐗 is given by 𝐘∣𝐗∼ 𝒩(𝝁𝐘|𝐗,K𝐘|𝐗), defined by conditional mean 𝝁𝐘|𝐗=𝝁𝐘+K𝐘𝐗K𝐗𝐗−1(𝐗−𝝁𝐗) and conditional variance K𝐘|𝐗=K𝐘𝐘−K𝐘𝐗K𝐗𝐗−1K𝐗𝐘. The matrix K𝐘𝐗K𝐗𝐗−1 is known as the matrix of regression coefficients, while in linear algebra K𝐘|𝐗 is the Schur complement of K𝐗𝐗 in 𝜮. The matrix of regression coefficients may often be given in transpose form, K𝐗𝐗−1K𝐗𝐘, suitable for post-multiplying a row vector of explanatory variables 𝐗𝖳 rather than pre-multiplying a column vector 𝐗. In this form they correspond to the coefficients obtained by inverting the matrix of the normal equations of ordinary least squares (OLS).

… excerpt ends here. Continue reading the full article.

Illustrations

Covariance matrix: A bivariate Gaussian probability density function centered at (0, 0), with covariance matrix given by
[10.50.51]
A bivariate Gaussian probability density function centered at (0, 0), with covariance matrix given by [10.50.51]
Covariance matrix: Sample points from a bivariate Gaussian distribution with a standard deviation of 3 in roughly the lower left–upper right direction and of 1 in the orthogonal direction. Because the x and y components co-vary, the variances of x and y do not fully describe the distribution. A 2×2 covariance matrix is needed; the directions of the arrows correspond to the eigenvectors of this covariance matrix and their lengths to the square roots of the eigenvalues.
Sample points from a bivariate Gaussian distribution with a standard deviation of 3 in roughly the lower left–upper right direction and of 1 in the orthogonal direction. Because the x and y components co-vary, the variances of x and y do not fully describe the distribution. A 2×2 covariance matrix is needed; the directions of the arrows correspond to the eigenvectors of this covariance matrix and their lengths to the square roots of the eigenvalues.
Covariance matrix illustration
Covariance matrix: Figure 1: Construction of a partial covariance map of N2 molecules undergoing Coulomb explosion induced by a free-electron laser.[13] Panels a and b map the two terms of the covariance matrix, which is shown in panel c. Panel d maps common-mode correlations via intensity fluctuations of the laser. Panel e maps the partial covariance matrix that is corrected for the intensity fluctuations. Panel f shows that 10% overcorrection improves the map and makes ion-ion correlations clearly visible. Owing to momentum conservation these correlations appear as lines approximately perpendicular to the autocorrelation line (and to the periodic modulations which are caused by detector ringing).
Figure 1: Construction of a partial covariance map of N2 molecules undergoing Coulomb explosion induced by a free-electron laser.[13] Panels a and b map the two terms of the covariance matrix, which is shown in panel c. Panel d maps common-mode correlations via intensity fluctuations of the laser. Panel e maps the partial covariance matrix that is corrected for the intensity fluctuations. Panel f shows that 10% overcorrection improves the map and makes ion-ion correlations clearly visible. Owing to momentum conservation these correlations appear as lines approximately perpendicular to the autocorrelation line (and to the periodic modulations which are caused by detector ringing).

Worked examples

Example 1 — a first encounter with Covariance matrix

Start with the simplest possible case. Write down what Covariance matrix 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 matrix 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 matrix 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 matrix

In research
Covariance matrix 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 matrix 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 matrix is common in secondary-school and first-year university syllabi. It links to neighbouring topics Covariance and correlation, Matrices (mathematics), Summary statistics, so understanding it makes those chapters shorter.
In everyday life
Look for Covariance matrix 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 matrix” →

How to study Covariance matrix in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Covariance matrix 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 matrix out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Covariance matrix in simple terms?

In probability theory and statistics, a covariance matrix (also known as auto-covariance matrix, dispersion matrix, variance matrix, or variance–covariance matrix) is a square matrix giving the covariance between each pair of elements of a given random vector. Intuitively, the covariance matrix gen…

Why does Covariance matrix 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 matrix?

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 matrix.

Tags

  • Covariance and correlation
  • Matrices (mathematics)
  • Summary statistics

Keep exploring