Linear Algebra • Systems & Matrix Reductions

Gaussian Elimination Solver

Solve systems of linear equations step-by-step using Gaussian elimination. Discover elementary row operations, row echelon form (REF), back-substitution, and rank analysis.

|
Last Updated: September 2026
|
Verified Accurate: Mathematical & Computational Rigor
Linear Algebra • Gaussian Elimination [A | b] Unique Solution
Linear System Presets: Click to load & row-reduce
System Dimension:
Augmented Matrix [A | b]: Coefficients A • Constants b
Solution Vector x = [x₁, x₂, …, xₙ]ᵀ: Consistent System
x₁ = 5, x₂ = 3, x₃ = -2
Unique solution satisfies all 3 linear equations simultaneously.
Matrix Rank rank(A)
3
Non-zero pivot rows
Augmented Rank
3
rank([A | b])
Determinant det(A)
-48
Signed pivot product
Classification
Unique
Rouché-Capelli Theorem

Step-by-Step Elementary Row Reduction (REF & Back-Substitution)

Gaussian Forward Elimination
Direct Answer & Overview
Verified Educational Guide

Gaussian Elimination Overview & Direct Answer

Gaussian elimination systematically solves a linear system A x = b by converting its augmented matrix [A | b] into upper-triangular Row Echelon Form (REF) via elementary row operations. Once in REF, solutions are computed directly from the bottom row up via back-substitution. The algorithm identifies unique solutions, parameterized infinite families of solutions, and contradictions indicating inconsistent systems.

Primary Mathematical Formula Augmented Matrix Forward Reduction & Back-Substitution Formula
Standard Equation
ƒ(x)
Q.E.D.
[A  |  b]→row reduction[U  |  c]  ⟹  xi=ci−∑j=i+1nuijxjuii\left[ A \;\middle|\; \mathbf{b} \right] \xrightarrow{\text{row reduction}} \left[ U \;\middle|\; \mathbf{c} \right] \implies x_i = \frac{c_i - \sum_{j=i+1}^n u_{ij} x_j}{u_{ii}}
Valid for all n × n systems over ℝ. If rank(A) = rank([A|b]) = n, the system has a unique solution.
Exact Formula
Input Parameters
Required
1
System Dimension: Square system size (2x2, 3x3, or 4x4 linear systems).
2
Coefficient Matrix (A): Real scalar entries a_ij weighting unknown variables x_j.
3
Constant Vector (b): Right-hand side constants b_i defining each linear constraint.
Expected Outputs
Calculated
Solution Vector x: Exact integer or rational fraction coordinates [x₁, x₂, ..., xₙ]ᵀ.
System Classification: Unique solution, infinitely many solutions (dependent), or inconsistent (no solution).
Row Echelon Form (REF): Upper-triangular matrix state achieved via forward elimination.
Matrix Rank & Determinant: rank(A), rank([A | b]), and signed pivot determinant det(A).
Worked Numerical Example
Instant Verification
Solve system: x + y = 5, 2x - y = 4
→ Step 1: Set up augmented matrix [[1, 1 | 5], [2, -1 | 4]]. Step 2: Row operation R₂ ← R₂ - 2R₁ yields [[1, 1 | 5], [0, -3 | -6]]. Step 3: Back-substitute: -3y = -6 ⇒ y = 2; then x + 2 = 5 ⇒ x = 3.
x = 3, y = 2

Linear Systems & Augmented Matrix Formulation

A system of $m$ linear equations in $n$ unknowns $x_1, x_2, \dots, x_n$ is expressed in standard scalar form as:

a₁₁ x₁ + a₁₂ x₂ + … + a₁ₙ xₙ = b₁
a₂₁ x₁ + a₂₂ x₂ + … + a₂ₙ xₙ = b₂
⋮
aₘ₁ x₁ + aₘ₂ x₂ + … + aₘₙ xₙ = bₘ

In matrix notation, this compacts to $A \mathbf{x} = \mathbf{b}$, where $A \in \mathbb{R}^{m \times n}$ is the coefficient matrix, $\mathbf{x} \in \mathbb{R}^n$ is the unknown column vector, and $\mathbf{b} \in \mathbb{R}^m$ is the constant vector. To perform simultaneous algebraic reduction without repeatedly writing variable names, linear algebra defines the augmented matrix $[A \mid \mathbf{b}]$:

