System of 3 Linear Equations Calculator (3×3)

Enter the nine coefficients and three constants of a system in the form ax + by + cz = d and this calculator solves it by Cramer's rule, showing the four determinants it used. When the coefficient determinant is zero there is no unique solution, and the calculator distinguishes the two reasons why: an inconsistent system whose planes never meet, and a dependent one whose planes share a whole line or plane of solutions. Every unique solution is substituted back into all three equations so you can see the residuals for yourself.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
x coefficientCoefficient of x in the first equation.2
y coefficientCoefficient of y in the first equation.1
z coefficientCoefficient of z in the first equation.-1
Constant on the rightMove every constant to the right-hand side before entering it.8
x coefficientCoefficient of x in the second equation.-3
y coefficientCoefficient of y in the second equation.-1
z coefficientCoefficient of z in the second equation.2
Constant on the rightThe value the second equation equals.-11
x coefficientCoefficient of x in the third equation.-2
y coefficientCoefficient of y in the third equation.1
z coefficientCoefficient of z in the third equation.2
Constant on the rightThe value the third equation equals.-3

It returns

  • x — Shown only when the system has exactly one solution.
  • y
  • z
  • Determinant of the coefficient matrix — Zero means the three planes do not meet at a single point.
  • Type of system — Unique, inconsistent (no solution), or dependent (infinitely many).
  • Largest residual on substitution — How far the solution misses each equation. Should be near zero.

The formula

xi=det(Ai)det(A)
det(A)=a(eifh)b(difg)+c(dheg)

In plain text: x = det(Aₓ)/det(A), y = det(A_y)/det(A), z = det(A_z)/det(A)

  • AThe 3×3 matrix of coefficients (—)
  • AᵢA with its i-th column replaced by the constants (—)
  • detDeterminant, expanded along the first row (—)

Cramer's rule is valid only when det(A) ≠ 0. A zero determinant means the system has either no solution or infinitely many, and the ranks decide which.

Updated Category Equations, Systems & Polynomials Verified against published test cases Reading time 12 min

What a 3×3 system is asking, geometrically

Each equation ax + by + cz = d describes a plane in three-dimensional space. Solving the system means finding the points that lie on all three planes at once. That geometric reading tells you immediately why there are exactly three possible answers rather than one.

Three planes in general position meet at a single point, and that point is the unique solution. But planes can be arranged so that no point is common to all three — two of them parallel, or three forming a triangular prism whose faces pairwise intersect in three parallel lines that never coincide. And they can be arranged so that they share more than a point: two planes coinciding, or all three passing through a common line. Those are the inconsistent and dependent cases, and no amount of algebra will produce a single (x, y, z) from either.

The determinant of the coefficient matrix is what distinguishes the first case from the other two. It measures the volume of the parallelepiped spanned by the three coefficient rows, so it is zero exactly when those three direction vectors are coplanar — which is exactly when the three planes fail to pin down a point. A non-zero determinant guarantees a unique solution; a zero determinant guarantees there is not one, and says nothing about which of the two failures you have.

To tell those apart you need the ranks. The rank of a matrix is the number of genuinely independent rows left after elimination. If the coefficient matrix and the augmented matrix (coefficients plus constants) have the same rank, the equations are consistent and the shortfall from three is the number of free parameters in the answer. If attaching the constants raises the rank, elimination has produced a row saying that a non-zero number equals zero, and the system has no solution at all.

Cramer's rule and how the determinants are built

Cramer's rule solves for each unknown independently. Write the coefficient matrix A and the constant vector b. Form three more matrices by replacing one column of A at a time with b: Ax replaces the first column, Ay the second, Az the third. Then

x = det(Aₓ)/det(A)   y = det(Aᶐ)/det(A)   z = det(A₼)/det(A)

The 3×3 determinant expanded along the first row is

det = a(ei − fh) − b(di − fg) + c(dh − eg)

for the matrix with rows (a b c), (d e f), (g h i). The alternating signs are not decoration; they come from the definition of the determinant as a signed sum over permutations, and getting one of them wrong is the most common hand-calculation error in this subject. If you prefer, the matrix determinant calculator evaluates the same expression on its own.

Cramer's rule is exact, it is easy to check by hand, and it makes the role of the determinant unmistakable — which is why it is taught. It is not what numerical software uses. Solving an n×n system by Cramer's rule costs on the order of n determinant evaluations, which is catastrophically expensive as n grows, while Gaussian elimination solves the whole system in one pass. For three unknowns the difference is irrelevant and the transparency is worth having; for thirty it is not.

This calculator does use elimination for one job: computing the two ranks. Determinants alone cannot distinguish an inconsistent system from a dependent one, because both have det(A) = 0. Elimination with partial pivoting — always choosing the largest available pivot — reduces the augmented matrix to a staircase form in which the two ranks can simply be counted. Partial pivoting matters even at this size, because dividing by a small pivot amplifies rounding error in everything downstream.

Worked example: 2x + y − z = 8, −3x − y + 2z = −11, −2x + y + 2z = −3

Write the coefficient matrix and the constants:

A = [2 1 −1; −3 −1 2; −2 1 2]   b = (8, −11, −3)

  1. det(A). 2[(−1)(2) − (2)(1)] − 1[(−3)(2) − (2)(−2)] + (−1)[(−3)(1) − (−1)(−2)]
    = 2(−2 − 2) − 1(−6 + 4) − 1(−3 − 2) = −8 + 2 + 5 = −1. Non-zero, so there is exactly one solution.
  2. det(Aₓ), replacing the first column with the constants: 8[(−1)(2) − (2)(1)] − 1[(−11)(2) − (2)(−3)] + (−1)[(−11)(1) − (−1)(−3)]
    = 8(−4) − 1(−22 + 6) − 1(−11 − 3) = −32 + 16 + 14 = −2.
  3. det(Aᶐ), replacing the second column: 2[(−11)(2) − (2)(−3)] − 8[(−3)(2) − (2)(−2)] + (−1)[(−3)(−3) − (−11)(−2)]
    = 2(−16) − 8(−2) − 1(9 − 22) = −32 + 16 + 13 = −3.
  4. det(A₼), replacing the third column: 2[(−1)(−3) − (−11)(1)] − 1[(−3)(−3) − (−11)(−2)] + 8[(−3)(1) − (−1)(−2)]
    = 2(3 + 11) − 1(9 − 22) + 8(−3 − 2) = 28 + 13 − 40 = 1.
  5. Divide. x = −2 ÷ −1 = 2; y = −3 ÷ −1 = 3; z = 1 ÷ −1 = −1.

Check by substitution, which is the step most people skip and the one that catches sign errors:

  • 2(2) + 3 − (−1) = 4 + 3 + 1 = 8. ✓
  • −3(2) − 3 + 2(−1) = −6 − 3 − 2 = −11. ✓
  • −2(2) + 3 + 2(−1) = −4 + 3 − 2 = −3. ✓

All three residuals are exactly zero, so (2, 3, −1) is the point where the three planes meet.

Reading the determinant, the verdict and the residuals

The determinant's magnitude is only meaningful relative to the coefficients. Multiplying every equation by 10 multiplies det(A) by 1,000 without changing the solution at all, so “det = 0.001” means nothing on its own. What matters is the ratio of the determinant to the cube of the largest coefficient, which is roughly what this calculator tests before warning about conditioning. A system whose determinant is tiny relative to its coefficients has planes meeting at a shallow angle: the solution exists, but small changes in the inputs move it a long way, and the last few digits of the answer are noise.

An inconsistent verdict means the equations contradict each other, not that you mistyped. Adding the first two equations and comparing with the third often shows the contradiction directly. In applications this is usually informative rather than annoying: three sensor readings that cannot all be true point at a calibration problem, and three budget constraints with no feasible point tell you which one to relax.

A dependent verdict means you have fewer independent equations than unknowns. Rank 2 leaves one free parameter, so the solutions form a line; rank 1 leaves two, so they form a plane. The answer is a family, not a point, and reporting any single member of it as “the” solution is wrong. You need another independent equation before a unique answer exists.

The residual table is the honest check. Substituting the solution back into the original equations should reproduce the right-hand sides to within rounding error — typically a residual around 10−15 relative to the coefficient sizes, since that is the resolution of double-precision arithmetic. A residual materially larger than that means cancellation has eaten the precision of the determinants, which happens when coefficients differ by many orders of magnitude. Rescaling each equation so its largest coefficient is about 1 usually fixes it.

What the two ranks tell you about the solution set

r(A) counts the independent equations; r([A|b]) counts them again with the constants attached. Their difference decides consistency, and the shortfall of r(A) from 3 counts the free parameters.
r(A)r([A|b])Geometry of the three planesSolution set
33Meet at a single pointOne solution
23Prism, or two parallel planes cut by a thirdNone
22All three share a common lineA line: one free parameter
12Parallel distinct planesNone
11All three are the same planeA plane: two free parameters
01All coefficients zero, some constant notNone
00Every equation is 0 = 0All of space: three free parameters

Consistency requires r(A) = r([A|b]); the number of free parameters is then 3 − r(A). Only the first row admits Cramer's rule, because it is the only one with det(A) ≠ 0.

Mistakes that produce a confidently wrong answer

  • Not putting the system in standard form first. Every equation must read ax + by + cz = d with all variables on the left and the constant on the right. An equation like 2x + 5 = 3y − z becomes 2x − 3y + z = −5.
  • Omitting a missing variable instead of entering zero. If an equation has no z term, its z coefficient is 0. Leaving the field at some other value silently solves a different system.
  • Dropping the minus sign in the middle term of the determinant. The expansion alternates + − +. This single error accounts for most wrong hand-computed determinants.
  • Replacing a row instead of a column when forming Aₓ. Cramer's rule replaces the column corresponding to the unknown you are solving for.
  • Reading a near-zero determinant as zero. A determinant of 10−9 from coefficients of order 1 is probably an exactly singular system reported through rounding error, but a determinant of 10−9 from coefficients of order 10−3 is a perfectly ordinary well-conditioned system.
  • Reporting one member of an infinite solution set as the answer. A dependent system has a line or plane of solutions; picking a point on it and calling it the solution discards the free parameter.

Other ways to solve the same system, and when to use them

Gaussian elimination is the general-purpose method: use row operations to reach an upper-triangular form, then back-substitute. It handles any size, it tells you the rank as a by-product, and with partial pivoting it is numerically stable. It is what you should use by hand for anything larger than 3×3 and what every numerical library uses internally.

The matrix inverse solves the system as x = A−1b. It is the right tool when you have many different right-hand sides against one fixed coefficient matrix, since the inverse is computed once and reused. For a single solve it is wasteful and less accurate than elimination. The matrix inverse calculator produces A−1, and matrix multiplication applies it to b.

Substitution and elimination by hand remain the fastest route when the numbers are friendly — particularly when one equation already has a variable isolated, as in the textbook system 2y + 5z = −4 with no x at all. For two unknowns the 2×2 simultaneous equations calculator covers the same ground with less bookkeeping, and a single unknown is the linear equation solver.

Two extensions are worth knowing about. When you have more equations than unknowns and no exact solution exists — the usual situation with measured data — the right question changes from “which point satisfies all of them” to “which point minimises the total squared residual”, and the answer is least squares rather than Cramer's rule. And when the system is homogeneous, meaning all three constants are zero, it always has the trivial solution (0, 0, 0); a non-trivial solution exists exactly when det(A) = 0, which is the condition that defines eigenvalues.

Frequently asked questions

What does a determinant of zero mean for my system?

That the three planes do not meet at a single point, so there is no unique solution. It does not tell you which failure you have. If the constants are consistent with the coefficients the planes share a whole line or plane and there are infinitely many solutions; if they are not, the planes never all meet and there are none. Comparing the rank of the coefficient matrix with the rank of the augmented matrix is what separates the two cases, and this calculator reports the verdict directly.

How do I enter an equation that is missing a variable?

Enter zero as its coefficient. The equation 2y + 5z = −4 has an x coefficient of 0, so the first field for that row is 0, not blank and not left at a default. Every 3×3 system has nine coefficients whether or not all nine are visible in how the equations were written, and omitting one silently solves a different system.

Is Cramer's rule better than Gaussian elimination?

Not for computation, only for exposition. Cramer's rule makes the role of the determinant obvious and is easy to check by hand at this size, but it needs four determinant evaluations where elimination needs one pass, and the gap grows explosively with the number of unknowns. Numerical libraries all use elimination with pivoting. For three unknowns either is fine, which is why this calculator shows Cramer's determinants and uses elimination for the rank test.

Why is my answer not exact when it should be a whole number?

Because the determinants are computed in binary floating point, where sums of products lose a few digits to rounding. A residual around 10−15 relative to your coefficients is normal and means the answer is a whole number displayed with rounding dust. A residual materially larger than that signals real cancellation, usually because your coefficients span many orders of magnitude; rescaling each equation so its largest coefficient is around 1 will usually clear it.

What does an ill-conditioned system mean in practice?

That the solution exists but is hypersensitive to the inputs. Geometrically the three planes meet at a very shallow angle, so nudging one coefficient in the fifth decimal place can move the intersection point substantially. The warning fires when the determinant is small relative to the cube of the largest coefficient. If your coefficients come from measurements, treat the trailing digits of an ill-conditioned answer as meaningless and quote fewer of them.

Can a 3×3 system have exactly two solutions?

No. A linear system has zero, one, or infinitely many solutions, never two or seventeen. The reason is that if two distinct points both satisfy every equation, then so does every point on the line joining them, because linear equations are preserved under taking weighted averages of solutions. Finitely many solutions greater than one is impossible for a linear system, though it is entirely possible for a polynomial one.

How do I write out an infinite solution set?

Pick the free variables and express the others in terms of them. With rank 2 there is one free parameter: set z = t, then solve the two independent equations for x and y as functions of t, giving a parametric line such as (1 − t, 2t, t). With rank 1 there are two free parameters and the answer is a plane. Reporting a single point from such a family is a real error, not a simplification.

What if all three constants are zero?

Then the system is homogeneous and (0, 0, 0) always solves it. The interesting question becomes whether anything else does, and the answer is yes exactly when the determinant is zero. This calculator will report a dependent system in that case, because the ranks agree. Homogeneous systems with a non-trivial solution are the foundation of eigenvalue problems, where you deliberately tune a parameter until the determinant vanishes.

References

  • Linear Algebra and Its Applications, 6th edition — Pearson (David C. Lay, Steven R. Lay and Judi J. McDonald)
  • Introduction to Linear Algebra, 5th edition — Wellesley-Cambridge Press (Gilbert Strang)
  • Matrix Computations, 4th edition (pivoting and conditioning) — Johns Hopkins University Press (Golub and Van Loan)