Solving Systems of Linear Equations
Interactive course for up to 4 unknowns
Solving Systems of Linear Equations
Learn the standard methods for solving systems with 2, 3, or 4 unknowns — substitution, elimination, and Gaussian elimination (matrix method).
What is a system of linear equations?

A system of linear equations is a collection of equations that share the same set of unknowns (variables), where every term is either a constant or a constant times one variable — no squares, products of variables, or other nonlinear terms. Solving the system means finding the values of every unknown that satisfy all equations simultaneously.

Example (2 unknowns) 2x + 3y = 12
4x − y = 10

A system with n unknowns generally needs n independent equations to have exactly one solution.

Three standard methods

Substitution

Solve one equation for one variable, then substitute that expression into the other equations. Best for small systems (2 unknowns) or when one equation is already simple.

Elimination

Add or subtract multiples of equations to cancel out one variable at a time, reducing the system step by step. Works well for 2–3 unknowns.

Gaussian Elimination (Matrix Method)

Write the system as an augmented matrix and use row operations to reach row-echelon form, then back-substitute. Scales cleanly to 3 or 4 unknowns.

Worked example — Substitution (2 unknowns)
System 2x + 3y = 12   (1)
4x − y = 10   (2)
Step 1 — solve (2) for y y = 4x − 10
Step 2 — substitute into (1) 2x + 3(4x − 10) = 12
2x + 12x − 30 = 12
14x = 42
x = 3
Step 3 — back-substitute y = 4(3) − 10 = 2

Solution: x = 3, y = 2

Worked example — Elimination (2 unknowns)
System x + y = 10   (1)
x − y = 2   (2)
Step 1 — add (1) and (2) to eliminate y 2x = 12
x = 6
Step 2 — substitute back into (1) 6 + y = 10
y = 4

Solution: x = 6, y = 4

Worked example — Gaussian Elimination (3 unknowns)
System x + y + z = 6   (1)
2y + 5z = −4   (2)
2x + 5y − z = 27   (3)
Step 1 — eliminate x from (3) using (1): (3) − 2×(1) 2x + 5y − z − 2(x + y + z) = 27 − 2(6)
3y − 3z = 15
Step 2 — now solve the 2×2 system in y, z 2y + 5z = −4
3y − 3z = 15  →  y − z = 5
Step 3 — substitute y = z + 5 into 2y + 5z = −4 2(z + 5) + 5z = −4
7z = −14
z = −2,   y = 3
Step 4 — back-substitute into (1) x + 3 + (−2) = 6  →  x = 5

Solution: x = 5, y = 3, z = −2

Worked example — Gaussian Elimination (4 unknowns)extends the same idea

With 4 unknowns the process is identical to the 3-unknown case — eliminate one variable at a time until you're down to a single equation, then back-substitute. There's just one more round of elimination.

System x + y + z + w = 10   (1)
2x − y + z − w = −2   (2)
x + 2y − z + 2w = 15   (3)
3x + y + 2z − w = 7   (4)
Step 1 — eliminate x from (2), (3), (4) using (1) (2) − 2×(1):   −3y − z − 3w = −22   (2′)
(3) − 1×(1):   y − 2z + w = 5   (3′)
(4) − 3×(1):   −2y − z − 4w = −23   (4′)
Step 2 — now a 3×3 system in y, z, w. Eliminate y from (2′) and (4′) using (3′) (2′) + 3×(3′):   −7z = −7   (2″)
(4′) + 2×(3′):   −5z − 2w = −13   (4″)
Step 3 — (2″) already isolates z directly −7z = −7  →  z = 1
Step 4 — substitute z = 1 into (4″) to get w −5(1) − 2w = −13
−2w = −8  →  w = 4
Step 5 — back-substitute z = 1, w = 4 into (3′) to get y y − 2(1) + 4 = 5  →  y = 3
Step 6 — back-substitute y = 3, z = 1, w = 4 into (1) to get x x + 3 + 1 + 4 = 10  →  x = 2

Solution: x = 2, y = 3, z = 1, w = 4

Notice the pattern: each elimination round shrinks the system by one equation and one unknown — 4 equations → 3 → 2 → 1 — and then back-substitution rebuilds the answers in reverse order. This is exactly why Gaussian elimination, rather than substitution, is the practical choice once you have 3 or more unknowns: substitution's expressions get unwieldy fast, while elimination just adds one more clean round.

The matrix (augmented) form

Any linear system can be written compactly as an augmented matrix — coefficients on the left, constants on the right of a vertical bar. Gaussian elimination uses three row operations (swap two rows, scale a row, add a multiple of one row to another) to reach a triangular form, then solves by back-substitution. This same process extends directly to 4 unknowns with no new ideas — just more rows.

The 3-unknown example above, as an augmented matrix [ 1  1  1  |  6 ]
[ 0  2  5  | −4 ]
[ 2  5 −1  | 27 ]
The 4-unknown example above, as an augmented matrix [ 1   1   1   1  |  10 ]
[ 2 −1   1 −1  | −2 ]
[ 1   2 −1   2  |  15 ]
[ 3   1   2 −1  |  7 ]
Checking your answer
  1. Take your computed values for every unknown.
  2. Substitute them back into each original equation — not just the last one you used.
  3. If every equation balances, your solution is correct. If even one doesn't, recheck your steps.
Practice — Solve the System
Choose how many unknowns to practice with, solve the system using any method, then enter your answer to check it. Use the hint or full solution if you get stuck.
Problem 1 of 3
1 / 3
Show a hint
Your answer
Exam — Solve 10 Systems
10 systems mixing 2, 3, and 4 unknowns. Enter your answer for each, then submit at the end for grading.
Question 1 of 10
Your answer

0 / 10