You solve a system of three linear equations by eliminating variables until one equation has one unknown, then back-substituting. The reliable method is Gaussian elimination with partial pivoting, and the method you should reach for first is usually substitution when one equation is already solved for a variable. Every method below converges on the same triple, so the real skill is picking the cheapest route and spotting the degenerate cases β€” zero solutions or infinitely many β€” before you burn ten minutes on arithmetic.

Take this system, which I'll carry through every method:

2x + y βˆ’ z = 5 x βˆ’ y + 2z = 1 3x + 2y + z = 10

The solution is x = 2, y = 3, z = 2. Verify it in the third equation: 6 + 6 + 2 = 14, which doesn't equal 10. Let me fix that constant before anything else β€” the third equation should read 3x + 2y + z = 14. Now it holds: 6 + 6 + 2 = 14. Check the first: 4 + 3 βˆ’ 2 = 5. Check the second: 2 βˆ’ 3 + 4 = 3, not 1, so the second equation's constant is 3. Final system:

2x + y βˆ’ z = 5 x βˆ’ y + 2z = 3 3x + 2y + z = 14

Solution: x = 2, y = 3, z = 2. Every worked line below produces these three numbers.

Elimination by Addition Produces the Solution in Six Moves

Elimination means adding multiples of one equation to another so a variable cancels. Work in a fixed order and write every intermediate system down; the written record is what catches a dropped sign. Use the system above, where the first equation contains +y and the second contains βˆ’y, so adding them directly kills y.

Step 1. Add equation 1 and equation 2: (2x + x) + (y βˆ’ y) + (βˆ’z + 2z) = 5 + 3, giving 3x + z = 8. Call this equation 4.

Step 2. Eliminate y again using equations 2 and 3. Multiply equation 2 by 2: 2x βˆ’ 2y + 4z = 6. Add to equation 3: (3x + 2x) + (2y βˆ’ 2y) + (z + 4z) = 14 + 6, giving 5x + 5z = 20, or x + z = 4. Call this equation 5.

Step 3. Subtract equation 5 from equation 4: (3x βˆ’ x) + (z βˆ’ z) = 8 βˆ’ 4, so 2x = 4 and x = 2.

Step 4. Substitute x = 2 into equation 5: 2 + z = 4, so z = 2.

Step 5. Substitute x = 2 and z = 2 into equation 1: 4 + y βˆ’ 2 = 5, so y = 3.

Step 6. Check in equation 3: 6 + 6 + 2 = 14. Confirmed.

If a subtraction step produces a fraction, that is not an error β€” it is the cost of choosing a poor pivot. Prefer eliminating a variable whose coefficients divide cleanly into each other; here the y-column coefficients are 1, βˆ’1, and 2, so pairing equations 1 and 2 first keeps everything integral. When the final single-variable equation arrives as, say, 6x = 7, don't restart β€” carry x = 7/6 forward and substitute. Rounding early is the single most common way students get a triple that fails the check.

One edge scenario worth naming: if Step 3 had produced 0 = 0 instead of 2x = 4, the system would have infinitely many solutions and you'd need a parameter. If it had produced 0 = 5, there would be no solution. Both cases get full treatment later, because they are where most textbook answers and automated checkers disagree with hand work.

Substitution Wins When One Equation Is Already Isolated

The substitution method costs less arithmetic when an equation reads like z = 4x βˆ’ 1 or y = 2x + 3. Isolate one variable in one equation, substitute it into the other two, and you drop from three equations to two.

Use the same system. From equation 2, x βˆ’ y + 2z = 3, isolate x: x = y βˆ’ 2z + 3. Substitute into equation 1: 2(y βˆ’ 2z + 3) + y βˆ’ z = 5, giving 2y βˆ’ 4z + 6 + y βˆ’ z = 5, so 3y βˆ’ 5z = βˆ’1. Substitute into equation 3: 3(y βˆ’ 2z + 3) + 2y + z = 14, giving 3y βˆ’ 6z + 9 + 2y + z = 14, so 5y βˆ’ 5z = 5, or y βˆ’ z = 1.

Now solve the two-equation pair. From y βˆ’ z = 1, y = z + 1. Substitute into 3y βˆ’ 5z = βˆ’1: 3(z + 1) βˆ’ 5z = βˆ’1, so 3z + 3 βˆ’ 5z = βˆ’1, giving βˆ’2z = βˆ’4 and z = 2. Then y = 3, and back in the isolated form, x = 3 βˆ’ 4 + 3 = 2.

The method's failure mode is algebraic bloat: if the isolated expression carries fractions, every later line carries them too. A rule of thumb β€” if the isolated expression has a denominator other than 1, switch to elimination, because elimination's integers are cheaper than substitution's fractions. This is exactly the guidance a good algebra textbook gives when it presents both methods side by side, and it holds whether you're working by hand or checking with a solver.

Substitution also exposes structure. If substituting produces 0 = 0 for one of the two-equation pairs, the original three planes share a line; if it produces a contradiction, they share nothing. You learn the geometry from the arithmetic.

Cramer's Rule: A Determinant Check in About Four Minutes

Cramer's rule expresses each unknown as a ratio of determinants: x = Dx / D, y = Dy / D, z = Dz / D, where D is the determinant of the coefficient matrix and Dx, Dy, Dz replace the relevant column with the constants. It's the fastest method to state and the slowest to compute by hand for large coefficients, but it earns its place as a cross-check.

For the coefficient matrix with rows (2, 1, βˆ’1), (1, βˆ’1, 2), (3, 2, 1), expand along the first row: D = 2[(βˆ’1)(1) βˆ’ (2)(2)] βˆ’ 1[(1)(1) βˆ’ (2)(3)] + (βˆ’1)[(1)(2) βˆ’ (βˆ’1)(3)] = 2(βˆ’5) βˆ’ 1(βˆ’5) βˆ’ 1(5) = βˆ’10 + 5 βˆ’ 5 = βˆ’10.

Replace the x-column with (5, 3, 14): Dx = 5[(βˆ’1)(1) βˆ’ (2)(2)] βˆ’ 1[(3)(1) βˆ’ (2)(14)] + (βˆ’1)[(3)(2) βˆ’ (βˆ’1)(14)] = 5(βˆ’5) βˆ’ 1(βˆ’25) βˆ’ 1(20) = βˆ’25 + 25 βˆ’ 20 = βˆ’20. So x = βˆ’20 / βˆ’10 = 2.

Replace the y-column with (5, 3, 14): Dy = 2[(3)(1) βˆ’ (14)(2)] βˆ’ 5[(1)(1) βˆ’ (2)(3)] + (βˆ’1)[(1)(14) βˆ’ (3)(3)] = 2(βˆ’25) βˆ’ 5(βˆ’5) βˆ’ 1(5) = βˆ’50 + 25 βˆ’ 5 = βˆ’30. So y = βˆ’30 / βˆ’10 = 3.

Replace the z-column with (5, 3, 14): Dz = 2[(βˆ’1)(14) βˆ’ (3)(2)] βˆ’ 1[(1)(14) βˆ’ (3)(3)] + 5[(1)(2) βˆ’ (βˆ’1)(3)] = 2(βˆ’20) βˆ’ 1(5) + 5(5) = βˆ’40 βˆ’ 5 + 25 = βˆ’20. So z = βˆ’20 / βˆ’10 = 2.

The decisive number is D. If D = 0, Cramer's rule fails outright β€” you cannot divide by zero β€” and the system is either inconsistent or underdetermined. That single check makes Cramer's rule the best first move when a problem asks whether a solution exists before asking what it is.

Row Reduction: The Method That Scales Past Three Variables

Row reduction, or Gaussian elimination, writes the system as an augmented matrix and applies three legal row operations: swap two rows, multiply a row by a nonzero constant, add a multiple of one row to another. It is the method every computer algebra system uses internally, and it is the only one below that generalizes cleanly to ten or a hundred unknowns.

Start with the augmented matrix:

2 1 βˆ’1 5
1 βˆ’1 2 3
3 2 1 14

Swap row 1 and row 2 so the pivot is 1, then subtract twice row 1 from row 2 and three times row 1 from row 3:

1 βˆ’1 2 3
0 3 βˆ’5 βˆ’1
0 5 βˆ’5 5

Subtract (5/3) of row 2 from row 3 to clear the third entry, then eliminate upward to get the identity matrix on the left. The right-hand column lands on (2, 3, 2). I'm compressing the upward elimination because the arithmetic is mechanical and the structure is what matters: forward elimination creates zeros below the diagonal, back-substitution resolves the unknowns from the bottom up.

Where row reduction earns its keep is pivoting. If the top-left entry is 0, a naive hand calculation stalls; partial pivoting swaps in the row with the largest absolute value in that column, which also reduces rounding error in floating-point work. Structured-pivot failures are the reason a calculator can return garbage on a system a human solves fine β€” for example, a coefficient matrix where the first pivot is 1e-18 in floating point. In exact-fraction arithmetic, as in SymPy or Mathematica, that problem disappears.

Which Method to Pick: A Four-Row Comparison

Method Best when Worst when Arithmetic at three variables
Elimination Coefficients are small integers with matching or opposite terms Coefficients are large primes; signs get dropped About 12–20 multiplication steps
Substitution One equation is already solved for a variable The isolated expression has a non-unit denominator About 20–30 steps, more with fractions
Cramer's rule You need to know whether a unique solution exists Any determinant is 0; matrices are 4Γ—4 or larger Four 3Γ—3 determinants, about 48 multiplied terms
Row reduction You want one procedure that scales to n variables You do it by hand without pivoting discipline About 15 row operations to reduced form

The determinant count in that table is worth explaining, because it's the number students underestimate: each 3Γ—3 determinant is six products of three factors, and Cramer's rule needs four of them, so 24 products and 24 signed sums before any division. Elimination reaches the same triple with roughly a third of that bookkeeping.

Pick elimination for a homework problem with small whole-number coefficients. Pick substitution when a variable is already isolated. Pick Cramer's rule when the question is "does this have a unique solution?" or when you're checking someone else's answer. Pick row reduction when the system has four or more unknowns, when coefficients aren't integers, or when you'll write code.

Zero Solutions or Infinitely Many: Reading the Signs Before You Finish

A three-variable linear system has exactly one solution, no solution, or infinitely many β€” never exactly two. Geometrically, each equation is a plane, and the three planes can meet at a point, share a line, coincide, or miss each other entirely. Two parallel planes with a third cutting through them produce no common point at all.

Run elimination on this system: x + y + z = 1, 2x + 2y + 2z = 3, x βˆ’ y = 0. Subtracting twice the first equation from the second gives 0 = 1, an immediate contradiction, so the system is inconsistent. No amount of substitution repairs it β€” the second equation's left side is exactly twice the first's, but its right side is three times the first's, which is impossible for any triple.

Run it on this one: x + y + z = 2, 2x + 2y + 2z = 4, x βˆ’ y + z = 0. Here the second equation is exactly twice the first, so it adds no information. Elimination leaves two independent equations in three unknowns, and the solution set is a line β€” infinitely many triples, conventionally written with a free parameter, say z = t, then x and y in terms of t. A solver that returns "no unique solution" or a parameterized family is telling you the truth; a solver that silently picks one point is not.

The practical trigger: during elimination, if a row reduces to all zeros on the left and a nonzero constant on the right, stop β€” inconsistency confirmed. If it reduces to all zeros including the constant, you've lost a constraint and the system is underdetermined. Both checks take ten seconds and save the rest of the calculation.

From Hand Algebra to Python: Setting Up a Matrix Solver Correctly

In NumPy, the call is numpy.linalg.solve(A, b) where A is the 3Γ—3 coefficient matrix and b is the constant vector; it returns the triple as a float array. For the worked system, A is [[2, 1, βˆ’1], [1, βˆ’1, 2], [3, 2, 1]] and b is [5, 3, 14]. The function raises LinAlgError: Singular matrix when the matrix is not invertible, which is the machine's version of D = 0 β€” and that error is the correct answer for inconsistent and underdetermined systems alike, though it doesn't tell you which one you have.

In SymPy, sympy.linsolve or Matrix(A).inv() * b works in exact rational arithmetic and returns EmptySet for inconsistent systems and a parameterized family for underdetermined ones. That distinction β€” one error for both degenerate cases in floating point, two distinct answers in exact arithmetic β€” is the reason engineers prototyping a solver use exact arithmetic first and floating point only for speed.

Ordering matters in code. Place the equation with the largest absolute coefficient first in any column you're pivoting on, and scale rows so units match before solving. A system mixing millimetres and metres produces a coefficient matrix with entries differing by three orders of magnitude, and double precision loses digits silently. If your solver output fails a substitution check by more than about 1e-8 on data of that scale, the problem is conditioning, not the solver.

Word Problems: Translating Three Unnamed Quantities Into a 3Γ—3 System

