mathlib documentation

linear_algebra.matrix.nonsingular_inverse

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:

We start by working with invertible, and show the main results:

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 #

Tags #

matrix inverse, cramer, cramer's rule, adjugate

Matrices are invertible iff their determinants are #

@[protected]
theorem matrix.inv_of_mul_self {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A] :
A A = 1

A copy of inv_of_mul_self using not *.

@[protected]
theorem matrix.mul_inv_of_self {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A] :
A A = 1

A copy of mul_inv_of_self using not *.

def matrix.invertible_of_det_invertible {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A.det] :

If A.det has a constructive inverse, produce one for A.

Equations
theorem matrix.inv_of_eq {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A.det] [invertible A] :
def matrix.det_invertible_of_left_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A B : matrix n n α) (h : B A = 1) :

A.det is invertible if A has a left inverse.

Equations
def matrix.det_invertible_of_right_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A B : matrix n n α) (h : A B = 1) :

A.det is invertible if A has a right inverse.

Equations
def matrix.det_invertible_of_invertible {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A] :

If A has a constructive inverse, produce one for A.det.

Equations
theorem matrix.det_inv_of {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A] [invertible A.det] :
( A).det = A.det
def matrix.invertible_equiv_det_invertible {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) :

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
theorem matrix.mul_eq_one_comm {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B : matrix n n α} :
A B = 1 B A = 1
def matrix.invertible_of_left_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A B : matrix n n α) (h : B A = 1) :

We can construct an instance of invertible A if A has a left inverse.

Equations
def matrix.invertible_of_right_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A B : matrix n n α) (h : A B = 1) :

We can construct an instance of invertible A if A has a right inverse.

Equations
def matrix.unit_of_det_invertible {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A.det] :
units (matrix n n α)

Given a proof that A.det has a constructive inverse, lift A to units (matrix n n α)

Equations
theorem matrix.is_unit_iff_is_unit_det {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) :

When lowered to a prop, matrix.invertible_equiv_det_invertible forms an iff.

Variants of the statements above with is_unit #

theorem matrix.is_unit_det_of_invertible {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A] :
theorem matrix.is_unit_det_of_left_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B : matrix n n α} (h : B A = 1) :
theorem matrix.is_unit_det_of_right_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B : matrix n n α} (h : A B = 1) :
theorem matrix.det_ne_zero_of_left_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B : matrix n n α} [nontrivial α] (h : B A = 1) :
A.det 0
theorem matrix.det_ne_zero_of_right_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B : matrix n n α} [nontrivial α] (h : A B = 1) :
A.det 0
theorem matrix.is_unit_det_transpose {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :

A noncomputable has_inv instance #

@[protected, instance]
noncomputable def matrix.has_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] :
has_inv (matrix n n α)

The inverse of a square matrix, when it is invertible (and zero otherwise).

Equations
theorem matrix.inv_def {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) :
theorem matrix.nonsing_inv_apply_not_is_unit {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : ¬is_unit A.det) :
A⁻¹ = 0
theorem matrix.nonsing_inv_apply {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :
@[simp]
theorem matrix.inv_of_eq_nonsing_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A] :

The nonsingular inverse is the same as inv_of when A is invertible.

theorem matrix.nonsing_inv_eq_ring_inverse {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) :

The nonsingular inverse is the same as the general ring.inverse.

theorem matrix.transpose_nonsing_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) :
theorem matrix.conj_transpose_nonsing_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [star_ring α] :
@[simp]
theorem matrix.mul_nonsing_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :
A A⁻¹ = 1

The nonsing_inv of A is a right inverse.

@[simp]
theorem matrix.nonsing_inv_mul {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :
A⁻¹ A = 1

The nonsing_inv of A is a left inverse.

@[simp]
theorem matrix.mul_inv_of_invertible {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A] :
A A⁻¹ = 1
@[simp]
theorem matrix.inv_mul_of_invertible {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) [invertible A] :
A⁻¹ A = 1
theorem matrix.nonsing_inv_cancel_or_zero {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) :
A⁻¹ A = 1 A A⁻¹ = 1 A⁻¹ = 0
theorem matrix.det_nonsing_inv_mul_det {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :
(A⁻¹.det) * A.det = 1
@[simp]
theorem matrix.det_nonsing_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) :
theorem matrix.is_unit_nonsing_inv_det {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :
@[simp]
theorem matrix.nonsing_inv_nonsing_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :
theorem matrix.is_unit_nonsing_inv_det_iff {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A : matrix n n α} :
noncomputable def matrix.invertible_of_is_unit_det {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :

A version of matrix.invertible_of_det_invertible with the inverse defeq to A⁻¹ that is therefore noncomputable.

Equations
noncomputable def matrix.nonsing_inv_unit {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :
units (matrix n n α)

A version of matrix.units_of_det_invertible with the inverse defeq to A⁻¹ that is therefore noncomputable.

Equations
theorem matrix.inv_eq_left_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B : matrix n n α} (h : B A = 1) :
A⁻¹ = B

If matrix A is left invertible, then its inverse equals its left inverse.

theorem matrix.inv_eq_right_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B : matrix n n α} (h : A B = 1) :
A⁻¹ = B

If matrix A is right invertible, then its inverse equals its right inverse.

theorem matrix.left_inv_eq_left_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B C : matrix n n α} (h : B A = 1) (g : C A = 1) :
B = C

The left inverse of matrix A is unique when existing.

theorem matrix.right_inv_eq_right_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B C : matrix n n α} (h : A B = 1) (g : A C = 1) :
B = C

The right inverse of matrix A is unique when existing.

theorem matrix.right_inv_eq_left_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B C : matrix n n α} (h : A B = 1) (g : C A = 1) :
B = C

The right inverse of matrix A equals the left inverse of A when they exist.

theorem matrix.inv_inj {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] {A B : matrix n n α} (h : A⁻¹ = B⁻¹) (h' : is_unit A.det) :
A = B
@[simp]
theorem matrix.inv_zero {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] :
0⁻¹ = 0
@[simp]
theorem matrix.inv_one {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] :
1⁻¹ = 1
theorem matrix.inv_smul {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (k : α) [invertible k] (h : is_unit A.det) :
theorem matrix.inv_smul' {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (k : units α) (h : is_unit A.det) :
theorem matrix.inv_adjugate {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (h : is_unit A.det) :
@[simp]
theorem matrix.inv_inv_inv {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) :
theorem matrix.mul_inv_rev {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A B : matrix n n α) :
@[simp]
theorem matrix.det_smul_inv_mul_vec_eq_cramer {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (b : n → α) (h : is_unit A.det) :

One form of Cramer's rule. See matrix.mul_vec_cramer for a stronger form.

@[simp]
theorem matrix.det_smul_inv_vec_mul_eq_cramer_transpose {n : Type u} [decidable_eq n] [fintype n] {α : Type v} [comm_ring α] (A : matrix n n α) (b : n → α) (h : is_unit A.det) :

One form of Cramer's rule. See matrix.mul_vec_cramer for a stronger form.