This method of solving linear equations uses three elementary matrix operations
The purpose of elimination is to convert the matrix to a reduced row echelon form (RREF) which has the following characteristics
The following are the steps to perform the elimination algorithm
As an example, consider solving the following system of equations \begin{align} x + 2y + z &= 2\newline 3x + 8y + z &= 12\newline 4y + z &= 2\newline \text{or, } \begin{bmatrix} 1 &2 &1\newline 3 &8 &1\newline 0 &4 &1\newline \end{bmatrix} \begin{bmatrix} x\newline y\newline z \end{bmatrix} &= \begin{bmatrix} 2\newline 12\newline 2 \end{bmatrix} \end{align} The matrix we will work with during the algorithm is a composite matrix $A \vert b$, also called the augmented matrix \begin{gather} \begin{bmatrix} 1 &2 &1 &\vert &2\newline 3 &8 &1 &\vert &12\newline 0 &4 &1 &\vert &2\newline \end{bmatrix} \overset{R_{1} \leftrightarrow R_{2}}\rightarrow \begin{bmatrix} 3 &8 &1 &\vert &12\newline 1 &2 &1 &\vert &2\newline 0 &4 &1 &\vert &2\newline \end{bmatrix} \overset{R_{1}/3}\rightarrow \begin{bmatrix} 1 &8/3 &1/3 &\vert &4\newline 1 &2 &1 &\vert &2\newline 0 &4 &1 &\vert &2\newline \end{bmatrix} \overset{R_{2} - R_{1}}\rightarrow \begin{bmatrix} 1 &8/3 &1/3 &\vert &4\newline 0 &-2/3 &2/3 &\vert &-2\newline 0 &4 &1 &\vert &2\newline \end{bmatrix}\newline \overset{R_{2} / (-2/3)}\rightarrow \begin{bmatrix} 1 &8/3 &1/3 &\vert &4\newline 0 &1 &-1 &\vert &3\newline 0 &4 &1 &\vert &2\newline \end{bmatrix} \overset{R_{1} - (8/3) R_{2}}\rightarrow \begin{bmatrix} 1 &0 &3 &\vert &-4\newline 0 &1 &-1 &\vert &3\newline 0 &4 &1 &\vert &2\newline \end{bmatrix} \overset{R_{3} - 4 R_{2}}\rightarrow \begin{bmatrix} 1 &0 &3 &\vert &-4\newline 0 &1 &-1 &\vert &3\newline 0 &0 &5 &\vert &-10\newline \end{bmatrix}\newline \overset{R_{3}/5}\rightarrow \begin{bmatrix} 1 &0 &3 &\vert &-4\newline 0 &1 &-1 &\vert &3\newline 0 &0 &1 &\vert &-2\newline \end{bmatrix} \overset{R_{1} - 3R_{3}}\rightarrow \begin{bmatrix} 1 &0 &0 &\vert &2\newline 0 &1 &-1 &\vert &3\newline 0 &0 &1 &\vert &-2\newline \end{bmatrix} \overset{R_{2} + R_{3}}\rightarrow \begin{bmatrix} 1 &0 &0 &\vert &2\newline 0 &1 &0 &\vert &1\newline 0 &0 &1 &\vert &-2\newline \end{bmatrix} \end{gather} which is the RREF of the matrix. We can directly read the solutions as \begin{align} x = 2, y = 1, z = -2 \end{align}
The RREF of a matrix is unique. A column in this augmented matrix which contains a leading $1$ is called a pivot column, and the variables corresponding to these columns are called the pivot variables. All the other variables in the matrix are called free variables. In the RREF, we can check the types of solutions as
We can also calculate the rank of the matrix from the RREF. The number of non-zero rows in the RREF is the rank of the matrix. By getting the RREF of the augmented matrix, we can get the ranks of both $A$ and $A\vert b$.
To determine the number of solutions to the equation $Ax = b$ with $n$ unknowns, we can compare the ranks of $A$ and the augmented matrix $A \vert b$
In the previous example where we demonstrated Gauss-Jordan elimination, the RREF of the augmented matrix was \begin{align} \begin{bmatrix} 1 &0 &0 &\vert &2\newline 0 &1 &0 &\vert &1\newline 0 &0 &1 &\vert &-2\newline \end{bmatrix} \end{align}
Clearly, the number of pivot columns in the above is $3$, $\implies$ rank$(A \vert b)$ = $3$. From the above, we can also read off that the rank$(A) = 3$. Hence, rank$(A) =$ rank$(A \vert b) = 3$ (number of unknowns). Hence, there is a unique solution.