{
  "id": "cramers-rule",
  "version": "59f61fe3f98d",
  "status": "published",
  "name": "Cramer's Rule Calculator",
  "question": "How do I use Cramer's rule?",
  "summary": "Solves a system of 2 or 3 linear equations by Cramer's rule: the determinants D, Dx, Dy and Dz and each unknown as an exact fraction, with the working shown.",
  "category": "math",
  "subcategory": "linear-algebra",
  "url": "https://www.acalculator.org/math/cramers-rule-calculator",
  "markdown": "https://www.acalculator.org/math/cramers-rule-calculator.md",
  "kind": "function",
  "method": "D = det(A); Dx, Dy, Dz replace the x, y, z column of A with the constants; x = Dx ÷ D, y = Dy ÷ D, z = Dz ÷ D when D ≠ 0.",
  "assumptions": [
    "Each cell is read as an exact fraction (0.1 is 1/10, a cell typed as 1/3 is 1/3).",
    "When D = 0 there is no unique solution, and the page says so."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "m": {
        "title": "Equations",
        "description": "One row per equation: the coefficients of x, y (and z), then the constant after the equals sign in the last column.",
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "number"
          }
        }
      }
    }
  },
  "outputs": {
    "solution": {
      "label": "Solution",
      "description": "The values of the unknowns as exact fractions: (x, y) or (x, y, z).",
      "format": "text"
    },
    "d": {
      "label": "D",
      "description": "The determinant of the coefficients.",
      "format": "text"
    },
    "dx": {
      "label": "Dx",
      "description": "The determinant with the x column replaced by the constants.",
      "format": "text"
    },
    "dy": {
      "label": "Dy",
      "description": "The determinant with the y column replaced by the constants.",
      "format": "text"
    },
    "dz": {
      "label": "Dz",
      "description": "The determinant with the z column replaced by the constants.",
      "format": "text"
    },
    "decimals": {
      "label": "In decimals",
      "description": "Each unknown rounded half up to 10 significant figures.",
      "format": "text"
    },
    "steps": {
      "label": "Working",
      "description": "Each determinant and each division.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "m": "1,1,-1,6;3,-2,1,-5;1,3,-2,14"
    },
    "outputs": {
      "solution": "(1, 3, −2)",
      "d": "−3",
      "dx": "−3",
      "dy": "−9",
      "dz": "6",
      "decimals": "x = 1, y = 3, z = −2",
      "steps": "D = det [1, 1, −1; 3, −2, 1; 1, 3, −2] = −3; Dx = det [6, 1, −1; −5, −2, 1; 14, 3, −2] = −3; Dy = det [1, 6, −1; 3, −5, 1; 1, 14, −2] = −9; Dz = det [1, 1, 6; 3, −2, −5; 1, 3, 14] = 6; x = Dx ÷ D = −3 ÷ (−3) = 1; y = Dy ÷ D = −9 ÷ (−3) = 3; z = Dz ÷ D = 6 ÷ (−3) = −2"
    },
    "text": "The solution is (1, 3, −2)."
  },
  "examples": [
    {
      "given": {
        "m": [
          [
            1,
            1,
            -1,
            6
          ],
          [
            3,
            -2,
            1,
            -5
          ],
          [
            1,
            3,
            -2,
            14
          ]
        ]
      },
      "expect": {
        "solution": "(1, 3, −2)",
        "d": "−3",
        "dx": "−3",
        "dy": "−9",
        "dz": "6"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §11.8 Solving Systems with Cramer's Rule, Example 4 (x + y − z = 6, 3x − 2y + z = −5, x + 3y − 2z = 14 gives (1, 3, −2)), https://openstax.org/books/algebra-and-trigonometry-2e/pages/11-8-solving-systems-with-cramers-rule"
    },
    {
      "given": {
        "m": [
          [
            12,
            3,
            15
          ],
          [
            2,
            -3,
            13
          ]
        ]
      },
      "expect": {
        "solution": "(2, −3)",
        "d": "−42",
        "dx": "−84",
        "dy": "126",
        "steps": "D = det [12, 3; 2, −3] = −42; Dx = det [15, 3; 13, −3] = −84; Dy = det [12, 15; 2, 13] = 126; x = Dx ÷ D = −84 ÷ (−42) = 2; y = Dy ÷ D = 126 ÷ (−42) = −3"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §11.8 Solving Systems with Cramer's Rule, Example 2 (12x + 3y = 15, 2x − 3y = 13 gives (2, −3)), https://openstax.org/books/algebra-and-trigonometry-2e/pages/11-8-solving-systems-with-cramers-rule"
    },
    {
      "given": {
        "m": [
          [
            2,
            3,
            1
          ],
          [
            1,
            -1,
            0.5
          ]
        ]
      },
      "expect": {
        "solution": "(1/2, 0)",
        "decimals": "x = 0.5, y = 0"
      },
      "source": "hand calculation in content.mdx: D = −2 − 3 = −5, Dx = −1 − 1.5 = −2.5, Dy = 1 − 1 = 0"
    },
    {
      "given": {
        "m": [
          [
            1,
            1,
            3
          ],
          [
            1,
            -1,
            0
          ]
        ]
      },
      "expect": {
        "solution": "(3/2, 3/2)",
        "decimals": "x = 1.5, y = 1.5"
      },
      "source": "hand calculation in content.mdx: D = −2, Dx = −3, Dy = −3"
    }
  ],
  "sources": [
    "OpenStax, Algebra and Trigonometry 2e, §11.8 Solving Systems with Cramer's Rule (x = Dx ÷ D, y = Dy ÷ D, z = Dz ÷ D with D ≠ 0; D = 0 means no solution or infinitely many; Example 2: 12x + 3y = 15, 2x − 3y = 13 gives (2, −3); Example 4: x + y − z = 6, 3x − 2y + z = −5, x + 3y − 2z = 14 gives (1, 3, −2)). https://openstax.org/books/algebra-and-trigonometry-2e/pages/11-8-solving-systems-with-cramers-rule (retrieved 2026-10-05)"
  ],
  "related": [
    "system-of-equations",
    "determinant",
    "matrix",
    "inverse-matrix",
    "rref"
  ],
  "changelog": []
}
