Documentation

Mathlib.LinearAlgebra.Matrix.PosDef

Positive Definite Matrices #

This file defines positive (semi)definite matrices and connects the notion to positive definiteness of quadratic forms. Most results require π•œ = ℝ or β„‚.

Main definitions #

Main results #

Positive semidefinite matrices #

def Matrix.PosSemidef {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] (M : Matrix n n R) :

A matrix M : Matrix n n R is positive semidefinite if it is Hermitian and xα΄΄ * M * x is nonnegative for all x.

Equations
theorem Matrix.PosSemidef.diagonal {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] {d : n β†’ R} (h : 0 ≀ d) :
theorem Matrix.posSemidef_diagonal_iff {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] {d : n β†’ R} :
(diagonal d).PosSemidef ↔ βˆ€ (i : n), 0 ≀ d i

A diagonal matrix is positive semidefinite iff its diagonal entries are nonnegative.

theorem Matrix.PosSemidef.isHermitian {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} (hM : M.PosSemidef) :
theorem Matrix.PosSemidef.re_dotProduct_nonneg {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] {M : Matrix n n π•œ} (hM : M.PosSemidef) (x : n β†’ π•œ) :
theorem Matrix.PosSemidef.conjTranspose_mul_mul_same {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {A : Matrix n n R} (hA : A.PosSemidef) {m : Type u_5} [Fintype m] (B : Matrix n m R) :
theorem Matrix.PosSemidef.mul_mul_conjTranspose_same {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {A : Matrix n n R} (hA : A.PosSemidef) {m : Type u_5} [Fintype m] (B : Matrix m n R) :
theorem Matrix.PosSemidef.submatrix {m : Type u_1} {n : Type u_2} {R : Type u_3} [Fintype m] [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} (hM : M.PosSemidef) (e : m β†’ n) :
theorem Matrix.PosSemidef.transpose {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} (hM : M.PosSemidef) :
theorem Matrix.PosSemidef.zero {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] :
theorem Matrix.PosSemidef.natCast {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] (d : β„•) :
(↑d).PosSemidef
theorem Matrix.PosSemidef.intCast {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] (d : β„€) (hd : 0 ≀ d) :
(↑d).PosSemidef
@[simp]
theorem Matrix.PosSemidef.pow {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] {M : Matrix n n R} (hM : M.PosSemidef) (k : β„•) :
theorem Matrix.PosSemidef.inv {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [DecidableEq n] {M : Matrix n n R} (hM : M.PosSemidef) :
theorem Matrix.PosSemidef.zpow {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] {M : Matrix n n R} (hM : M.PosSemidef) (z : β„€) :
theorem Matrix.PosSemidef.add {m : Type u_1} {R : Type u_3} [Fintype m] [CommRing R] [PartialOrder R] [StarRing R] [AddLeftMono R] {A B : Matrix m m R} (hA : A.PosSemidef) (hB : B.PosSemidef) :
theorem Matrix.PosSemidef.eigenvalues_nonneg {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) (i : n) :
0 ≀ β‹―.eigenvalues i

The eigenvalues of a positive semi-definite matrix are non-negative

theorem Matrix.PosSemidef.det_nonneg {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {M : Matrix n n π•œ} (hM : M.PosSemidef) :
noncomputable def Matrix.PosSemidef.sqrt {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
Matrix n n π•œ

The positive semidefinite square root of a positive semidefinite matrix

Equations

Custom elaborator to produce output like (_ : PosSemidef A).sqrt in the goal view.

Equations
  • One or more equations did not get rendered due to their size.
theorem Matrix.PosSemidef.posSemidef_sqrt {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
@[simp]
theorem Matrix.PosSemidef.sq_sqrt {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
hA.sqrt ^ 2 = A
@[simp]
theorem Matrix.PosSemidef.sqrt_mul_self {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
hA.sqrt * hA.sqrt = A
theorem Matrix.PosSemidef.eq_of_sq_eq_sq {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) {B : Matrix n n π•œ} (hB : B.PosSemidef) (hAB : A ^ 2 = B ^ 2) :
A = B
theorem Matrix.PosSemidef.sq_eq_sq_iff {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) {B : Matrix n n π•œ} (hB : B.PosSemidef) :
A ^ 2 = B ^ 2 ↔ A = B
theorem Matrix.PosSemidef.sqrt_sq {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
(β‹― : (A ^ 2).PosSemidef).sqrt = A
theorem Matrix.PosSemidef.eq_sqrt_iff_sq_eq {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) {B : Matrix n n π•œ} (hB : B.PosSemidef) :
A = hB.sqrt ↔ A ^ 2 = B
theorem Matrix.PosSemidef.sqrt_eq_iff_eq_sq {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) {B : Matrix n n π•œ} (hB : B.PosSemidef) :
hA.sqrt = B ↔ A = B ^ 2
@[deprecated Matrix.PosSemidef.eq_sqrt_iff_sq_eq (since := "2025-05-07")]
theorem Matrix.PosSemidef.eq_sqrt_of_sq_eq {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) {B : Matrix n n π•œ} (hB : B.PosSemidef) (hAB : A ^ 2 = B) :
A = hB.sqrt
@[simp]
theorem Matrix.PosSemidef.sqrt_eq_zero_iff {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
hA.sqrt = 0 ↔ A = 0
@[simp]
theorem Matrix.PosSemidef.sqrt_eq_one_iff {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
hA.sqrt = 1 ↔ A = 1
@[simp]
theorem Matrix.PosSemidef.isUnit_sqrt_iff {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
theorem Matrix.PosSemidef.inv_sqrt {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) :
@[simp]
theorem Matrix.posSemidef_submatrix_equiv {m : Type u_1} {n : Type u_2} {R : Type u_3} [Fintype m] [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} (e : m ≃ n) :
(M.submatrix ⇑e ⇑e).PosSemidef ↔ M.PosSemidef
theorem Matrix.posSemidef_conjTranspose_mul_self {m : Type u_1} {n : Type u_2} {R : Type u_3} [Fintype m] [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] (A : Matrix m n R) :

The conjugate transpose of a matrix multiplied by the matrix is positive semidefinite

theorem Matrix.posSemidef_self_mul_conjTranspose {m : Type u_1} {n : Type u_2} {R : Type u_3} [Fintype m] [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] (A : Matrix m n R) :

A matrix multiplied by its conjugate transpose is positive semidefinite

theorem Matrix.eigenvalues_conjTranspose_mul_self_nonneg {m : Type u_1} {n : Type u_2} {π•œ : Type u_4} [Fintype m] [Fintype n] [RCLike π•œ] (A : Matrix m n π•œ) [DecidableEq n] (i : n) :
0 ≀ β‹―.eigenvalues i
theorem Matrix.eigenvalues_self_mul_conjTranspose_nonneg {m : Type u_1} {n : Type u_2} {π•œ : Type u_4} [Fintype m] [Fintype n] [RCLike π•œ] (A : Matrix m n π•œ) [DecidableEq m] (i : m) :
0 ≀ β‹―.eigenvalues i
theorem Matrix.posSemidef_iff_eq_conjTranspose_mul_self {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] {A : Matrix n n π•œ} :
A.PosSemidef ↔ βˆƒ (B : Matrix n n π•œ), A = B.conjTranspose * B

A matrix is positive semidefinite if and only if it has the form Bα΄΄ * B for some B.

@[deprecated Matrix.posSemidef_iff_eq_conjTranspose_mul_self (since := "2025-05-07")]
theorem Matrix.posSemidef_iff_eq_transpose_mul_self {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] {A : Matrix n n π•œ} :
A.PosSemidef ↔ βˆƒ (B : Matrix n n π•œ), A = B.conjTranspose * B

Alias of Matrix.posSemidef_iff_eq_conjTranspose_mul_self.


A matrix is positive semidefinite if and only if it has the form Bα΄΄ * B for some B.

theorem Matrix.IsHermitian.posSemidef_of_eigenvalues_nonneg {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.IsHermitian) (h : βˆ€ (i : n), 0 ≀ hA.eigenvalues i) :
theorem Matrix.PosSemidef.dotProduct_mulVec_zero_iff {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] {A : Matrix n n π•œ} (hA : A.PosSemidef) (x : n β†’ π•œ) :

For A positive semidefinite, we have x⋆ A x = 0 iff A x = 0.

theorem Matrix.PosSemidef.toLinearMapβ‚‚'_zero_iff {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosSemidef) (x : n β†’ π•œ) :
(((toLinearMapβ‚‚' π•œ) A) (star x)) x = 0 ↔ A.mulVec x = 0

For A positive semidefinite, we have x⋆ A x = 0 iff A x = 0 (linear maps version).

Positive definite matrices #

def Matrix.PosDef {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] (M : Matrix n n R) :

A matrix M : Matrix n n R is positive definite if it is hermitian and xα΄΄Mx is greater than zero for all nonzero x.

Equations
theorem Matrix.PosDef.isHermitian {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} (hM : M.PosDef) :
theorem Matrix.PosDef.re_dotProduct_pos {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] {M : Matrix n n π•œ} (hM : M.PosDef) {x : n β†’ π•œ} (hx : x β‰  0) :
theorem Matrix.PosDef.posSemidef {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} (hM : M.PosDef) :
theorem Matrix.PosDef.transpose {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} (hM : M.PosDef) :
@[simp]
theorem Matrix.PosDef.transpose_iff {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} :
theorem Matrix.PosDef.diagonal {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] [NoZeroDivisors R] {d : n β†’ R} (h : βˆ€ (i : n), 0 < d i) :
@[simp]
theorem Matrix.posDef_diagonal_iff {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] [NoZeroDivisors R] [Nontrivial R] {d : n β†’ R} :
(diagonal d).PosDef ↔ βˆ€ (i : n), 0 < d i
theorem Matrix.PosDef.natCast {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] [NoZeroDivisors R] (d : β„•) (hd : d β‰  0) :
(↑d).PosDef
@[simp]
theorem Matrix.posDef_natCast_iff {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] [NoZeroDivisors R] [Nonempty n] [Nontrivial R] {d : β„•} :
(↑d).PosDef ↔ 0 < d
theorem Matrix.PosDef.intCast {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] [NoZeroDivisors R] (d : β„€) (hd : 0 < d) :
(↑d).PosDef
@[simp]
theorem Matrix.posDef_intCast_iff {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] [DecidableEq n] [NoZeroDivisors R] [Nonempty n] [Nontrivial R] {d : β„€} :
(↑d).PosDef ↔ 0 < d
theorem Matrix.PosDef.add_posSemidef {m : Type u_1} {R : Type u_3} [Fintype m] [CommRing R] [PartialOrder R] [StarRing R] [AddLeftMono R] {A B : Matrix m m R} (hA : A.PosDef) (hB : B.PosSemidef) :
(A + B).PosDef
theorem Matrix.PosDef.posSemidef_add {m : Type u_1} {R : Type u_3} [Fintype m] [CommRing R] [PartialOrder R] [StarRing R] [AddLeftMono R] {A B : Matrix m m R} (hA : A.PosSemidef) (hB : B.PosDef) :
(A + B).PosDef
theorem Matrix.PosDef.add {m : Type u_1} {R : Type u_3} [Fintype m] [CommRing R] [PartialOrder R] [StarRing R] [AddLeftMono R] {A B : Matrix m m R} (hA : A.PosDef) (hB : B.PosDef) :
(A + B).PosDef
theorem Matrix.PosDef.conjTranspose_mul_mul_same {m : Type u_1} {n : Type u_2} {R : Type u_3} [Fintype m] [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {A : Matrix n n R} {B : Matrix n m R} (hA : A.PosDef) (hB : Function.Injective B.mulVec) :
theorem Matrix.PosDef.mul_mul_conjTranspose_same {m : Type u_1} {n : Type u_2} {R : Type u_3} [Fintype m] [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {A : Matrix n n R} {B : Matrix m n R} (hA : A.PosDef) (hB : Function.Injective fun (v : m β†’ R) => vecMul v B) :
theorem Matrix.PosDef.conjTranspose {n : Type u_2} {R : Type u_3} [Fintype n] [CommRing R] [PartialOrder R] [StarRing R] {M : Matrix n n R} (hM : M.PosDef) :
@[simp]
theorem Matrix.PosDef.eigenvalues_pos {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} (hA : A.PosDef) (i : n) :
0 < β‹―.eigenvalues i

The eigenvalues of a positive definite matrix are positive

theorem Matrix.PosDef.det_pos {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {M : Matrix n n π•œ} (hM : M.PosDef) :
0 < M.det
theorem Matrix.PosDef.isUnit {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {M : Matrix n n π•œ} (hM : M.PosDef) :
theorem Matrix.PosDef.inv {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {M : Matrix n n π•œ} (hM : M.PosDef) :
@[simp]
theorem Matrix.posDef_inv_iff {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {M : Matrix n n π•œ} :
theorem Matrix.PosDef.posDef_sqrt {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {M : Matrix n n π•œ} (hM : M.PosDef) :
(β‹― : M.PosSemidef).sqrt.PosDef
theorem Matrix.PosDef.posDef_iff_eq_conjTranspose_mul_self {n : Type u_2} {π•œ : Type u_4} [Fintype n] [RCLike π•œ] [DecidableEq n] {A : Matrix n n π•œ} :
A.PosDef ↔ βˆƒ (B : Matrix n n π•œ), IsUnit B ∧ A = B.conjTranspose * B

A matrix is positive definite if and only if it has the form Bα΄΄ * B for some invertible B.

@[reducible, inline]
noncomputable abbrev Matrix.NormedAddCommGroup.ofMatrix {π•œ : Type u_1} [RCLike π•œ] {n : Type u_2} [Fintype n] {M : Matrix n n π•œ} (hM : M.PosDef) :
NormedAddCommGroup (n β†’ π•œ)

A positive definite matrix M induces a norm β€–xβ€– = sqrt (re xα΄΄Mx).

Equations
def Matrix.InnerProductSpace.ofMatrix {π•œ : Type u_1} [RCLike π•œ] {n : Type u_2} [Fintype n] {M : Matrix n n π•œ} (hM : M.PosDef) :
InnerProductSpace π•œ (n β†’ π•œ)

A positive definite matrix M induces an inner product βŸͺx, y⟫ = xα΄΄My.

Equations
  • One or more equations did not get rendered due to their size.