Determinant of a matrix

### 15.1.4 Determinant of a matrix

The det and det_minor commands compute the determinant of a matrix.

- det takes one mandatory argument and one optional argument:
  - A, a matrix.
  - Optionally, method, which determines how the determinant will be computed and can be one of:
    - lagrange When the matrix elements are polynomials or rational functions, this method computes the determinant by evaluating the elements and using Lagrange interpolation.
    - rational_det This method uses Gaussian elimination without converting to to the internal format for fractions.
    - bareiss This uses the Gauss-Bareiss algorithm.
    - linsolve This uses the p-adic algorithm for matrices with integer coefficients.
    - minor_det This uses expansion by minor determinants, which requires 2n operations, but can still be faster for average sized matrices (up to about n=20).
- det(A ⟨,method ⟩) returns the determinant det(A) of the matrix A.

#### Examples

det([[1,2],[3,4]])

−2 |  |  |  |  |  |  |  |  |  |

det(idn(3))

1 |  |  |  |  |  |  |  |  |  |

The det_minor command finds the determinant of a matrix by expanding the determinant using Laplace’s algorithm.

- det_minor takes A, a matrix.
- det_minor(A) returns the determinant det(A) of the matrix A.

#### Examples

det_minor([[1,2],[3,4]])

−2 |  |  |  |  |  |  |  |  |  |

det_minor(idn(3))

1 |  |  |  |  |  |  |  |  |  |