# Determinant of a matrix: det

### 5.47.4 Determinant of a matrix: det

The det command finds 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. This requires 2n operations, but can stil be faster for average sized matrices (up to about n=20).
- det(A ⟨,method⟩) returns the determinant of the matrix A.

#### Examples.

- Input:
  det([[1,2],[3,4]])
  Output:

  −2

- Input:
  det(idn(3))
  Output:

  1