{
  "id": "determinant",
  "version": "c807e55d9efa",
  "status": "published",
  "name": "Determinant Calculator",
  "question": "What is the determinant of my matrix?",
  "summary": "Finds the determinant of a square matrix from 1 × 1 to 6 × 6 by Gaussian elimination in exact fractions, with every row operation and whether the matrix is invertible.",
  "category": "math",
  "subcategory": "linear-algebra",
  "url": "https://www.acalculator.org/math/determinant-calculator",
  "markdown": "https://www.acalculator.org/math/determinant-calculator.md",
  "kind": "function",
  "method": "Gaussian elimination to upper triangular form; det(A) = (−1)^(row swaps) × the product of the diagonal. For 2 × 2, det = ad − bc.",
  "assumptions": [
    "Every cell is read as an exact fraction (1/3 is 1/3, 0.1 is 1/10), so the determinant has no rounding error.",
    "The pivot for each column is the first row, from the diagonal down, with a non-zero entry.",
    "The matrix is square, 1 × 1 to 6 × 6."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "a": {
        "title": "Matrix A",
        "description": "The square matrix, 1 to 6 rows and the same number of columns.",
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "number"
          }
        }
      }
    }
  },
  "outputs": {
    "determinant": {
      "label": "Determinant det(A)",
      "description": "The determinant as an exact fraction in lowest terms.",
      "format": "text"
    },
    "decimal": {
      "label": "Determinant in decimals",
      "description": "The determinant rounded half up to 10 significant figures.",
      "format": "text"
    },
    "invertible": {
      "label": "Does A have an inverse?",
      "description": "Yes when the determinant is not 0.",
      "format": "boolean"
    },
    "steps": {
      "label": "Elimination",
      "description": "The row operations to upper triangular form, the triangular matrix, and the product of its diagonal.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "a": "2,-3,1;2,0,-1;1,4,5"
    },
    "outputs": {
      "determinant": "49",
      "decimal": "49",
      "invertible": true,
      "steps": "R2 → R2 − R1; R3 → R3 − 1/2 × R1; R3 → R3 − 11/6 × R2; Upper triangular: [2, -3, 1; 0, 3, -2; 0, 0, 49/6]; det = 2 × 3 × 49/6 = 49"
    },
    "text": "The determinant of the matrix is 49."
  },
  "examples": [
    {
      "given": {
        "a": [
          [
            2,
            -3,
            1
          ],
          [
            2,
            0,
            -1
          ],
          [
            1,
            4,
            5
          ]
        ]
      },
      "expect": {
        "determinant": "49",
        "decimal": "49",
        "invertible": true,
        "steps": "R2 → R2 − R1; R3 → R3 − 1/2 × R1; R3 → R3 − 11/6 × R2; Upper triangular: [2, -3, 1; 0, 3, -2; 0, 0, 49/6]; det = 2 × 3 × 49/6 = 49"
      },
      "source": "OpenStax, Precalculus 2e, §9.8, 3 × 3 determinants (https://openstax.org/books/precalculus-2e/pages/9-8-solving-systems-with-cramers-rule); hand calculation in content.mdx: cofactor expansion 2 × 4 + 3 × 11 + 1 × 8 = 49 (Strang §5.2)"
    },
    {
      "given": {
        "a": [
          [
            4,
            7
          ],
          [
            2,
            6
          ]
        ]
      },
      "expect": {
        "determinant": "10",
        "invertible": true
      },
      "source": "hand calculation in content.mdx: ad − bc = 4 × 6 − 7 × 2 = 10"
    },
    {
      "given": {
        "a": [
          [
            0,
            1
          ],
          [
            1,
            0
          ]
        ]
      },
      "expect": {
        "determinant": "-1",
        "steps": "R1 ↔ R2; Upper triangular: [1, 0; 0, 1]; det = (-1)^1 × 1 × 1 = -1"
      },
      "source": "hand calculation in content.mdx: ad − bc = 0 − 1 = −1; one swap flips the sign"
    },
    {
      "given": {
        "a": [
          [
            1,
            2,
            3
          ],
          [
            4,
            5,
            6
          ],
          [
            7,
            8,
            9
          ]
        ]
      },
      "expect": {
        "determinant": "0",
        "invertible": false
      },
      "source": "hand calculation in content.mdx: row 3 − row 2 = row 2 − row 1, so the rows are dependent and det = 0"
    },
    {
      "given": {
        "a": [
          [
            0.5,
            0.3333333333333333
          ],
          [
            0.25,
            1
          ]
        ]
      },
      "expect": {
        "determinant": "5/12",
        "decimal": "0.4166666667"
      },
      "source": "hand calculation in content.mdx: 1/2 × 1 − 1/3 × 1/4 = 1/2 − 1/12 = 5/12"
    },
    {
      "given": {
        "a": [
          [
            -7
          ]
        ]
      },
      "expect": {
        "determinant": "-7",
        "steps": "Upper triangular: [-7]; det = -7"
      },
      "source": "hand calculation in content.mdx: the determinant of a 1 × 1 matrix [a] is a"
    }
  ],
  "sources": [
    "Gilbert Strang, Introduction to Linear Algebra, 5th edition (2016), §5.1 The Properties of Determinants and §5.2 Permutations and Cofactors.",
    "OpenStax, Precalculus 2e, §9.8 Solving Systems with Cramer’s Rule (2 × 2 and 3 × 3 determinants). https://openstax.org/books/precalculus-2e/pages/9-8-solving-systems-with-cramers-rule"
  ],
  "related": [
    "matrix",
    "inverse-matrix",
    "rref",
    "system-of-equations",
    "eigenvector"
  ],
  "changelog": []
}
