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⁻¹
(has_inv.inv
): alone, this satisfies no properties, although it is usually used in conjunction withgroup
orgroup_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_invertible
matrix.det_invertible_of_invertible
matrix.is_unit_iff_is_unit_det
matrix.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 #
A copy of inv_of_mul_self
using ⬝
not *
.
A copy of mul_inv_of_self
using ⬝
not *
.
A copy of inv_of_mul_self_assoc
using ⬝
not *
.
A copy of mul_inv_of_self_assoc
using ⬝
not *
.
A copy of mul_inv_of_mul_self_cancel
using ⬝
not *
.
A copy of mul_mul_inv_of_self_cancel
using ⬝
not *
.
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}
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
.
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
If matrix A is left invertible, then its inverse equals its left inverse.
If matrix A is right invertible, then its inverse equals its right inverse.
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.
More results about determinants #
A variant of matrix.det_units_conj
.
Determinant of a 2×2 block matrix, expanded around an invertible top left element in terms of the Schur complement.
Determinant of a 2×2 block matrix, expanded around an invertible bottom right element in terms of the Schur complement.
The Weinstein–Aronszajn identity. Note the 1
on the LHS is of shape m×m, while the 1
on
the RHS is of shape n×n.
A special case of the Matrix determinant lemma for when A = I
.
TODO: show this more generally.