Positive (semi)definiteness criteria #
A symmetric 2 × 2 real matrix !![a, b; b, c] with a, c ≥ 0 and b² ≤ ac is positive
semidefinite (Matrix.posSemidef_fin_two), and so is a symmetric real matrix that is diagonally
dominant, ∑_{j ≠ i} |R i j| ≤ R i i (Matrix.posSemidef_of_diagDominant). An LDLᴴ product
L * diagonal d * Lᴴ with L unit lower triangular is positive definite exactly when every d i
is positive, and positive semidefinite exactly when every d i is nonnegative. Since L is
invertible, this is a case of Sylvester's law of inertia for the congruence by L. Conversely,
over a field with trivial star, such as ℚ, every positive semidefinite (definite) matrix has
such a factorization with d ≥ 0 (d > 0), found by symmetric elimination without pivoting;
Mathlib's LDL.lower_conj_diag covers only positive definite matrices over RCLike fields.
Main results #
Matrix.posSemidef_fin_two: the diagonal-and-determinant criterion for a symmetric2 × 2real matrix to be positive semidefinite.Matrix.posSemidef_of_diagDominant: a symmetric, diagonally dominant real matrix is positive semidefinite.Matrix.posDef_mul_diagonal_mul_conjTranspose_iff,Matrix.posSemidef_mul_diagonal_mul_conjTranspose_iff: theLDLᴴcriteria.Matrix.exists_LDL_of_posSemidef,Matrix.exists_LDL_of_posDef: their converses over a field with trivial star, such asℚ: a positive semidefinite (definite) matrix factors asL * diagonal d * LᵀwithLunit lower triangular andd ≥ 0(d > 0), by symmetric elimination without pivoting.
A symmetric 2 × 2 real matrix with nonnegative diagonal and nonnegative determinant is
positive semidefinite.
Diagonal dominance. A symmetric real matrix with ∑_{j ≠ i} |R i j| ≤ R i i for every
i is positive semidefinite.
An LDLᴴ product with L unit lower triangular is positive definite exactly when every
diagonal entry d i is positive.
An LDLᴴ product with L unit lower triangular is positive semidefinite exactly when every
diagonal entry d i is nonnegative.
Entry (i, j) of L * diagonal d * Lᵀ is ∑ₖ L i k * d k * L j k.
Existence of LDLᵀ for positive semidefinite matrices. Over a field with trivial star
and a star order, such as ℚ or ℝ, every positive semidefinite M factors as
M = L * diagonal d * Lᵀ with L unit lower triangular and every d i ≥ 0, including a
singular M.
The proof is symmetric Gaussian elimination without pivoting. With pivot a = M 0 0 ≥ 0 and
first column b, set l = a⁻¹ • b. A zero pivot forces b = 0
(Matrix.PosSemidef.dotProduct_mulVec_zero_iff at the first basis vector), so b = a • l in
both cases and L has the column l below its first entry. The Schur complement
M i.succ j.succ - a * l i * l j is positive semidefinite, since its quadratic form at y is
that of M at Fin.cons (-(l ⬝ᵥ y)) y, and it factors by induction.
Existence of LDLᵀ for positive definite matrices. Every positive definite M factors as
M = L * diagonal d * Lᵀ with L unit lower triangular and every d i > 0.