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
- One or more equations did not get rendered due to their size.
Instances For
A.det
is invertible if A
has a left inverse.
Equations
- Matrix.detInvertibleOfLeftInverse A B h = { invOf := Matrix.det B, invOf_mul_self := (_ : Matrix.det B * Matrix.det A = 1), mul_invOf_self := (_ : Matrix.det A * Matrix.det B = 1) }
Instances For
A.det
is invertible if A
has a right inverse.
Equations
- Matrix.detInvertibleOfRightInverse A B h = { invOf := Matrix.det B, invOf_mul_self := (_ : Matrix.det B * Matrix.det A = 1), mul_invOf_self := (_ : Matrix.det A * Matrix.det B = 1) }
Instances For
If A
has a constructive inverse, produce one for A.det
.
Equations
- Matrix.detInvertibleOfInvertible A = Matrix.detInvertibleOfLeftInverse A ⅟A (_ : ⅟A * A = 1)
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
- Matrix.invertibleOfLeftInverse A B h = { invOf := B, invOf_mul_self := h, mul_invOf_self := (_ : A * B = 1) }
Instances For
We can construct an instance of invertible A if A has a right inverse.
Equations
- Matrix.invertibleOfRightInverse A B h = { invOf := B, invOf_mul_self := (_ : B * A = 1), mul_invOf_self := h }
Instances For
Given a proof that A.det
has a constructive inverse, lift A
to (Matrix n n α)ˣ
Equations
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 (Matrix.det A) • Matrix.adjugate A }
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
.
The nonsing_inv
of A
is a right inverse.
The nonsing_inv
of A
is a left inverse.
Equations
- One or more equations did not get rendered due to their size.
A version of Matrix.invertibleOfDetInvertible
with the inverse defeq to A⁻¹
that is
therefore noncomputable.
Equations
Instances For
A version of Matrix.unitOfDetInvertible
with the inverse defeq to A⁻¹
that is therefore
noncomputable.
Equations
Instances For
Equations
- Matrix.instInvOneClassMatrix = let src := Matrix.one; let src_1 := Matrix.inv; InvOneClass.mk (_ : 1⁻¹ = 1)
diagonal v
is invertible if v
is
Equations
Instances For
v
is invertible if diagonal v
is
Equations
- One or more equations did not get rendered due to their size.
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
- One or more equations did not get rendered due to their size.
Instances For
A
is invertible if A.submatrix e₁ e₂
is
Equations
- One or more equations did not get rendered due to their size.
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'
.