Gaussian Elimination Calculator
Solve any system of linear equations using the Gaussian elimination method with complete step-by-step row operations — every pivot, every multiplier, every augmented matrix state shown. Also performs Gauss-Jordan elimination to produce the reduced row echelon form (RREF) directly.
Enter coefficients (left of bar) and constants (right of bar). Accepts integers, decimals, and fractions (e.g. 3/4).
One equation per line, e.g. 2x + 3y - z = 7
Quick Examples:
Gauss-Jordan elimination extends Gaussian elimination to produce reduced row echelon form (RREF) — zeros both above and below each pivot, with each pivot scaled to 1. The solution can be read directly without back substitution.
Gauss-Jordan vs Gaussian: Gaussian elimination creates zeros only BELOW each pivot (REF) and needs back substitution. Gauss-Jordan continues to eliminate ABOVE each pivot as well, and scales each pivot to 1, producing RREF where the solution is read directly from the last column.
Table A — The Three Elementary Row Operations
| Operation | Symbol | Effect | Example |
|---|---|---|---|
| Row swap | Rᵢ ↔ Rⱼ | Exchange two rows (partial pivoting) | R₁ ↔ R₂ |
| Row scaling | kRᵢ → Rᵢ | Multiply row by nonzero scalar k | (1/2)R₁ → R₁ |
| Row replacement | Rᵢ + kRⱼ → Rᵢ | Add multiple of Rⱼ to Rᵢ | R₂ − 3R₁ → R₂ |
Table B — System Classification
| Condition in REF | System Type | Solutions |
|---|---|---|
| Rank = n variables, no contradiction | Consistent, independent | Unique solution |
| Rank < n variables, no contradiction | Consistent, dependent | Infinite solutions |
| Row [0 0...0 | c≠0] appears | Inconsistent | No solution |
Table C — REF vs RREF
| Feature | Row Echelon Form (REF) | Reduced REF (RREF) |
|---|---|---|
| Zeros below pivots | ✓ Yes | ✓ Yes |
| Zeros above pivots | ✗ Not required | ✓ Yes |
| Pivots equal 1 | ✗ Not required | ✓ Yes |
| Solution method | Back substitution needed | Read directly from matrix |
| Algorithm | Gaussian elimination | Gauss-Jordan elimination |
Key Formulas
What Is Gaussian Elimination? — Algorithm Overview
The Gaussian elimination calculator above implements the standard algorithm for solving systems of linear equations: transform the augmented matrix [A|b] into row echelon form using elementary row operations, then use back substitution to extract the solution. Gaussian elimination is the backbone of computational linear algebra — every numeric solver uses some variant of it.
The three elementary row operations that Gaussian elimination uses are: (1) Row swap Rᵢ ↔ Rⱼ — exchange two rows; (2) Row scaling kRᵢ → Rᵢ — multiply a row by a nonzero constant; (3) Row replacement Rᵢ + kRⱼ → Rᵢ — add a multiple of one row to another. All three operations preserve the solution set because they correspond to valid algebraic manipulations of the underlying equations.
The goal of Gaussian elimination's forward phase is to create zeros below each pivot (the leading nonzero entry of each row), producing an upper triangular system that is trivially solvable by back substitution. The Gauss-Jordan extension continues eliminating above each pivot as well, producing the reduced row echelon form (RREF).
How to Build the Augmented Matrix
The augmented matrix [A|b] encodes an entire linear system in one compact notation. Each row corresponds to one equation, each column to one variable, and the augmented column (after the vertical bar) holds the right-hand side constants. This augmented matrix calculator accepts either the matrix directly or a system of equations and converts automatically.
When entering a system into this augmented matrix solver, write the coefficients of each variable in the same column position across all rows. If a variable is missing from an equation, enter 0 for its coefficient. The vertical bar separator is purely visual — it reminds you that the last column plays a different role (it is not being eliminated).
Step-by-Step Gaussian Elimination — The Forward Phase
The forward phase of Gaussian elimination works column by column, left to right. At each column, it selects a pivot (using partial pivoting — choosing the largest available value to minimize numerical error), swaps it into position if needed, then eliminates all entries below it.
Worked Example — Forward Elimination for x + 3y − z = 5, 2x + y + 2z = 8, x − z = 3
- Initial augmented matrix: [[1,3,−1|5],[2,1,2|8],[1,0,−1|3]]
- Step 1 — Eliminate column 1 below pivot R₁:
Multiplier for R₂: m = −2/1 = −2 → R₂ + (−2)R₁ → R₂: [2−2,1−6,2+2|8−10] = [0,−5,4|−2]
Multiplier for R₃: m = −1/1 = −1 → R₃ + (−1)R₁ → R₃: [0,−3,0|−2] - Step 2 — Eliminate column 2 below pivot R₂:
Multiplier for R₃: m = −(−3)/(−5) = −3/5 → R₃ + (−3/5)R₂ → R₃: [0,0,12/5|−2+6/5] - REF achieved: [[1,3,−1|5],[0,−5,4|−2],[0,0,12/5|−4/5]]
Partial Pivoting: Before eliminating each column, our Gauss elimination calculator scans for the largest absolute value in that column and swaps it to the pivot position. This avoids dividing by very small numbers, which would amplify floating-point errors in decimal arithmetic. Our implementation uses exact fraction arithmetic so this is for robustness rather than numerical stability.
Back Substitution — Solving from the Bottom Up
After Gaussian elimination produces row echelon form (upper triangular), back substitution extracts the solution by working from the bottom row upward. The last row has only one unknown — solve it directly. Substitute that value into the second-to-last row (now one unknown), solve, continue upward. This is why it is called "back" substitution — you work backwards through the rows.
Back Substitution for the REF above:
- Row 3: (12/5)z = −4/5 → z = (−4/5)/(12/5) = −1/3
- Row 2: −5y + 4(−1/3) = −2 → −5y = −2 + 4/3 = −2/3 → y = 2/15
- Row 1: x + 3(2/15) − (−1/3) = 5 → x = 5 − 2/5 + 1/3 → x = computed exactly
Use the gaussian elimination solver above with the "3×3 Unique" example to see this computed with exact fractions at every step.
Gauss-Jordan Elimination — Getting RREF
Gauss-Jordan elimination is the extension of Gaussian elimination that continues after reaching row echelon form. While Gaussian elimination creates zeros only BELOW each pivot, Gauss-Jordan continues to eliminate ABOVE each pivot as well, and scales every pivot to equal 1 — producing the reduced row echelon form (RREF). The Gauss-Jordan solver reads the solution directly from the last column without any back substitution.
Three Types of Solutions — Unique, No Solution, Infinite
Every system of linear equations falls into exactly one of three categories, determined by examining the row echelon form of the augmented matrix. This gaussian elimination method calculator automatically classifies your system and explains why.
Case 1 — Unique Solution (Rank = n variables)
System: 2x+3y=7, x−y=1 → REF: [[2,3|7],[0,−5/2|−5/2]] → y=1, x=2
Every variable has a unique value. Rank = 2 = number of variables.
Case 2 — No Solution / Inconsistent (Row [0 0...0 | c≠0] appears)
System: x+y=3, 2x+2y=7 → R₂−2R₁: [0,0|1] → represents 0=1 → IMPOSSIBLE
The row [0 0 | 1] represents the equation 0x+0y=1, i.e., 0=1, which is a contradiction.
Case 3 — Infinite Solutions (Rank < n variables)
System: x+y+z=6, 2x+2y+2z=12 → R₂−2R₁: [0,0,0|0] → free variables exist
Rank=1 < 3 variables → 2 free variables. Solution: x=6−s−t, y=s, z=t for any s,t.
How to Interpret the Augmented Matrix Result
Reading a row echelon form or RREF augmented matrix requires understanding pivot columns and free variable columns. A pivot column contains a leading 1 (in RREF) or leading nonzero entry (in REF) — the corresponding variable is a basic variable with a definite value. A non-pivot column corresponds to a free variable that can take any value.
Example — Reading a System with One Free Variable
RREF: [[1,2,0|3],[0,0,1|−1]] — columns 1 and 3 are pivot columns, column 2 is free
- Let x₂ = t (free parameter, any real number)
- From row 2: x₃ = −1
- From row 1: x₁ + 2t = 3 → x₁ = 3 − 2t
- General solution: x₁ = 3−2t, x₂ = t, x₃ = −1 for any t ∈ ℝ
Gaussian Elimination Worked Examples — 5 Complete Problems
Example 1 — 2×2 Unique Solution: 2x+3y=7, x−y=1
- Augmented matrix: [[2,3|7],[1,−1|1]]
- R₂ − (1/2)R₁ → R₂: [1−1, −1−3/2, 1−7/2] = [0, −5/2, −5/2]
- Back sub: −5y/2 = −5/2 → y=1; 2x+3=7 → x=2
- Solution: x=2, y=1
Example 2 — 3×3 Unique Solution: x+3y−z=5, 2x+y+2z=8, x−z=3
- Build augmented matrix and apply Gaussian elimination
- Forward elimination creates zeros below each pivot
- Back substitution from bottom row upward
- Solution: x=2, y=1, z=−1 — click "3×3 Unique" above to verify with full steps
Example 3 — 2×2 No Solution: x+y=3, 2x+2y=7
- Augmented matrix: [[1,1|3],[2,2|7]]
- R₂ − 2R₁ → R₂: [0,0|1] — impossible row!
- Result: No solution (inconsistent) — 0=1 is impossible
Example 4 — 3×3 Infinite Solutions: x+y+z=6, 2x+2y+2z=12
- R₂ − 2R₁ → R₂ = [0,0,0|0] — all zeros row
- Rank = 1 < 3 variables → 2 free variables
- General solution: x=6−s−t, y=s, z=t
Example 5 — 4×4 System
- Use the "4×4 System" example button above for the full step-by-step solution
- Gaussian elimination produces a 4×4 upper triangular system
- Back substitution works through 4 variables from bottom to top
- All arithmetic shown as exact fractions throughout
Common Mistakes in Gaussian Elimination
Mistake 1 — Wrong sign on the multiplier
- ❌ Wrong: to eliminate a₂₁ using row 1, use multiplier +a₂₁/a₁₁
- ✅ Correct: multiplier = −a₂₁/a₁₁ (negative!) so that Rᵢ + m·Rₚ creates a zero
Mistake 2 — Only updating the pivot column, not the whole row
- ❌ Wrong: only zeroing out the target column entry, leaving other entries unchanged
- ✅ Correct: the row replacement Rᵢ + m·Rⱼ → Rᵢ must update EVERY column in row i, including the augmented column
Mistake 3 — Not using partial pivoting when pivot is zero or near-zero
- ❌ Wrong: trying to divide by a pivot of 0 (division by zero error)
- ✅ Correct: swap with the row below that has the largest absolute value in that column
Mistake 4 — Confusing "no solution" with "infinite solutions"
- ❌ Wrong: seeing a row of zeros and declaring "no solution"
- ✅ Correct: a row [0...0|0] means a redundant equation → infinite solutions. Only [0...0|c≠0] means no solution.
Mistake 5 — Forgetting the augmented column in row operations
- ❌ Wrong: performing R₂ − 2R₁ on the coefficient matrix A but not updating b
- ✅ Correct: the row operation applies to the ENTIRE augmented row including the right-hand side
Frequently Asked Questions
Related Calculators
Share This Tool
Share the Gaussian Elimination Calculator!