[A | b] = [
  a₁₁   a₁₂   …   a₁ₙ  |  b₁  
  a₂₁   a₂₂   …   a₂ₙ  |  b₂  
  ⋮    ⋮    &ddots;    ⋮  |  ⋮  
  aₘ₁   aₘ₂   …   aₘₙ  |  bₘ  
]

For general matrix algebra operations including determinants and inversions, visit our Matrix Calculator.

The Three Elementary Row Operations

Gaussian elimination relies on three elementary row operations that transform an augmented matrix into an equivalent system having the exact same solution set:

1. Row Swap
R_i ↔ R_j

Interchanging two rows corresponds to swapping the order in which two equations are written. Multiplies the matrix determinant by $-1$.

2. Scalar Scaling
R_i ← c • R_i   (c ≠ 0)

Multiplying an entire row by a non-zero constant $c$. Scales the determinant by factor $c$.

3. Row Replacement
R_i ← R_i + c • R_j

Adding a scalar multiple of row $j$ to row $i$. This fundamental elimination operation leaves the matrix determinant unchanged!

The Forward Elimination Algorithm (REF)

The forward elimination phase processes columns sequentially from left to right to create an upper-triangular echelon matrix:

  • Pivot Selection: At step $k$, examine column $k$ in rows $k, k+1, \dots, n$. The non-zero entry $a_{kk}$ serves as the pivot element.
  • Row Swap: If $a_{kk} = 0$, swap row $k$ with a row below that contains a non-zero entry in column $k$.
  • Sub-Diagonal Elimination: For each row $i > k$, compute the multiplier $m_{ik} = a_{ik} / a_{kk}$ and perform the row replacement: $$R_i \leftarrow R_i - m_{ik} R_k$$ This replaces all entries below the pivot $a_{kk}$ with exact zeros.
  • Termination: Repeat for $k = 1, 2, \dots, n-1$. The resulting matrix is in Row Echelon Form (REF).

Partial Pivoting & Numerical Stability

In numerical linear algebra, standard Gaussian elimination without row reordering is numerically unstable in finite-precision arithmetic. If a pivot element $|a_{kk}|$ is extremely small, the multiplier $m_{ik} = a_{ik} / a_{kk}$ becomes enormous, causing catastrophic cancellation and roundoff magnification.

Partial Pivoting resolves this by finding the row $p \ge k$ that maximizes the absolute value:

|apk| = max { |aik| : i = k, k+1, …, n }

Row $p$ is swapped into row $k$ before elimination begins. This guarantees that all multipliers satisfy $|m_{ik}| \le 1$, bounding error growth throughout the forward reduction.

The Back-Substitution Phase

Once the augmented matrix reaches upper-triangular echelon form $[U \mid \mathbf{c}]$, the bottom equation contains only the single variable $x_n$:

unn xn = cn  ⇒  xn = cn / unn

Working upward from $i = n-1$ down to $1$, each preceding variable is computed by substituting all previously determined unknowns into row $i$:

xi = ( ci - ∑j=i+1n uij xj ) / uii

Back-substitution executes in $O(n^2)$ time, completing the solution vector without requiring full matrix inversion. For alternative algebraic solvers, our Systems of Equations Solver offers substitution and Cramer's rule comparisons.

Solution Classification: The Rouché-Capelli Theorem

The existence and uniqueness of solutions to $A\mathbf{x} = \mathbf{b}$ is fully governed by the Rouché-Capelli Theorem, which compares the rank of the coefficient matrix $A$ to the rank of the augmented matrix $[A \mid \mathbf{b}]$:

Rank Condition System Consistency Solution Space Geometry
rank(A) = rank([A|b]) = n Consistent Unique single solution (intersecting planes at single point)
rank(A) = rank([A|b]) = r < n Consistent (Dependent) Infinitely many solutions (line or hyperplane with n - r free parameters)
rank(A) < rank([A|b]) Inconsistent No solution (parallel planes; contradiction row [0 0 ... 0 | k])

Engineering Applications: Circuits, Structures & Networks

