Ekuation

method focus

Gaussian Elimination Calculator

Solve linear systems with full row reduction step by step. See every row operation on the augmented matrix, from forward elimination with partial pivoting to back-substitution.

Back to Linear System Solver -- Step-by-Step Calculator

System Configuration

Number of equations and unknowns

Equation 1

a₁₁x + a₁₂y = b₁

Equation 2

a₂₁x + a₂₂y = b₂

Quick Tips

Click to show tips

Try an Example

Pick a scenario to see how the calculator works, then adjust the values

Simple 2x2 System

Solve 2x + 3y = 7 and x - y = 1 using Gaussian elimination

Key values: 2×2 system · Unique solution · x=2, y=1

3x3 Engineering System

Solve a 3-variable system commonly found in circuit analysis

Key values: 3×3 system · Cramer's Rule · 3 unknowns

Parallel Lines (No Solution)

Explore what happens when two equations have no intersection

Key values: 2×2 system · Inconsistent · No solution

Documentation

The Gaussian Elimination Algorithm

Gaussian elimination transforms a system of equations into row echelon form through a sequence of elementary row operations, then solves by back substitution. It is the workhorse algorithm for linear systems in both hand computation and numerical software.

The three allowed row operations are:

  1. Swap two rows
  2. Multiply a row by a nonzero scalar
  3. Add a multiple of one row to another

These operations change the form of the system but not its solution set.


Row Echelon Form

The goal is to produce an upper triangular shape in the augmented matrix [Ab][A | \mathbf{b}]:

(000)\begin{pmatrix} \boxed{*} & * & * & | & * \\ 0 & \boxed{*} & * & | & * \\ 0 & 0 & \boxed{*} & | & * \end{pmatrix}

The boxed entries are pivots. Each pivot must be nonzero, and every entry below a pivot must be zero. Once in this form, the solution follows by back substitution starting from the last equation.


Worked Example

Solve using Gaussian elimination:

(2118312112123)\begin{pmatrix} 2 & 1 & -1 & | & 8 \\ -3 & -1 & 2 & | & -11 \\ -2 & 1 & 2 & | & -3 \end{pmatrix}

Step 1: Eliminate below pivot in column 1:

R2R2+32R1R_2 \leftarrow R_2 + \frac{3}{2}R_1 and R3R3+R1R_3 \leftarrow R_3 + R_1:

(211801/21/210215)\begin{pmatrix} 2 & 1 & -1 & | & 8 \\ 0 & 1/2 & 1/2 & | & 1 \\ 0 & 2 & 1 & | & 5 \end{pmatrix}

Step 2: Eliminate below pivot in column 2:

R3R34R2R_3 \leftarrow R_3 - 4R_2:

(211801/21/210011)\begin{pmatrix} 2 & 1 & -1 & | & 8 \\ 0 & 1/2 & 1/2 & | & 1 \\ 0 & 0 & -1 & | & 1 \end{pmatrix}

Step 3: Back substitution:

From row 3: z=1z = -1. Row 2: y=(11/2(1))/(1/2)=3y = (1 - 1/2(-1))/(1/2) = 3. Row 1: x=(83+1)/2=2x = (8 - 3 + 1)/2 = 2.

Solution: (x,y,z)=(2,3,1)(x, y, z) = (2, 3, -1)


Partial Pivoting

In practice, always use partial pivoting: before eliminating in a column, swap the current row with the row below it that has the largest absolute value in that column. This prevents division by small numbers, which amplifies rounding errors.

Why it matters: Without pivoting, dividing by a near-zero pivot can multiply rounding errors by factors of 101010^{10} or more. Partial pivoting is standard in all professional implementations (MATLAB, NumPy, etc.).


Computational Complexity

Gaussian elimination on an n×nn \times n system requires:

2n33+O(n2) floating-point operations\frac{2n^3}{3} + O(n^2) \text{ floating-point operations}

This O(n3)O(n^3) complexity makes it practical for systems up to thousands of equations. For very large sparse systems (millions of equations), iterative methods like conjugate gradient are preferred.


Frequently Asked Questions

What is Gaussian elimination?

Gaussian elimination is an algorithm that transforms a system of linear equations into row echelon form (upper triangular) through elementary row operations, then solves by back substitution. It is the standard method for solving linear systems in both hand computation and numerical software.

What are the three elementary row operations?

The three allowed operations are: (1) swap two rows, (2) multiply a row by a nonzero scalar, and (3) add a multiple of one row to another. These change the form of the augmented matrix but preserve the solution set.

What is partial pivoting and why is it important?

Partial pivoting means swapping the current row with the row below it that has the largest absolute value in the current column before eliminating. Without pivoting, dividing by a near-zero pivot amplifies rounding errors enormously. All professional implementations use partial pivoting.

What is the computational complexity of Gaussian elimination?

Gaussian elimination on an n×nn \times n system requires approximately 2n33\frac{2n^3}{3} floating-point operations, which is O(n3)O(n^3). This makes it practical for systems up to thousands of equations. For very large sparse systems, iterative methods are preferred.

What is the difference between row echelon form and reduced row echelon form?

Row echelon form has zeros below each pivot (upper triangular shape) and requires back substitution. Reduced row echelon form (Gauss-Jordan) additionally has zeros above each pivot and each pivot equals 1, so solutions can be read directly without back substitution.

Related method-focus Variants

Explore more method-focus options

More Math Calculators

Explore the category

Calculator Search

Search and find calculators