Skip to main content
v2026.11,986 entries · CC-BY 4.0

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

DimensionCovariance Matrix (S)Correlation Matrix (R)
Mathematical Definition & Matrix FormulationThe 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 BoundsOff-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 InvarianceScale-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 DecompositionTrace 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 DispersionGeneralized 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 RobustnessSensitive 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 MatrixChoose 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.

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.

Covariance Matrix vs Correlation Matrix: Mathematical and Structural Properties
Analytical DimensionCovariance Matrix (S)Correlation Matrix (R)Matrix Algebra FormulationScale Invariance Status
Diagonal ElementsIndividual sample variances s_i² = Var(X_i); strictly non-negative real valuesStandardized self-correlations r_ii = 1.0; identically equal to 1 across all dimensionsdiag(S) = [s₁², s₂², ..., s_p²] vs diag(R) = [1, 1, ..., 1]Scale-dependent (S) vs Scale-invariant (R)
Off-Diagonal ElementsPairwise sample covariances s_ij; unbounded in (-∞, +∞), bounded by Cauchy-SchwarzPearson 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.0Scale-dependent (S) vs Scale-invariant (R)
Matrix Trace PropertyTr(S) = sum of all variable variances; represents total sample variance of multivariate systemTr(R) = sum of diagonal ones; identically equal to number of variables pTr(S) = Σ s_i² vs Tr(R) = pScale-dependent (S) vs Fixed at dimension p (R)
Matrix InterconversionRecoverable from R only with known standard deviation vector D: S = D R DDerived 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 EffectMultiplying variable X_i by constant c scales variance by c² and covariances by cMultiplying variable X_i by constant c leaves all correlation entries r_ij unchangedVar(cX) = c²Var(X) vs Corr(cX, Y) = Corr(X, Y) for c > 0Scale-variant (S) vs Completely scale-invariant (R)
Determinant InterpretationGeneralized sample variance |S| = det(S); squared volume of data hyperellipsoidGeneralized sample correlation |R| = det(R); bounded in [0, 1], tests sphericity0 ≤ det(S) < ∞ vs 0 ≤ det(R) ≤ 1.0Scales by c^(2p) (S) vs Scale-invariant (R)
Principal Component AnalysisMaximizes raw unstandardized variance; leading PCs dominated by large-scale featuresStandardizes variables to unit variance; leading PCs reflect true correlation patternsS v = λ v vs R v = λ v where Σ λ_i(R) = pScale-dependent components (S) vs Invariant to units (R)
APA 7th Edition ReportingItalicized 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 < .001Leading zero required (S) vs Leading zero omitted (R)

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →