Last modified: May 28, 2022
This article is written in: 🇺🇸
Gaussian Elimination
Gaussian elimination is a fundamental algorithmic procedure in linear algebra used to solve systems of linear equations, find matrix inverses, and determine the rank of matrices. The procedure systematically applies elementary row operations to transform a given matrix into an upper-triangular form (row echelon form), from which the solution to the system (if it exists and is unique) can be readily determined by back substitution.
From a conceptual viewpoint, Gaussian elimination provides a structured approach to eliminating unknowns step-by-step. Geometrically, each linear equation represents a hyperplane in -dimensional space, and the solution of the system corresponds to the intersection point(s) of these hyperplanes. Gaussian elimination successively "clears out" the variables, enabling a direct path to the solution (or revealing inconsistencies or infinite solution sets if they exist).
Mathematical Formulation
Consider a system of linear equations with unknowns:
where
We form the augmented matrix :
The goal of Gaussian elimination is to perform a series of row operations to transform into an upper-triangular form:
where is an upper-triangular matrix. Once in this form, the solution can be found by back substitution.
Derivation
The derivation of Gaussian elimination closely mirrors the logic of systematic elimination of variables from a set of equations:
I. Elimination of from equations 2 through :
Suppose the first pivot (the leading element in the first row) is . By using row operations, we can eliminate the -term from all equations below the first. This is achieved by subtracting suitable multiples of the first row from subsequent rows.
II. Elimination of from equations 3 through :
After the first step, the second row now has a leading coefficient (pivot) in the second column. Using this pivot, we eliminate the -term from all equations below the second.
III. Continue this process until the last pivot (in the -th row) is in place. If at any stage a pivot is zero, we interchange rows (partial pivoting) to bring a nonzero pivot into the pivot position.
The end result is an upper-triangular system that can be solved starting from the last equation and moving upward (back substitution).
Algorithm Steps
Input: An augmented matrix representing the system .
Output: A solution vector if it exists, or detection of no solution or infinitely many solutions.
Step-by-Step Procedure:
I. Form the augmented matrix:
II. Forward Elimination (to reach upper-triangular form):
For to :
I. Partial Pivoting (if desired): Find the row (pivotRow) below (and including) the current row that has the largest absolute value in column . Swap the current row with pivotRow to reduce numerical instability.
II. Pivot Normalization: Divide the entire -th row by (the pivot) to make the pivot element equal to 1.
III. Elimination: For each row , subtract times the -th row from the -th row to make the elements below the pivot zero.
After these steps, the matrix is in row echelon form:
where represents arbitrary numbers obtained during the process.
III. Back Substitution:
Starting from the last equation:
For down to 1:
Since after normalization, can be directly computed. (If not normalized, divide by .)
This process yields the solution vector .
Example
Given System:
I. Augmented Matrix:
II. Forward Elimination:
- Pivot in first row is . Normalize the first row by dividing by 2:
- Eliminate -terms in row 2 and row 3 using row 1:
- For row 2: Add 3 times row 1:
- For row 3: Add 2 times row 1:
Now the matrix is:
- Next pivot is . Normalize the second row by dividing by 0.5:
- Eliminate below the second pivot:
For row 3: subtract 2 times row 2 from row 3:
Now the matrix is in upper-triangular form:
III. Back Substitution:
- From the last equation: .
- Substitute into second equation:
.
- Substitute into first equation:
.
The solution is .
Advantages
- Gaussian elimination has general applicability to any system of linear equations, and it can also identify cases where no solution or infinitely many solutions exist in non-square systems.
- The method serves as a foundation for advanced techniques like LU decomposition and QR decomposition, forming a building block for many numerical algorithms.
- It can be used to determine the rank of a matrix and to compute the inverse of a matrix when applicable by applying the procedure to the augmented matrix .
Limitations
- Numerical instability is a concern due to round-off errors, particularly without pivoting. Partial or full pivoting mitigates this issue but may require additional computational steps.
- The method’s computational cost, proportional to operations, can become prohibitive for large-scale systems, making it less efficient than iterative methods for such cases.
- A zero pivot element halts the process unless row interchanges are performed. Pivoting is necessary to avoid division by zero and to maintain algorithmic stability.