Most "how to solve" questions that arrive as word problems fail at translation, not algebra. The recipe: name the three unknowns explicitly, write one equation per stated relationship, and confirm you have three independent facts before solving. If the problem gives only two facts for three unknowns, the answer is a family, not a number.

Concrete example: a student buys three notebooks, two pens, and one folder for $14; one notebook, one pen, and two folders for $9; two notebooks, three pens, and one folder for $15. Let n, p, f be the unit prices. The equations mirror the purchases exactly, and elimination gives n = $2, p = $3, f = $2. Check: 6 + 6 + 2 = 14. Every unit checks against every stated cost.

The failure case here is mistranslation of "more than" or "less than" clauses. "A is twice B less three" is not 2A = B βˆ’ 3; the correct reading depends on the writer, and good problems avoid that phrasing. When a word problem produces a negative price or a non-integer count of physical objects, treat the translation as wrong before treating the algebra as wrong.

Insider note: standardized tests and contest problems frequently hide the third equation as a total or a ratio. "The sum of the three numbers is 18" is an equation; "the ratio of the first to the second is 2:3" is an equation once cross-multiplied. Count your equations against your unknowns before solving β€” it's the fastest diagnostic in the room.

Arithmetic Slips, Sign Errors, and the Check That Catches Them

The check is substitution into all three original equations, and it catches nearly everything. If your triple fails one equation but satisfies the other two, you made an arithmetic slip during back-substitution in that equation's column. If it fails all three, the slip happened during elimination. That diagnostic alone tells you where to look.

Sign errors cluster in two places: distributing a negative across a parenthesized expression, and subtracting an entire equation row. When subtracting equation 5 from equation 4 earlier, every term on the right side changes sign, not just the leading one. A cheap discipline: write the subtraction as addition of the negated row, expending one extra line to save the error.

Order the check to test the equation you used least. In the worked example, equation 3 was only touched in two places, so it is the most independent confirmation. Re-checking an equation you used in every step confirms your arithmetic against itself.

The deepest trap is rounding mid-calculation. If x comes out 7/6, carry the fraction through; converting to 1.1667 and substituting onward can push a final check off by 0.0001 and turn a correct solution into an apparent failure. In exams and engineering work alike, keep exact fractions until the final answer, and only then decide your reporting precision.

FAQ

What if all three equations are parallel planes?

There is no solution, and the system is inconsistent. Parallel planes share no common point, so no triple satisfies all three simultaneously. During elimination this shows up as a row reducing to a nonzero constant equal to zero, like 0 = 3. Stop immediately and report "no solution" rather than continuing.

Can a three-variable system have exactly two solutions?

No β€” it can have one, zero, or infinitely many. The solution set of linear equations is either a single point, an empty set, a line, or a plane, and "exactly two points" fits none of those shapes. If a problem or solver implies two answers, one equation is nonlinear or the question is misstated.

Does Cramer's rule work when the determinant is tiny but nonzero?

It works mathematically but fails practically. A determinant near zero means the matrix is ill-conditioned, so small input changes swing the answer wildly and floating-point rounding dominates. In exact arithmetic the answer is still valid; in float, prefer numpy.linalg.solve or pivoted row reduction and check conditioning with numpy.linalg.cond.

How long should a three-equation solve take by hand?

Elimination on small integer coefficients takes most students six to ten minutes including the check. Cramer's rule takes longer β€” four 3Γ—3 determinants, roughly 48 multiplied terms β€” because of sheer bookkeeping. If you're spending more than fifteen minutes, a coefficient was misread or a sign was dropped; restart with a written system.

What's the difference between Gaussian elimination and Gauss-Jordan?

Gaussian elimination stops at upper triangular form and uses back-substitution; Gauss-Jordan continues to reduced row echelon form, producing each answer directly without back-substituting. Gauss-Jordan needs more row operations but teaches the structure of the solution more clearly, which is why many textbooks use it first.

Why does my calculator say "singular matrix" when the system has a solution?

It doesn't β€” a singular matrix means no unique solution exists. Inconsistent and infinitely-many systems both produce singular matrices, and floating-point libraries collapse them into one error. Use exact arithmetic (SymPy, or a CAS with rationals) to tell the two cases apart.

Is there a formula like the quadratic formula for three equations?

Cramer's rule is that formula, expressed with determinants, and it applies to any size of square system. The catch is cost: for three variables it needs four 3Γ—3 determinants, and for ten variables the factorial growth makes it impractical. Row reduction is the algorithmic version of the same idea and scales far better.