Skip to main content

Linear Algebra with SageMath: Learn math with open-source software

Section 6.3 Determinant and Inverse

Matrices also support non-arithmetic, unary operations; operation that are applied to the matrix itself and its entrees. The determinant of a square matrix is a scalar value that provides important information about the matrix, such as whether it is invertible and how it scales space during transformations. For an \(n \times n\) matrix \(A\text{,}\) the determinant is denoted as \(\det(A)\) or \(|A|\text{.}\) If the determinant is zero, the matrix is singular and does not have an inverse. In Sage, the determinant of a matrix can be computed using the det method:
Note that the determinant of the identity matrix is 1, and the determinant of the zero matrix is 0.
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:
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.
The method is_square() returns True if the matrix is square.
The method is_invertible() returns True if the matrix has an inverse.
The adjugate (or the adjoint) of a matrix is the transpose of its cofactor matrix. In Sage, the adjugate method returns the adjoint matrix.
Currently, Sage does not have an implementation to directly extract the minors of a matrix. To compute a minor of a matrix, Sage offers delete_rows() and delete_columns() methods which can be used to delete a specific row and column and obtain the minor submatrix.