acalculator

How do I use Cramer's rule?

Type each equation as a row: the coefficients, then the constant after the equals sign. The Cramer's rule calculator finds the determinant D of the coefficients, the determinants Dx, Dy and Dz, and each unknown as Dx ÷ D and so on, in exact fractions.

Your numbers

Equations
For 2 equations use 2 rows and 3 columns; for 3 equations, 3 rows and 4 columns. 12x + 3y = 15 is 12, 3, 15.
Solution
(1, 3, −2)

The solution is (1, 3, −2).

D
−3
Dx
−3
Dy
−9
Dz
6
In decimals
x = 1, y = 3, z = −2
Working
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

Solution: (1, 3, −2). The solution is (1, 3, −2).

How does Cramer's rule solve it?

How to calculate

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.

Example with the default inputs (Equations [1, 1, −1, 6; 3, −2, 1, −5; 1, 3, −2, 14]): The solution is (1, 3, −2).

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.

  • 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.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Equations 1, 1, -1, 6; 3, -2, 1, -5; 1, 3, -2, 14 gives 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
  2. Equations 12, 3, 15; 2, -3, 13 gives Solution (2, −3), D −42, Dx −84, Dy 126, Working 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
  3. Equations 2, 3, 1; 1, -1, 0.5 gives Solution (1/2, 0), In decimals x = 0.5, y = 0.
  4. Equations 1, 1, 3; 1, -1, 0 gives Solution (3/2, 3/2), In decimals x = 1.5, y = 1.5.

How it works

Write the system as A × (x, y, z) = b, where A holds the coefficients and b the constants.

  • D = det(A).
  • Dx, Dy, Dz: the determinant of A with the x, y or z column replaced by b.
  • x = Dx ÷ D, y = Dy ÷ D, z = Dz ÷ D, when D ≠ 0.

Determinants. 2 × 2: det [a, b; c, d] = ad − bc. 3 × 3: expansion along the first row, det = a₁₁(a₂₂a₃₃ − a₂₃a₃₂) − a₁₂(a₂₁a₃₃ − a₂₃a₃₁) + a₁₃(a₂₁a₃₂ − a₂₂a₃₁).

Input. A grid with one row per equation: the coefficients of x, y (and z) in order, then the constant in the last column. 2 equations take 2 rows and 3 columns; 3 equations take 3 rows and 4 columns. Any other shape gets a message.

Rules. When D = 0 there is no unique solution (no solution or infinitely many), and the page says so instead of giving an answer.

Exact arithmetic. Each cell is read as an exact fraction: the fraction nearest to the typed number with a bottom of at most 1,000,000, when that fraction rounds to the same number (so a cell typed as 1/3 is exactly 1/3); otherwise the exact decimal typed (0.1 is 1/10). Every determinant and quotient is exact.

Output format. Fractions in lowest terms with a true minus sign. The solution is (x, y) or (x, y, z). The decimals are each unknown rounded half up to 10 significant figures. In the working a matrix is written [row; row] with commas between cells, and a negative D is put in brackets after ÷.

Worked examples by hand

12x + 3y = 15, 2x − 3y = 13 (OpenStax Example 2). D = 12(−3) − 3(2) = −42. Dx = 15(−3) − 3(13) = −84. Dy = 12(13) − 15(2) = 126. x = −84 ÷ (−42) = 2, y = 126 ÷ (−42) = −3: (2, −3).

x + y − z = 6, 3x − 2y + z = −5, x + 3y − 2z = 14 (OpenStax Example 4). D = −3, Dx = −3, Dy = −9, Dz = 6, so x = 1, y = 3, z = −2: (1, 3, −2).

2x + 3y = 1, x − y = 0.5. D = −2 − 3 = −5; Dx = 1(−1) − 3(0.5) = −2.5; Dy = 2(0.5) − 1(1) = 0. x = −2.5 ÷ (−5) = 1/2, y = 0.

x + y = 3, x − y = 0. D = −2, Dx = −3, Dy = −3, so (3/2, 3/2), 1.5 each.

Other questions people ask

What is Cramer's rule?

A way to solve a system of linear equations with determinants. For each unknown, replace its column in the coefficient matrix with the constants, take the determinant, and divide by the determinant D of the coefficient matrix: x = Dx ÷ D, y = Dy ÷ D, z = Dz ÷ D.

How do I use Cramer's rule for a 2 × 2 system?

For ax + by = e and cx + dy = f: D = ad − bc, Dx = ed − bf, Dy = af − ec. For 12x + 3y = 15 and 2x − 3y = 13, D = −42, Dx = −84, Dy = 126, so x = 2 and y = −3.

What if D = 0?

Then Cramer's rule cannot be used: the system has either no solution or infinitely many. Use elimination or row reduction (the system of equations or RREF calculator) to tell which.

How do I find a 3 × 3 determinant?

Expand along the first row: det = a₁(b₂c₃ − b₃c₂) − a₂(b₁c₃ − b₃c₁) + a₃(b₁c₂ − b₂c₁), where the second and third rows are b and c. The determinant calculator shows the full working for larger matrices.

How do I enter the equations?

One row per equation, with the unknowns in the same order in every row. Write 0 for a missing unknown. x + y − z = 6 is the row 1, 1, −1, 6. Use 2 rows and 3 columns for 2 equations, 3 rows and 4 columns for 3 equations.

Is Cramer's rule better than elimination?

For 2 or 3 equations it is quick and gives each unknown on its own. For larger systems it needs many determinants, so elimination is faster.