Section 7.1 Determinant and Inverse
The determinant of a square matrix \(A\) is a multi-linear, alternating function in both rows and columns:
- It is linear in each row (or column) separately.
- If two rows (or columns) of the matrix are identical, its determinant is \(0\text{.}\)
- Multiplying a row (or column) by a scalar \(k\) multiplies \(det(A)\) by \(k\text{.}\)
- Swapping two rows (or columns) flips the sign of the determinant.
Therefore, doing a row replacement on \(A\) does not change \(det(A)\text{.}\) In other words, replacing any one row by itself, plus a multiple of another row: \(\forall k \neq 0, R_i \leftarrow R_i + k·R_j\) (with \(i \neq j\)). This property also extends to column replacements.
In addition, the determinant function must satisfy the following properties:
- The determinant of the identity matrix is \(1\text{,}\) and the determinant of the zero matrix is \(0\text{.}\)
- If a matrix has a row (or column) of all zeros, its determinant is \(0\text{.}\)
- The determinants of a matrix and its transpose are equal: \(\det(A^T) = \det(A)\text{.}\)
- The determinant of a diagonal, or triangular matrix (upper or lower) is the product of its diagonal entries.
- The determinant of the product of two matrices equals the product of their determinants: \(\det(AB) = \det(A) \cdot \det(B)\text{.}\)
The determinant of a matrix \(A\) is a scalar value \(det(A)\) (also denoted \(|A|\)) that tells important information about the linear transformation represented by that matrix, such as whether tha matrix is invertible or how it scales space during transformations. In geometric terms for 2D and 3D space, the determinant of a square matrix measures the signed area of the parallelogram (in 2D) or the signed volume of parallelepiped (in 3D) formed by the row (or column) vectors of the matrix.
Subsection 7.1.1 Determinant of Matrix
In Sage, the determinant of a matrix can be computed using the
det
command:A matrix is singular if it does not have an inverse, which occurs when its determinant is zero. In Sage, to check whether a matrix is singular or not the method
is_singular()
can be used. Note that just as with the determinant, this method is only applicable to square matrices.The matrix \(M\) is singular because its determinant is zero, hence does not have an inverse. Note that Sage offers several other methods to help check various properties of matrices related to determinants and inverses.
Note that Sage defines a method
is_square()
that returns True
if the matrix is square.Subsection 7.1.2 Inverse of Matrix
The inverse of a matrix \(A\) is denoted as \(A^{-1}\) and is defined as the matrix that, when multiplied with \(A\text{,}\) yields the identity matrix. The inverse exists only if the determinant of the matrix is non-zero. In Sage, the inverse of a matrix can be computed using the
inverse
method:The method
is_invertible()
returns True
if the matrix has an inverse.The inverse of a matrix has several important properties:
- The inverse of the identity matrix is itself: \(I^{-1} = I\text{.}\)
- The inverse of a product of matrices is the product of their inverses in reverse order: \((AB)^{-1} = B^{-1}A^{-1}\text{.}\)
- The inverse of a transpose is the transpose of the inverse: \((A^T)^{-1} = (A^{-1})^T\text{.}\)
- The inverse of an inverse returns the original matrix: \((A^{-1})^{-1} = A\text{.}\)
Subsection 7.1.3 Minors, Cofactors and the Adjugate Matrix
The adjugate of a matrix \(A\) is the transpose of its cofactor matrix \(C\text{:}\) \(adj(A)=C^T\text{.}\) In Sage, the
adjugate
method returns the adjugate matrix.Currently, Sage does not have an implementation to directly extract the minors of a matrix. To compute a minor \(M_{ij}\) of a matrix \(A\text{,}\) Sage offers
delete_rows()
and delete_columns()
methods which can be used to delete a specific row \(i\) and column \(j \) and obtain a submatrix whose determinant yields a minor \(M_{ij}\text{,}\) which then can be used to compute the cofactor \(c_{ij}=(-1)^{i+j}M_{ij}\text{.}\)
Generally, given a square matrix of order \(n \times n\text{,}\) the cofactors are obtained by varying the row and column indices \(i\) and \(j\) from \(1\) to \(n\text{.}\) These computed cofactors constitute the entries of the cofactor matrix \(C = \big[c_{ij}\big]\text{.}\)
Note that the transpose of the cofactor matrix is the adjugate matrix
The Adjugate matrix can then be used to compute the inverse of a non-singular matrix using the formula: \(A^{-1} = \frac{1}{\det(A)} \cdot \text{adj}(A)\text{.}\)
Note that the although methods
minor()
and cofactor()
are currently not implemented in Sage, leveraging the command adj
can help compute them, like shown below.