Covariance matrices
A covariance matrix places the covariance of coordinates i and j in entry i,j, with variances on the diagonal.
On this page 9 sections
- Overview
- A covariance matrix stores the pairwise variation of a vector’s components
- Covariance is symmetric: swapping the two variable names does not change it
- Uniform vectors (X,Y)=(1,2),(3,6) have mean (2,4)
- PCA uses this joint variation to find directions of spread
- Key takeaway
- Further questions
- Sources & further reading
- Concept connections
01A covariance matrix stores the pairwise variation of a vector’s components#
A covariance matrix stores the pairwise variation of a vector’s components. Diagonal entries describe each feature’s own variance; off-diagonal entries describe pairs. It is a compact description of how a multifeature cloud spreads around its mean.
A covariance matrix keeps every coordinate pair in a fixed order. Diagonal entries are variances; off-diagonal entries are covariances.
For order , variances 4 and 9 and covariance , place 4 and 9 on the diagonal. Both off-diagonal entries are .
For two features with variances 4 and 9 and covariance , the matrix has rows and . Covariance is symmetric, so both off-diagonal entries match. The standard deviations are 2 and 3; putting those on the diagonal would confuse spread units with squared spread.
Order . Variances . Covariances: . Give covariance rows.
Show answer and explanation
Diagonal ; mirror .
02Covariance is symmetric: swapping the two variable names does not change it#
Covariance is symmetric: swapping the two variable names does not change it. Diagonal entries are variances and cannot be negative. A negative off-diagonal entry is allowed.
Order . Variances . Covariances: . Fix opposite signs. Give rows.
Show answer and explanation
Diagonal ; mirror .
03Uniform vectors (X,Y)=(1,2),(3,6) have mean (2,4)#
Uniform vectors have mean . Centered vectors are and . Their squared coordinates average to 1 and 4; their product averages to 2.
Uniform feature vectors : . Give covariance rows.
Show answer and explanation
Variances ; covariance .
04PCA uses this joint variation to find directions of spread#
PCA uses this joint variation to find directions of spread. A covariance matrix is not a table of causal effects, and its numerical size depends on feature units. Changing a unit rescales both that feature’s variance and its covariances with others.
Put variances on the diagonal; mirror each pair covariance.
- Assemble the covariance matrix of a finite random vector.
Further questions
Must every covariance-matrix entry be positive?
Sources & further reading
- [1]
- [2]Pishro-Nik, 6.1.5 Random Vectors ↗Textbook · Book