Systems of Linear Equations Calculator: 2×2 & 3×3 (Cramer’s Rule)

This systems of linear equations calculator solves two equations in x and y, or three equations in x, y and z, using Cramer’s rule. Enter the coefficients and the constants, and it returns the solution along with the determinant.

Math Calculators

Systems of Linear Equations Calculator

Solve a system of two (or three) linear equations for x, y (and z), using Cramer's rule.

A zero determinant means the system has no unique solution (no solutions, or infinitely many) — the equations are either inconsistent or dependent.

Starting values: the two-equation mode opens with 2x + 3y = 8 and 5x − y = 3, which gives x = 1, y = 2 and a determinant of −17. The three-equation mode opens with x + y + z = 6, y + 2z = 9 and x + 2y + z = 8, which gives x = 0.5, y = 2, z = 3.5 and a determinant of −2.

How Cramer’s rule works

Cramer’s rule solves a system by dividing determinants. The coefficient determinant D is built from the numbers in front of the variables. To find a variable, replace its column with the constants, take that determinant, and divide by D. A college algebra text states the method for any system with as many equations as unknowns.

Two equations

For a1x + b1y = c1 and a2x + b2y = c2:

D = a1b2 − a2b1
x = (c1b2 − c2b1) ÷ D
y = (a1c2 − a2c1) ÷ D

Three equations

For aix + biy + ciz = di, the calculator computes four 3×3 determinants. D uses the coefficient columns. Dx, Dy and Dz swap the x, y or z column for the constants d1, d2, d3. Then x = Dx ÷ D, y = Dy ÷ D and z = Dz ÷ D.

Where:

  • a, b, c = the coefficients of x, y and z
  • c (in the two-equation form) and d (in the three-equation form) = the constants on the right-hand side
  • D = the coefficient determinant

What a zero determinant means

If D = 0, Cramer’s rule cannot give a single answer. The system then has either no solution (the equations contradict each other) or infinitely many (the equations describe the same line or plane). The algebra text notes that a determinant of zero signals this, and that you need another method, such as elimination, to tell the two cases apart.

Be careful when you read the calculator’s output in this case. When D is zero, the tool displays 0 for x, y and z and 0 for the determinant. Those zeros are not a solution. If you see a determinant of 0, treat the system as having no unique solution.

Worked examples

Example 1: the two-equation default

2x + 3y = 8 and 5x − y = 3.

  1. D = (2)(−1) − (5)(3) = −2 − 15 = −17.
  2. x = (8 × −1 − 3 × 3) ÷ −17 = (−8 − 9) ÷ −17 = 1.
  3. y = (2 × 3 − 5 × 8) ÷ −17 = (6 − 40) ÷ −17 = 2.

Check: 2(1) + 3(2) = 8 and 5(1) − 2 = 3. Both equations hold.

Example 2: a textbook system

12x + 3y = 15 and 2x − 3y = 13. D = 12(−3) − 2(3) = −42. x = (15(−3) − 13(3)) ÷ −42 = −84 ÷ −42 = 2. y = (12(13) − 2(15)) ÷ −42 = 126 ÷ −42 = −3. The solution is x = 2, y = −3, matching the algebra text’s worked answer.

Example 3: the three-equation default

x + y + z = 6, y + 2z = 9, x + 2y + z = 8. The determinant is D = −2. Solving gives x = 0.5, y = 2 and z = 3.5. A quick check by elimination: subtracting the first equation from the third gives y = 2, then 2z = 9 − 2 = 7, so z = 3.5, and x = 6 − 2 − 3.5 = 0.5. The calculator and the check agree.

Example 4: no unique solution

x + y = 2 and 2x + 2y = 5. D = (1)(2) − (2)(1) = 0. The second equation’s left side is twice the first, but 5 is not twice 2, so the equations contradict each other and there is no solution. The calculator would show a determinant of 0, so this is your signal to stop.

Cramer’s rule against other methods

Cramer’s rule is clean for small systems and gives a formula you can check by hand. For larger systems, the number of determinants grows quickly and elimination is more practical, so the calculator stops at three equations. When your equations are not linear, or you have more unknowns than equations, a different method is needed.

Entering your system

  • Put every equation in the form ax + by = c with the variables on the left and the constant on the right.
  • Enter 0 for a missing variable. For y + 2z = 9, enter a2 = 0, b2 = 1, c2 = 2.
  • Watch signs: x − y has a coefficient of −1 on y.
  • Results are shown to five decimal places, so fractions appear as decimals.

If your equation has x squared, use the quadratic formula calculator instead.

Expanding the three-by-three determinant

For the three-equation mode, each determinant is expanded along the first row. With rows (a1, b1, c1), (a2, b2, c2) and (a3, b3, c3):

D = a1(b2c3 − b3c2) − b1(a2c3 − a3c2) + c1(a2b3 − a3b2)

For the default system the rows are (1, 1, 1), (0, 1, 2) and (1, 2, 1). The first term is 1 × (1 × 1 − 2 × 2) = −3. The second is −1 × (0 × 1 − 1 × 2) = 2. The third is 1 × (0 × 2 − 1 × 1) = −1. Adding them gives D = −3 + 2 − 1 = −2, the value the calculator reports.

Example 5: a system with a negative coefficient

x − y = 1 and x + y = 5. Here a1 = 1, b1 = −1, a2 = 1 and b2 = 1, so D = (1)(1) − (1)(−1) = 2. Then x = (1 × 1 − 5 × (−1)) ÷ 2 = 6 ÷ 2 = 3, and y = (1 × 5 − 1 × 1) ÷ 2 = 2. Adding the two equations confirms it: 2x = 6, so x = 3 and y = 2.

Frequently asked questions

What does it mean if the determinant is zero?

The system has no unique solution. It either has no solution at all or infinitely many. The calculator shows zeros in this case, which are not an answer. Use elimination to find out which case applies.

Can it solve more than three equations?

No. The calculator handles two equations in two unknowns or three equations in three unknowns.

How do I enter a missing variable?

Enter 0 as its coefficient. For y + 2z = 9, the coefficient of x is 0, of y is 1 and of z is 2.

What is Cramer’s rule?

It is a method that solves each unknown by dividing one determinant by another. The coefficient determinant D forms the denominator, and the numerator replaces the unknown’s column with the constants.

Mark Danny

Mark Danny

Mark Danny builds and maintains the free calculators and guides on Area of Irregular Shapes Calculator. Every calculator page explains its formula and shows a worked example, so you can check the working yourself. Spotted a mistake or have a suggestion? Email gulsher.hingoro101@gmail.com.

Articles: 699