Nonsingular inverses #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
In this file, we define an inverse for square matrices of invertible determinant.
For matrices that are not square or not of full rank, there is a more general notion of pseudoinverses which we do not consider here.
The definition of inverse used in this file is the adjugate divided by the determinant.
We show that dividing the adjugate by det A (if possible), giving a matrix A⁻¹ (nonsing_inv),
will result in a multiplicative inverse to A.
Note that there are at least three different inverses in mathlib:
A⁻¹(has_inv.inv): alone, this satisfies no properties, although it is usually used in conjunction withgrouporgroup_with_zero. On matrices, this is defined to be zero when no inverse exists.⅟A(inv_of): this is only available in the presence of[invertible A], which guarantees an inverse exists.ring.inverse A: this is defined on anymonoid_with_zero, and just like⁻¹on matrices, is defined to be zero when no inverse exists.
We start by working with invertible, and show the main results:
matrix.invertible_of_det_invertiblematrix.det_invertible_of_invertiblematrix.is_unit_iff_is_unit_detmatrix.mul_eq_one_comm
After this we define matrix.has_inv and show it matches ⅟A and ring.inverse A.
The rest of the results in the file are then about A⁻¹
References #
- https://en.wikipedia.org/wiki/Cramer's_rule#Finding_inverse_matrix
Tags #
matrix inverse, cramer, cramer's rule, adjugate
Matrices are invertible iff their determinants are #
If A.det has a constructive inverse, produce one for A.
Equations
- A.invertible_of_det_invertible = {inv_of := ⅟ A.det • A.adjugate, inv_of_mul_self := _, mul_inv_of_self := _}
A.det is invertible if A has a left inverse.
Equations
- A.det_invertible_of_left_inverse B h = {inv_of := B.det, inv_of_mul_self := _, mul_inv_of_self := _}
A.det is invertible if A has a right inverse.
Equations
- A.det_invertible_of_right_inverse B h = {inv_of := B.det, inv_of_mul_self := _, mul_inv_of_self := _}
If A has a constructive inverse, produce one for A.det.
Equations
Together matrix.det_invertible_of_invertible and matrix.invertible_of_det_invertible form an
equivalence, although both sides of the equiv are subsingleton anyway.
Equations
- A.invertible_equiv_det_invertible = {to_fun := A.det_invertible_of_invertible, inv_fun := A.invertible_of_det_invertible, left_inv := _, right_inv := _}
We can construct an instance of invertible A if A has a left inverse.
Equations
- A.invertible_of_left_inverse B h = {inv_of := B, inv_of_mul_self := h, mul_inv_of_self := _}
We can construct an instance of invertible A if A has a right inverse.
Equations
- A.invertible_of_right_inverse B h = {inv_of := B, inv_of_mul_self := _, mul_inv_of_self := h}
The transpose of an invertible matrix is invertible.
Equations
A matrix is invertible if the transpose is invertible.
Equations
A matrix is invertible if the conjugate transpose is invertible.
Equations
Given a proof that A.det has a constructive inverse, lift A to (matrix n n α)ˣ
Equations
When lowered to a prop, matrix.invertible_equiv_det_invertible forms an iff.
The inverse of a square matrix, when it is invertible (and zero otherwise).
Equations
- matrix.has_inv = {inv := λ (A : matrix n n α), ring.inverse A.det • A.adjugate}
The nonsingular inverse is the same as inv_of when A is invertible.
Coercing the result of units.has_inv is the same as coercing first and applying the
nonsingular inverse.
The nonsingular inverse is the same as the general ring.inverse.
Equations
A version of matrix.invertible_of_det_invertible with the inverse defeq to A⁻¹ that is
therefore noncomputable.
Equations
- A.invertible_of_is_unit_det h = {inv_of := A⁻¹, inv_of_mul_self := _, mul_inv_of_self := _}
A version of matrix.units_of_det_invertible with the inverse defeq to A⁻¹ that is therefore
noncomputable.
Equations
Equations
- matrix.inv_one_class = {one := 1, inv := has_inv.inv matrix.has_inv, inv_one := _}
diagonal v is invertible if v is
Equations
v is invertible if diagonal v is
Equations
- matrix.invertible_of_diagonal_invertible v = {inv_of := (⅟ (matrix.diagonal v)).diag, inv_of_mul_self := _, mul_inv_of_self := _}
Together matrix.diagonal_invertible and matrix.invertible_of_diagonal_invertible form an
equivalence, although both sides of the equiv are subsingleton anyway.
Equations
When lowered to a prop, matrix.diagonal_invertible_equiv_invertible forms an iff.
A version of list.prod_inv_reverse for matrix.has_inv.
One form of Cramer's rule. See matrix.mul_vec_cramer for a stronger form.
Inverses of permutated matrices #
Note that the simp-normal form of matrix.reindex is matrix.submatrix, so we prove most of these
results about only the latter.
A.submatrix e₁ e₂ is invertible if A is
Equations
- A.submatrix_equiv_invertible e₁ e₂ = (A.submatrix ⇑e₁ ⇑e₂).invertible_of_right_inverse ((⅟ A).submatrix ⇑e₂ ⇑e₁) _
A is invertible if A.submatrix e₁ e₂ is
Together matrix.submatrix_equiv_invertible and
matrix.invertible_of_submatrix_equiv_invertible form an equivalence, although both sides of the
equiv are subsingleton anyway.
Equations
- A.submatrix_equiv_invertible_equiv_invertible e₁ e₂ = {to_fun := λ (_x : invertible (A.submatrix ⇑e₁ ⇑e₂)), A.invertible_of_submatrix_equiv_invertible e₁ e₂, inv_fun := λ (_x : invertible A), A.submatrix_equiv_invertible e₁ e₂, left_inv := _, right_inv := _}
When lowered to a prop, matrix.invertible_of_submatrix_equiv_invertible forms an iff.