Skip to main content

Linear Algebra with SageMath Learn math with open-source software

Section 7.1 Determinants

The determinant of a square matrix \(A\) is a number \(det(A)\) defined by these properties:
  • Adding a multiple of any row in \(A\) to another row does not change \(det(A)\text{.}\)
  • Multiplying any row of \(A\) by a scalar \(k\) multiplies \(det(A)\) by \(k\text{.}\)
  • Swapping two rows of \(A\) multiplies its determinant by \(-1\text{.}\)
  • The determinant of the identity matrix is \(1\text{.}\)
In Sage, the determinant of a matrix can be computed using the det() method:
A matrix is singular if 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 rank of a matrix is the largest dimension of any of its square submatrix with a non-zero determinant. In Sage the rank of a matrix is computed with the rank() method:
Alternatively, the rank is also the number of pivots in the row reduction of the matrix. In Sage, the row reduction can be performed with the rref() method, which returns a tuple containing the reduced row echelon form of the matrix and a list of pivot columns. Another way to get the rank of a matrix is to count how may pivots the matrix has.