Direct comparison
Covariance vs Correlation Matrix: Formula & Rules
Compare covariance vs correlation matrix structures in quantitative analysis, covering scale invariance, PCA behavior, and the sandwich conversion formula.
Written and maintained by CASRAI Editorial Board
Last updated
How do Covariance Matrix (S) and Correlation Matrix (R) compare side by side?
The table below compares Covariance Matrix (S) and Correlation Matrix (R) across 10 dimensions, from mathematical definition & matrix formulation to decision guide: when to choose each matrix.
Side-by-side comparison
| Dimension | Covariance Matrix (S) | Correlation Matrix (R) |
|---|---|---|
| Mathematical Definition & Matrix Formulation | The sample covariance matrix S (dispersion matrix) is a square p × p symmetric matrix computed for p continuous variables across n observations. Each entry s_ij represents sample covariance: s_ij = [1 / (n - 1)] Σ_{k=1}^n (x_{ki} - x̄_i)(x_{kj} - x̄_j). In matrix notation, S = [1 / (n - 1)] X_cᵀ X_c, where X_c is the mean-centered data matrix. S is positive semi-definite and symmetric. | The sample correlation matrix R is a square p × p symmetric matrix representing pairwise Pearson correlation coefficients: r_ij = s_ij / (s_i · s_j). In matrix algebra, R = D⁻¹ S D⁻¹, where D = diag(s₁, ..., s_p) is the diagonal matrix of standard deviations. Like S, R is symmetric and positive semi-definite, but standardized so every variable exhibits unit variance. |
| Diagonal Elements (Self-Variability) | Main diagonal entries s_ii (where i = j) represent sample variances s_i² = Var(X_i). Values are strictly non-negative (s_ii ≥ 0) and retain squared measurement units (such as meters squared, kilograms squared, or dollars squared), varying across variables. | Main diagonal entries r_ii represent self-correlations: r_ii = Corr(X_i, X_i) = s_i² / s_i² = 1.0. Every diagonal element is identically 1.0 across all p dimensions, discarding absolute scale to show each variable is perfectly collinear with itself. |
| Off-Diagonal Elements & Mathematical Bounds | Off-diagonal entries s_ij (i ≠ j) represent pairwise covariances. Values are symmetric (s_ij = s_ji) and unbounded in magnitude across (-∞, +∞), constrained only by the Cauchy-Schwarz bound: |s_ij| ≤ √(s_ii · s_jj). Raw scale prevents direct strength comparisons. | Off-diagonal entries r_ij (i ≠ j) represent Pearson correlation coefficients bounded strictly within [-1.0, +1.0]. A value of +1.0 indicates perfect positive linearity, -1.0 indicates perfect negative linearity, and 0 indicates no linear association. |
| Measurement Units & Scale Invariance | Scale-dependent. Diagonal entries carry units squared (e.g., cm²), while off-diagonal entries carry cross-product units (e.g., kg · m). Multiplying variable X by constant c scales its variance by c² and its covariances by c, altering all numeric values. | Scale-invariant. Correlation coefficients are dimensionless pure numbers. Multiplying any variable by a positive constant c leaves all correlation coefficients r_ij unchanged because scaling factors cancel in numerator and denominator. |
| Mathematical Interconversion (Sandwich Transformation) | Reconstructed from correlation matrix R via pre- and post-multiplication by diagonal standard deviations: S = D R D, where D = diag(s₁, ..., s_p). Cannot be recovered from R alone without the standard deviation vector. | Derived directly from covariance matrix S using the matrix sandwich formula: R = D⁻¹ S D⁻¹, where D⁻¹ = diag(1/s₁, ..., 1/s_p). In element-wise form, r_ij = s_ij / √(s_ii · s_jj), requiring no external data. |
| Trace & Total Variance Decomposition | Trace Tr(S) = Σ_{i=1}^p s_ii equals the sum of all variable variances, representing total sample variance. In eigenvalue decomposition, Σ_{i=1}^p λ_i = Tr(S). Total variance depends directly on the measurement units chosen. | Trace Tr(R) = Σ_{i=1}^p 1.0 = p is identically equal to the number of variables p. In eigenvalue decomposition, Σ_{i=1}^p λ_i = p. Total standardized variance is fixed at p, with each variable contributing 1.0 unit. |
| Determinant & Multidimensional Dispersion | Generalized sample variance |S| = det(S), representing the squared hypervolume of the sample data swarm. If variables are collinear, det(S) = 0. The determinant scales by c^{2p} under scalar multiplication. | Generalized sample correlation |R| = det(R), bounded between 0 and 1. Value is 1.0 when all variables are mutually uncorrelated (R = I) and approaches 0 as collinearity increases. Used in Bartlett's sphericity test. |
| Dimension Reduction (PCA & Factor Analysis) | PCA on S maximizes raw unstandardized variance. High-variance variables dominate leading principal components, which can distort findings if units differ arbitrarily. Valid only when variables share identical, comparable physical units. | PCA on R standardizes all variables to unit variance (z-scores) before extraction. Prevents high-variance variables from dominating components, making it standard practice across psychometrics, econometrics, and biomedical research. |
| Empirical Sensitivity & Rescaling Robustness | Sensitive to measurement scale shifts, but essential in statistical distance modeling—such as Mahalanobis generalized distance D_M² = (x - μ)ᵀ S⁻¹ (x - μ), Linear Discriminant Analysis, and multivariate normal likelihoods. | Robust to linear scale changes and location shifts. Ideal for screening multicollinearity (VIFs, condition indices) and building network models, but discards absolute process capability and physical variance. |
| Decision Guide: When to Choose Each Matrix | Choose covariance matrix when: (1) variables share identical units (e.g., millimeters or hertz); (2) raw variance carries domain meaning (e.g., financial risk in portfolio optimization); (3) running unstandardized SEM; or (4) computing Mahalanobis distance. | Choose correlation matrix when: (1) variables are measured on different physical scales (e.g., weight, blood pressure, age); (2) conducting PCA or Factor Analysis to ensure equal initial weighting; or (3) reporting standard association tables in APA style. |
Sources
- NIST/SEMATECH e-Handbook Section 6.5.4.1 (https://www.itl.nist.gov/div898/handbook/pmc/section5/pmc541.htm)
- UC Berkeley Data 140 Section 13 (https://data140.org/textbook/content/chapter-13/covariance/)
- BIPM JCGM 100:2008 (https://www.bipm.org/en/committees/jc/jcgm/publications)
- Gaston Sanchez Chapter 9 Covariance and Correlation (https://www.gastonsanchez.com/matrix4sl/covariance.html)
- Rice University OpenStax Section 12.3 (https://openstax.org/details/books/introductory-statistics-2e)
- NIST/SEMATECH e-Handbook Section 6.5.5 (https://www.itl.nist.gov/div898/handbook/pmc/section5/pmc55.htm)
Ask CASRAI · full access
Ask about Covariance vs Correlation Matrix: Formula & Rules
Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.
An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.
Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
Works on this site and inside Claude, Cursor and the AI tools you already use.
Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.
Common questions
Common questions about Covariance Matrix (S) vs Correlation Matrix (R)
How do correlation and covariance relate?
+
Covariance and correlation measure linear association between two variables, but correlation is the standardized form of covariance. Mathematically, Pearson correlation r is calculated by dividing covariance s_xy by the product of individual standard deviations: r_xy = s_xy / (s_x · s_y). Covariance retains original measurement units and is unbounded, whereas correlation is dimensionless and bounded within [-1.0, +1.0]. Both always share the same sign. At the matrix level, this relationship is expressed as R = D⁻¹ S D⁻¹, where S is the covariance matrix and D is the diagonal matrix of standard deviations.
What is a correlation matrix example?
+
A correlation matrix is a square, symmetric table displaying pairwise Pearson correlation coefficients. In the three-variable benchmark from NIST/SEMATECH e-Handbook Section 6.5.4.1 measuring object dimensions (Length X₁, Width X₂, Height X₃), the 3 × 3 correlation matrix R is: row 1 (Length) = [1.0000, 0.5669, 0.5337]; row 2 (Width) = [0.5669, 1.0000, 0.7782]; row 3 (Height) = [0.5337, 0.7782, 1.0000]. Diagonal elements equal exactly 1.0000, while off-diagonals show Width and Height have the strongest linear association (r₂₃ = 0.7782).
What is a covariance matrix in simple terms?
+
In simple terms, a covariance matrix is a grid summarizing the spreads and relationships of several measurements simultaneously. The main diagonal (top-left to bottom-right) contains individual variances, showing how much each variable spreads around its mean. The off-diagonal cells show pairwise covariances, indicating whether pairs move together in the same direction (positive) or opposite directions (negative). Because the covariance between A and B equals that between B and A, the matrix is symmetric.
What is covariance in simple terms?
+
Covariance is a statistical metric of how two variables change together. If higher values of one variable correspond to higher values of another (e.g., study hours and exam scores), covariance is positive. If higher values of one correspond to lower values of the other (e.g., vehicle speed and fuel economy), covariance is negative. When no linear relationship exists, covariance is zero. Unlike correlation, covariance is expressed in compound units (e.g., hour-points), so its magnitude depends on the measurement scale.
What is the difference between covariance and correlation matrix?
+
The primary difference is standardization. A covariance matrix preserves raw measurement scales: its diagonal contains sample variances in squared units, and off-diagonal cells contain unbounded covariances in cross-product units. A correlation matrix standardizes all variables by dividing covariances by standard deviations: its diagonal entries are fixed at 1.0, and off-diagonal cells are bounded between -1.0 and +1.0. Correlation matrices enable direct comparison across disparate scales, while covariance matrices preserve absolute physical dispersion.
What is the formula to convert a covariance matrix to a correlation matrix?
+
To convert covariance matrix S to correlation matrix R, use the sandwich transformation R = D⁻¹ S D⁻¹, where D = diag(s₁, ..., s_p) is the diagonal matrix of standard deviations, and D⁻¹ = diag(1/s₁, ..., 1/s_p) contains reciprocal standard deviations. Element-wise, each entry is r_ij = s_ij / √(s_ii · s_jj). Conversely, to reconstruct covariance matrix S from correlation matrix R, multiply by standard deviations: S = D R D.
When should researchers use a covariance matrix versus a correlation matrix in PCA?
+
Researchers should use a correlation matrix in PCA when variables are measured in different units (e.g., age, income, blood pressure) or on arbitrary survey scales. This standardizes all variables to unit variance, preventing high-variance variables from dominating components. Researchers should use a covariance matrix in PCA only when all variables share identical physical units and variance differences represent meaningful substantive dispersion that should be preserved (NIST e-Handbook Section 6.5.5).
Can a covariance matrix or correlation matrix have negative eigenvalues?
+
In theoretical populations and complete sample data, neither matrix can have negative eigenvalues because both are mathematically positive semi-definite (all λ_i ≥ 0). However, negative eigenvalues can emerge empirically when correlation matrices are computed using pairwise deletion of missing data, mixing polychoric and Pearson correlations, or applying post-hoc adjustments. Such non-positive definite matrices require smoothing algorithms (e.g., nearPD) before factor extraction.
Data: Covariance Matrix vs Correlation Matrix: Mathematical and Structural Properties
Comparative dataset compiling mathematical definitions, algebraic boundaries, matrix transformation formulas, and analytical selection criteria for sample covariance matrices (S) and correlation matrices (R) across multivariate statistics. Synthesized from NIST/SEMATECH e-Handbook Section 6.5.4.1, Gaston Sanchez Chapter 9, and UC Berkeley Data 140 Section 13.
Period covered: 2026. Coverage: Global / Quantitative Research.
| Analytical Dimension | Covariance Matrix (S) | Correlation Matrix (R) | Matrix Algebra Formulation | Scale Invariance Status |
|---|---|---|---|---|
| Diagonal Elements | Individual sample variances s_i² = Var(X_i); strictly non-negative real values | Standardized self-correlations r_ii = 1.0; identically equal to 1 across all dimensions | diag(S) = [s₁², s₂², ..., s_p²] vs diag(R) = [1, 1, ..., 1] | Scale-dependent (S) vs Scale-invariant (R) |
| Off-Diagonal Elements | Pairwise sample covariances s_ij; unbounded in (-∞, +∞), bounded by Cauchy-Schwarz | Pearson correlation coefficients r_ij; strictly bounded in closed interval [-1.0, +1.0] | |s_ij| ≤ √(s_ii · s_jj) vs -1.0 ≤ r_ij ≤ +1.0 | Scale-dependent (S) vs Scale-invariant (R) |
| Matrix Trace Property | Tr(S) = sum of all variable variances; represents total sample variance of multivariate system | Tr(R) = sum of diagonal ones; identically equal to number of variables p | Tr(S) = Σ s_i² vs Tr(R) = p | Scale-dependent (S) vs Fixed at dimension p (R) |
| Matrix Interconversion | Recoverable from R only with known standard deviation vector D: S = D R D | Derived directly from S via reciprocal standard deviation matrix: R = D⁻¹ S D⁻¹ | R = D⁻¹ S D⁻¹ and S = D R D where D = diag(s₁, ..., s_p) | Bidirectional transformation requiring diagonal scale vector |
| Scalar Multiplication Effect | Multiplying variable X_i by constant c scales variance by c² and covariances by c | Multiplying variable X_i by constant c leaves all correlation entries r_ij unchanged | Var(cX) = c²Var(X) vs Corr(cX, Y) = Corr(X, Y) for c > 0 | Scale-variant (S) vs Completely scale-invariant (R) |
| Determinant Interpretation | Generalized sample variance |S| = det(S); squared volume of data hyperellipsoid | Generalized sample correlation |R| = det(R); bounded in [0, 1], tests sphericity | 0 ≤ det(S) < ∞ vs 0 ≤ det(R) ≤ 1.0 | Scales by c^(2p) (S) vs Scale-invariant (R) |
| Principal Component Analysis | Maximizes raw unstandardized variance; leading PCs dominated by large-scale features | Standardizes variables to unit variance; leading PCs reflect true correlation patterns | S v = λ v vs R v = λ v where Σ λ_i(R) = p | Scale-dependent components (S) vs Invariant to units (R) |
| APA 7th Edition Reporting | Italicized Roman s_ij or cov; requires leading zero before decimal (e.g., cov = 0.42) | Italicized Roman r_ij; omits leading zero because bounded by 1.0 (e.g., r = .57) | cov(X, Y) = 0.42 vs r(48) = .57, p < .001 | Leading zero required (S) vs Leading zero omitted (R) |
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods Section 6.5.4.1 (accessed 2026-11-23)
- Gaston Sanchez: Chapter 9 Covariance and Correlation (accessed 2026-11-23)
- UC Berkeley Data 140 Section 13: Covariance (accessed 2026-11-23)
- Rice University OpenStax Introductory Statistics 2e (accessed 2026-11-23)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







