Source: algebrica.org - CC BY-NC 4.0 https://algebrica.org/solving-linear-systems-using-gaussian-elimination/ Fetched from algebrica.org post 13697; source modified 2025-05-25T14:43:55.
What is Gaussian elimination
The Gauss method, or Gaussian elimination, is a technique used to solve systems of $n$ linear equations in $n$ unknowns. The process involves applying a sequence of operations iteratively to eliminate one variable at a time, transforming the system into a form that is easy to solve. Let us consider the following system of equations:
To apply the method, it is essential that the system is square, that is, it must have the same number of equations and unknowns, like the $3 \times 3$ system shown above.
The process involves the following steps:
- Eliminate the variable $x_1$ from all equations except the first one.
- Eliminate the variable $x_2$ from the third equation.
- Solve the third equation to find the value of $x_3$.
- Work backwards to find the values of the remaining variables.
When the algorithm produces an inconsistent or indeterminate equation, the system cannot proceed further: this signals either no solution or an infinite set of solutions.
Connection with Matrices
The Gaussian elimination method transforms a matrix into its row-echelon form. The objective is to rewrite the matrix so that each pivot position (on the main diagonal) contains a 1, and all entries below each pivot are 0. For example, starting from a generic matrix:
Let’s start by eliminating the variable $x_1$ from all equations except the first one.
To eliminate $x_1$ from the second equation, we multiply the first equation by $a_{21}$ and the second by $a_{11}$. We then subtract the two resulting equations and replace the second equation with the result. We obtain:
To simplify the calculations, we rewrite the second equation as:
The system becomes:
Now, we multiply the first equation by $a_{31}$ and the third equation by $a_{11}$. We then subtract the two resulting equations and replace the third equation with the result.
We rewrite the third equation as:
We obtain:
We proceed with the second step and eliminate the variable $x_2$ from the third equation.
We multiply the second equation by $a^\prime_{32}$ and the third equation by $a^\prime_{22}$. We then subtract the two resulting equations and replace the third equation with the result. By completing the calculations as in the first step, the system reduces to the following:
We have obtained a triangular system. At this point, we can solve for $x_3$ from the third equation, obtaining:
We can now determine each variable, starting from the known value of $x_3$.
Example
Let’s walk through a concrete example of Gaussian elimination applied to a 3×3 system. Consider the following system of linear equations:
To eliminate $x$ from the second equation, subtract $2 \times$ equation 1 from equation 2:
Now eliminate $x$ from the third equation by subtracting equation 1 from equation 3:
The system becomes:
Now use the second equation as the new pivot. To eliminate $y$ from the third equation, subtract equation 2 from equation 3:
Substituting back to find the remaining variables. From equation 2:
From equation 1:
The solution is