Positive definite matrices
Decide whether a symmetric matrix is positive definite by its eigenvalues, its pivots or xᵀAx > 0, draw its quadratic form as nested ellipses, and see why Gram and covariance matrices are positive semidefinite.
It opens on
The function f(x, y) = 2x² + 2xy + 2y² has a cross term 2xy that can be negative. Is f still positive at every point except the origin, and what do its level curves look like?
Why it matters
Positive definite matrices are the ones that measure squared length or energy: they make least squares and Newton's method well posed, define bowl-shaped loss surfaces, and every covariance matrix in statistics is one, or nearly.
Good to know first
- Symmetric matrices and the spectral theorem: A = QΛQᵀ with real eigenvalues and orthonormal eigenvectors
- Gaussian elimination: pivots are the diagonal entries left after elimination
- Transpose and special matrices: the Gram matrix XᵀX of a data matrix is symmetric
Step by step
Quadratic forms as ellipses
Write f(x, y) = 2x² + 2xy + 2y² as xᵀAx, define positive definite, and read the level curves as ellipses on the eigen-directions.
Using A = 3q₁q₁ᵀ + q₂q₂ᵀ with q₁ = (1, 1)/√2 and q₂ = (1, −1)/√2: xᵀAx = 3(q₁ · x)² + 1(q₂ · x)² = (3/2)(x + y)² + (1/2)(x − y)², a sum of squares with positive weights.
A common mix-up
A matrix with all positive entries is positive definite.
In fact: B = [[1, 2], [2, 1]] has positive entries but xᵀBx = −2 at (1, −1); the eigenvalues decide.
Three tests for positive definiteness
Test a symmetric 2 × 2 matrix by eigenvalues, pivots and leading determinants, and see the saddle of an indefinite one.
Test 2, pivots: eliminate A = [[2, 1], [1, 2]]: subtract 1/2 of row 1 from row 2, leaving pivots 2 and 2 − 1/2 = 3/2, both positive.
A common mix-up
A positive determinant means positive definite.
In fact: [[−1, 0], [0, −1]] has determinant 1 but xᵀAx = −x² − y² < 0; the first pivot must be positive too.
Gram and covariance matrices are semidefinite
Show xᵀ(XᵀX)x = |Xx|² ≥ 0, recognize when XᵀX is only semidefinite, and connect this to covariance matrices.
Take X with rows (1, 2), (2, 4), (−1, −2): XᵀX = G = [[6, 12], [12, 24]], and xᵀGx = 6x² + 24xy + 24y² = 6(x + 2y)².
A common mix-up
A covariance matrix can have a negative eigenvalue.
In fact: xᵀCx is the variance of the combination Xx, and a variance is never negative.
Try it
Write 3x² + 2xy + 3y² as xᵀAx and give its eigenvalues.Answer
A = [[3, 1], [1, 3]], eigenvalues 4 and 2, both positive
Hint: Half the xy coefficient goes in each off-diagonal entry
Is [[4, 2], [2, 3]] positive definite? Give the pivots.Answer
Yes; pivots 4 and 3 − 1 = 2
Hint: Subtract 1/2 of row 1 from row 2
The data matrix X has rows (1, 1), (2, 2), (3, 3). Is XᵀX positive definite?Answer
No, only semidefinite: X(1, −1) = 0, the columns are equal
Hint: Look for x with Xx = 0
Can 2x² + 2xy + 2y² be zero or negative at a point other than the origin?Answer
No: (3/2)(x + y)² + (1/2)(x − y)² is zero only when x + y = 0 and x − y = 0, that is, at the origin.
Change one thing, the matrix to B = [[1, 2], [2, 1]]: what are its pivots, and is it positive definite?Answer
1 and 1 − 4 = −3; no, a negative pivot fails.