Gaussian elimination is the computational engine inside finite element analysis (FEA), circuit simulators (SPICE), and structural load analyzers:

  • Kirchhoff's Current & Voltage Laws (KCL / KVL): In electrical engineering, nodal analysis of a circuit containing $N$ nodes creates an $N \times N$ conductance matrix $G \mathbf{v} = \mathbf{i}$, solved directly via Gaussian elimination.
  • Civil Engineering Truss Analysis: Evaluating tensile and compressive forces on structural bridge joints creates joint equilibrium matrices $K \mathbf{d} = \mathbf{F}$ balancing external dead/live loads against internal structural members.
  • Chemical Reaction Balancing: Mass conservation for stoichiometric reactions forms a homogeneous linear system $A \mathbf{x} = \mathbf{0}$, resolved to integer ratios via row reduction.

Common Pitfalls & Computational Traps

  • Dividing by Zero Pivot: Proceeding with row elimination when $a_{kk} = 0$ leads to division by zero. A row swap with a lower row having a non-zero entry in that column is strictly required before continuing.
  • Premature Decimal Rounding: Converting fractions to decimals (e.g. $1/3 \approx 0.333$) during intermediate row operations accumulates severe truncation errors. Exact fraction arithmetic preserves algebraic purity.
  • Forgetting to Operate on Constant Vector: Applying row operations solely to matrix $A$ while forgetting column vector $\mathbf{b}$ destroys the equivalence of the linear equations.
Fact-Checked & Verified • Computational Accuracy Standards
Updated September 2026 • Editorial Policy
Authored By
Sanjay Samanta

Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.

Reviewed & Verified By
Academic Review Board

Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.

Found an error or have an improvement suggestion? Report a calculation issue

Frequently Asked Questions

What is Gaussian elimination in linear algebra?
Gaussian elimination (also known as row reduction) is a systematic algorithm for solving systems of linear equations. It converts an augmented matrix [A | b] into row echelon form (an upper triangular matrix) using three elementary row operations: row swapping, row scaling by a non-zero scalar, and row replacement (adding a multiple of one row to another). Once in upper triangular form, solutions are extracted directly via back-substitution.
What are the three elementary row operations permitted in Gaussian elimination?
The three permissible elementary row operations are: 1) Row Swap (R_i ↔ R_j): Interchange two rows; 2) Scalar Multiplication (R_i ← c · R_i): Multiply all entries of a row by a non-zero constant c ≠ 0; 3) Row Replacement (R_i ← R_i + c · R_j): Add a scalar multiple of row j to row i. None of these operations alter the solution set of the linear system.
What is the difference between Row Echelon Form (REF) and Reduced Row Echelon Form (RREF)?
In Row Echelon Form (Gaussian elimination), all leading coefficients (pivots) are to the right of the pivot in the row above, and all entries below each pivot are zero. In Reduced Row Echelon Form (Gauss-Jordan elimination), every leading pivot is scaled to 1, and all entries both above and below each pivot are reduced to zero, allowing solutions to be read directly without back-substitution.
How does Gaussian elimination detect inconsistent systems with no solution?
An inconsistent system produces a row of zeros in the coefficient matrix paired with a non-zero constant in the augmented column: [0, 0, ..., 0 | k] where k ≠ 0. This translates to the algebraic contradiction 0 = k, which is impossible. By the Rouché-Capelli theorem, this occurs when rank(A) < rank([A | b]).
How does the solver handle infinite solutions?
If rank(A) = rank([A | b]) = r < n (where n is the number of variables), the system is consistent but dependent. There are n - r free variables. The solver parameterizes the free variables (e.g., x₃ = t where t ∈ ℝ) and expresses the leading pivot variables in terms of these free parameters.
Why is partial pivoting necessary in numerical computations?
In floating-point arithmetic, dividing by a very small pivot element amplifies rounding errors and causes numerical instability. Partial pivoting scans the active column below the pivot position and swaps the row with the largest absolute value into the pivot row before eliminating, dramatically minimizing error magnification.
What is the computational complexity of Gaussian elimination?
For an n × n system, Gaussian elimination requires approximately (2/3)n³ arithmetic floating-point operations (flops) during the forward elimination phase and n² flops during the back-substitution phase. Thus, its asymptotic time complexity is O(n³).