
Gaussian Elimination: Step-by-Step Worked Examples
Gaussian elimination solves linear systems by reducing an augmented matrix to row-echelon form through three reversible row operations, then recovering each variable through back-substitution. It handles 2x2, 3x3, and n x n systems with the same procedure, making it the standard algorithm taught in every linear algebra course worldwide.
The three worked examples below progress from a straightforward 2x2 system to a 3x3 system, then to a case where the row-echelon form itself tells you the system has either no solution or infinitely many. Every row operation is written out explicitly so you can see exactly which arithmetic step produces each matrix entry. That step-level visibility is what these solving systems with Gaussian elimination examples are designed to provide.
What Is Gaussian Elimination?
Gaussian elimination is a systematic algorithm for solving systems of linear equations. It works by transforming the coefficient matrix, together with the constants, into a triangular form called row-echelon form, where all entries below the diagonal are zero. Once the matrix reaches that shape, back-substitution recovers each variable in reverse order.
The algorithm appears in every linear algebra course from introductory to graduate level, with full treatment in freely available open-access textbooks. Its O(n^3) complexity makes it practical for any system you will encounter in coursework by hand or computationally.
Augmented Matrix Notation
Every linear system maps directly to an augmented matrix. Given the system:
2x + y = 5
x - 3y = -4
the augmented matrix is written with the coefficients on the left of a vertical divider and the constants on the right:
The Three Allowed Row Operations
Only three operations are permitted on the rows of an augmented matrix. Each one is reversible, which guarantees the solution set stays the same before and after the operation.
| Operation | Notation | What it does | Example |
|---|---|---|---|
| Row swap | Ri ↔ Rj | Exchange row i and row j | R1 ↔ R2 swaps the first and second rows |
| Row scale | cRi → Ri | Multiply every entry in row i by nonzero scalar c | (1/2)R1 → R1 halves all entries in row 1 |
| Row replacement | Ri + cRj → Ri | Add c times row j to row i, storing the result in row i | R2 + (-1/2)R1 → R2 eliminates the x term in row 2 |
These three operations are the only moves in Gaussian elimination. Row replacement is the most frequent; it drives the elimination phase.
Each operation corresponds to an algebraically valid step: swapping equations, multiplying an equation by a nonzero constant, or adding a multiple of one equation to another. Because every step is reversible, the augmented matrix at any stage represents a system with exactly the same solutions as the original.
Example 1: A 2x2 System (Unique Solution)
Solve the following system using solving systems with Gaussian elimination step by step:
2x + y = 5
x - 3y = -4
Setting Up the Augmented Matrix
Write the coefficients and constants as the augmented matrix:
[ 2 1 | 5 ]
[ 1 -3 | -4 ]
The goal of the forward elimination phase is to produce a zero below the leading entry in column 1.
Row Reduction to Row-Echelon Form
The pivot in position (1,1) is 2. To eliminate the entry 1 directly below it in row 2, compute the multiplier m = 1/2, then apply R2 + (-1/2)R1 to row 2.
Step 1: R2 + (-1/2)R1 → R2
New row 2: [1 - (1/2)(2), -3 - (1/2)(1), -4 - (1/2)(5)]
= [0, -7/2, -13/2]
The matrix is now in row-echelon form:
[ 2 1 | 5 ]
[ 0 -7/2 | -13/2 ]
The most common error at this stage is rounding -13/2 to -6 or -7. Keep the fraction exact. A single rounding error in the augmented column propagates into every back-substitution step that follows. Write -13/2 as a fraction rather than converting to a decimal mid-problem.
Back-Substitution
Starting from the last nonzero row: (-7/2)y = -13/2. Divide both sides by -7/2, which is the same as multiplying by -2/7:
y = (-13/2) x (-2/7) = 13/7
Substitute y = 13/7 into row 1: 2x + (13/7) = 5
2x = 5 - 13/7 = 35/7 - 13/7 = 22/7
x = 11/7
Solution: x = 11/7, y = 13/7. You can verify: 2(11/7) + 13/7 = 22/7 + 13/7 = 35/7 = 5. Check.
Example 2: A 3x3 System (Unique Solution)
This is the type of system that appears in linear algebra Gaussian elimination exam questions most frequently. Solve:
x + 2y - z = 8
-3x - y + 2z = -11
-2x + y + 2z = -3
Forward Elimination Phase
Write the augmented matrix:
[ 1 2 -1 | 8 ]
[ -3 -1 2 | -11 ]
[ -2 1 2 | -3 ]
Step 1: Pivot is 1 in position (1,1). Eliminate the entries in column 1 of rows 2 and 3.
R2 + 3R1 → R2: [-3+3(1), -1+3(2), 2+3(-1), -11+3(8)] = [0, 5, -1, 13]
R3 + 2R1 → R3: [-2+2(1), 1+2(2), 2+2(-1), -3+2(8)] = [0, 5, 0, 13]
Matrix after Step 1:
[ 1 2 -1 | 8 ]
[ 0 5 -1 | 13 ]
[ 0 5 0 | 13 ]
Step 2: Pivot is 5 in position (2,2). Eliminate the entry in column 2 of row 3.
R3 + (-1)R2 → R3: [0-0, 5-5, 0-(-1), 13-13] = [0, 0, 1, 0]
Row-echelon form:
[ 1 2 -1 | 8 ]
[ 0 5 -1 | 13 ]
[ 0 0 1 | 0 ]
Back-Substitution Phase
Start from row 3: z = 0.
Row 2: 5y - 1(0) = 13, so 5y = 13, y = 13/5.
Row 1: x + 2(13/5) - 1(0) = 8, so x + 26/5 = 8, x = 8 - 26/5 = 40/5 - 26/5 = 14/5.
Solution: x = 14/5, y = 13/5, z = 0. Verify in row 2: 0 + 5(13/5) - 1(0) = 13. Check.
If you want to check your row operations or explore how changes in coefficients affect the solution, the matrix calculator on the subject calculators hub handles augmented matrices step by step.
Matrix Calculator
Enter your augmented matrix to check row reduction steps and verify solutions for solving systems with Gaussian elimination practice problems.
Example 3: A 3x3 System with No Unique Solution
Solving systems with Gaussian elimination practice problems often include a case where the row-echelon form itself tells you the outcome before you attempt back-substitution. Consider:
x + y + z = 6
2x + 2y + 2z = 12
x - y + 3z = 4
Augmented matrix:
[ 1 1 1 | 6 ]
[ 2 2 2 | 12 ]
[ 1 -1 3 | 4 ]
Step 1: Pivot 1 in position (1,1).
R2 + (-2)R1 → R2: [0, 0, 0, 0]
R3 + (-1)R1 → R3: [0, -2, 2, -2]
After Step 1:
[ 1 1 1 | 6 ]
[ 0 0 0 | 0 ]
[ 0 -2 2 | -2 ]
Row 2 is all zeros. The entry in column 2 of row 2 is zero, so it cannot serve as the next pivot. Swap rows 2 and 3 to bring the nonzero row into position.
R2 ↔ R3:
[ 1 1 1 | 6 ]
[ 0 -2 2 | -2 ]
[ 0 0 0 | 0 ]
Row-echelon form shows only two pivots (positions (1,1) and (2,2)) for a 3x3 system. The third row is entirely zero. This means z is a free variable. Infinitely many solutions exist.
Inconsistent versus Dependent Systems
For the dependent system in Example 3, let z = t (a free parameter). Then from row 2: -2y + 2t = -2, so y = 1 + t. From row 1: x + (1 + t) + t = 6, so x = 5 - 2t. The full solution family is:
x = 5 - 2t, y = 1 + t, z = t, for any real number t.
Every value of t produces a valid solution. At t = 0: (5, 1, 0). At t = 1: (3, 2, 1). The MIT OCW column-space and null-space notes cover free variables and parametric solutions in detail, including the relationship between null space and the solution family.
Common Errors in Gaussian Elimination
Most arithmetic mistakes in these solving systems with Gaussian elimination practice problems come from three sources: incorrect multipliers, sign errors during row replacement, and skipping the row swap when a pivot entry is zero.
| Error | Where it happens | How to prevent it |
|---|---|---|
| Wrong multiplier sign | R2 + cR1 step: using +c instead of -c | Write the multiplier as m = -(entry below pivot / pivot) and check before computing |
| Partial row update | Updating only 2 of 4 entries in a row after replacement | Work left to right across every column including the augmented column |
| Forgetting the augmented column | Reducing A correctly but omitting the | b column update | Treat the augmented column as a fourth column in all row operations |
| Skipping a row swap | Trying to divide by a zero pivot | Before each elimination step, check the pivot is nonzero; swap if needed |
| Premature rounding | Rounding -13/2 to -7 mid-problem | Keep fractions exact until the final back-substitution result |
All five errors are preventable by writing out each row operation explicitly before entering the arithmetic.
When to Swap Rows: Partial Pivoting
Partial pivoting means scanning the current pivot column below the diagonal and swapping the row with the largest absolute value to the pivot position before eliminating. On exam questions by hand, it prevents division by zero (when the natural pivot is exactly zero). In numerical computation on a computer, it controls rounding error growth: dividing by a near-zero number amplifies any floating-point error in the subtracted row.
The rule is simple: before each elimination step, if the current diagonal entry is zero, find the first nonzero entry below it in the same column and swap. For how to do solving systems with Gaussian elimination on an exam, always check the pivot before computing the multiplier.
If you discover a zero pivot after performing row replacement on all lower rows, you cannot simply swap to fix it. You must redo the elimination from that stage. Check the pivot before each elimination step, not after. A 10-second check at the start of each column saves several minutes of redoing arithmetic.
For further practice with worked examples spanning elimination, eigenvalues, and determinants, the subject calculators hub links to interactive tools for linear algebra and related topics. The u-substitution worked examples and matrix multiplication guide from the subject-mastery cluster follow the same explicit step-level format used here.
If you want to run through Gaussian elimination problems interactively and get feedback on your row operations rather than just a final answer:
The university resources hub also links to the grade calculators hub and subject tools for every quantitative course.
Key Takeaways
- Gaussian elimination converts a linear system into an augmented matrix, applies row operations to reach row-echelon form, then solves by back-substitution. The three row operations (swap, scale, replace) never change the solution set.
- In a 2x2 system, one row replacement step eliminates the lower entry, and a single back-substitution step recovers both variables. Keep fractions exact throughout.
- In a 3x3 system, two rounds of elimination target columns 1 and 2 in turn. Each round uses multipliers computed as -(entry below pivot) divided by the pivot. Writing out each operation before the arithmetic prevents sign errors.
- The row-echelon form itself reveals the solution type: n pivots for n unknowns means exactly one solution; fewer pivots with all-zero constant entries means free variables and infinitely many solutions; an all-zero row with a nonzero constant means no solution.
- Partial pivoting (swapping to place the largest absolute-value entry in the pivot position) avoids division by zero and limits rounding error in floating-point computation. Apply it before each elimination step when the current pivot is zero.
- The five most common arithmetic errors are: wrong-sign multipliers, partial row updates, omitting the augmented column, skipping row swaps, and premature rounding. All five are eliminated by writing each operation symbol before computing the numbers.
- For practice beyond these three examples, the game theory worked examples and other subject-mastery sibling posts use the same explicit step-level format to build problem-solving fluency.
The three solving systems with Gaussian elimination examples above cover every outcome a linear algebra exam can produce from this method. Recognizing which outcome applies from the row-echelon form, before any back-substitution arithmetic, is the single most time-saving skill in this topic.
For open-textbook treatment of the same material, OpenStax College Algebra Chapter 9 and the MIT OCW 18.06 Linear Algebra materials provide a full formal derivation of why row operations preserve solution sets, including the connection to elementary matrices. The elimination with matrices lecture notes from the same course show how this scales to large n x n systems computationally.


