Nonsingular inverses #
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⁻¹
(Inv.inv
): alone, this satisfies no properties, although it is usually used in conjunction withGroup
orGroupWithZero
. On matrices, this is defined to be zero when no inverse exists.⅟A
(invOf
): this is only available in the presence of[Invertible A]
, which guarantees an inverse exists.Ring.inverse A
: this is defined on anyMonoidWithZero
, 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.invertibleOfDetInvertible
Matrix.detInvertibleOfInvertible
Matrix.isUnit_iff_isUnit_det
Matrix.mul_eq_one_comm
After this we define Matrix.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
Instances For
A.det
is invertible if A
has a left inverse.
Equations
- A.detInvertibleOfLeftInverse B h = { invOf := B.det, invOf_mul_self := ⋯, mul_invOf_self := ⋯ }
Instances For
A.det
is invertible if A
has a right inverse.
Equations
- A.detInvertibleOfRightInverse B h = { invOf := B.det, invOf_mul_self := ⋯, mul_invOf_self := ⋯ }
Instances For
If A
has a constructive inverse, produce one for A.det
.
Instances For
Together Matrix.detInvertibleOfInvertible
and Matrix.invertibleOfDetInvertible
form an
equivalence, although both sides of the equiv are subsingleton anyway.
Equations
- One or more equations did not get rendered due to their size.
Instances For
We can construct an instance of invertible A if A has a left inverse.
Equations
- A.invertibleOfLeftInverse B h = { invOf := B, invOf_mul_self := h, mul_invOf_self := ⋯ }
Instances For
We can construct an instance of invertible A if A has a right inverse.
Equations
- A.invertibleOfRightInverse B h = { invOf := B, invOf_mul_self := ⋯, mul_invOf_self := h }
Instances For
Given a proof that A.det
has a constructive inverse, lift A
to (Matrix n n α)ˣ
Equations
- A.unitOfDetInvertible = unitOfInvertible A
Instances For
When lowered to a prop, Matrix.invertibleEquivDetInvertible
forms an iff
.
The inverse of a square matrix, when it is invertible (and zero otherwise).
Equations
- Matrix.inv = { inv := fun (A : Matrix n n α) => Ring.inverse A.det • A.adjugate }
The nonsingular inverse is the same as invOf
when A
is invertible.
Coercing the result of Units.instInv
is the same as coercing first and applying the
nonsingular inverse.
The nonsingular inverse is the same as the general Ring.inverse
.
Equations
- A.instInvertibleInv = ⋯.mpr inferInstance
A version of Matrix.invertibleOfDetInvertible
with the inverse defeq to A⁻¹
that is
therefore noncomputable.
Instances For
A version of Matrix.unitOfDetInvertible
with the inverse defeq to A⁻¹
that is therefore
noncomputable.
Equations
- A.nonsingInvUnit h = unitOfInvertible A
Instances For
Equations
- Matrix.instInvOneClass = let __src := Matrix.one; let __src_1 := Matrix.inv; InvOneClass.mk ⋯
diagonal v
is invertible if v
is
Equations
Instances For
v
is invertible if diagonal v
is
Equations
- Matrix.invertibleOfDiagonalInvertible v = { invOf := (⅟(Matrix.diagonal v)).diag, invOf_mul_self := ⋯, mul_invOf_self := ⋯ }
Instances For
Together Matrix.diagonalInvertible
and Matrix.invertibleOfDiagonalInvertible
form an
equivalence, although both sides of the equiv are subsingleton anyway.
Equations
- One or more equations did not get rendered due to their size.
Instances For
When lowered to a prop, Matrix.diagonalInvertibleEquivInvertible
forms an iff
.
A version of List.prod_inv_reverse
for Matrix.inv
.
One form of Cramer's rule. See Matrix.mulVec_cramer
for a stronger form.
One form of Cramer's rule. See Matrix.mulVec_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
Instances For
A
is invertible if A.submatrix e₁ e₂
is
Equations
Instances For
Together Matrix.submatrixEquivInvertible
and
Matrix.invertibleOfSubmatrixEquivInvertible
form an equivalence, although both sides of the
equiv are subsingleton anyway.
Equations
- One or more equations did not get rendered due to their size.
Instances For
When lowered to a prop, Matrix.invertibleOfSubmatrixEquivInvertible
forms an iff
.
More results about determinants #
A variant of Matrix.det_units_conj
.
A variant of Matrix.det_units_conj'
.