3.3 Gauss–Jordan elimination
To solve a system of linear equations like
2 x 1 + 5 x 2 = 2 13 x 2 = − 26 \begin{align}
2x_1 + 5x_2 &= 2\\
13x_2 &= -26
\end{align} 2 x 1 + 5 x 2 13 x 2 = 2 = − 26 Note that the second equation is easily solved for x 2 = − 2 x_2 = -2 x 2 = − 2 , which can be
substituted in the first equation to give x 1 = ( 2 − 5 x 2 ) / 2 = 6 x_1 = (2-5x_2)/2 = 6 x 1 = ( 2 − 5 x 2 ) /2 = 6 . If we can
bring systems so that one variable is isolated, we can work backwards to solve
the others! How do we do this systematically for equations?
Elementary operations
Swap the order of equations
Multiply one equation by a nonzero constant
Add one equation to another
Because of 2 and 3, we can also add a multiple of one equation to another.
For example, suppose we instead started with the equations
2 x 1 + 5 x 2 = 2 − 4 x 1 + 3 x 2 = − 30 \begin{align}
2x_1 + 5x_2 &= 2 \\
-4x_1 + 3x_2 &= -30
\end{align} 2 x 1 + 5 x 2 − 4 x 1 + 3 x 2 = 2 = − 30 Adding twice the first equation to the second equation gives 13 x 2 = − 26 13 x_2 = -26 13 x 2 = − 26 ,
from which we were able solve before!
Procedure ¶ This process can be tedious, particularly when there are more variables and
equations. Matrices provide a systematic approach to both performing elementary
operations to isolate variables, as well as to carry out subsequent
substitution. This entire procedure is called Gauss-Jordan elimination with
backsubstitution.
Rewrite the equations as A x = b \vv{A}\vv{x} = \vv{b} Ax = b using a matrix and vectors
[ 25 − 43 ] [ x 1 x 2 ] = [ 2 − 30 ] \begin{bmatrix}2 5 \\ -4 3\end{bmatrix}
\begin{bmatrix}x_1 \\ x_2\end{bmatrix} =
\begin{bmatrix}2 \\ -30\end{bmatrix} [ 25 − 43 ] [ x 1 x 2 ] = [ 2 − 30 ] Form the “augmented” matrix [ A b ] [\vv{A} \vv{b}] [ Ab ]
A = [ 2 5 2 − 4 3 − 30 ] \mathbf{A} = \begin{bmatrix} 2 & 5 & 2\\ -4 & 3 & -30\end{bmatrix} A = [ 2 − 4 5 3 2 − 30 ] Perform elementary operations on rows to create “pivot” points in each row.
The goal is to get a number on the diagonals and zeros below. It is OK to
have a zero on the diagonal if there are no nonzero values underneath it.
[ 2 5 2 − 4 3 − 30 ] R 1 + 2 R 1 → [ 2 5 2 0 13 − 26 ] \begin{bmatrix} 2 & 5 & 2 \\ -4 & 3 & -30 \end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ +2 R_1 \end{matrix}
\to \begin{bmatrix} 2 & 5 & 2 \\ 0 & 13 & -26 \end{bmatrix} [ 2 − 4 5 3 2 − 30 ] R 1 + 2 R 1 → [ 2 0 5 13 2 − 26 ] Here, we noted that we added twice Row 1 to Row 2 to eliminate the 4 under
the first pivot point 2.
When you reach the bottom row, check there are no rows of zeros with a
nonzero last column. This would be equivalent to a false equation
(like 0 = 1 0=1 0 = 1 ), meaning there is no solution and no further work is needed.
Work back up to turn pivot points into ones and get zeros above in each
column
[ 2 5 2 0 13 − 26 ] R 1 ÷ 13 → [ 2 5 2 0 1 − 2 ] − 5 R 2 R 2 → [ 2 0 12 0 1 − 2 ] ÷ 2 R 2 → [ 1 0 6 0 1 − 2 ] \begin{align}
\begin{bmatrix} 2 & 5 & 2 \\ 0 & 13 & -26 \end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \div 13 \end{matrix}
&\to \begin{bmatrix} 2 & 5 & 2 \\ 0 & 1 & -2 \end{bmatrix}
\begin{matrix}-5 R_2 \\ \vphantom{R_2}\end{matrix} \\
&\to \begin{bmatrix} 2 & 0 & 12 \\ 0 & 1 & -2 \end{bmatrix}
\begin{matrix}\div 2 \\ \vphantom{R_2}\end{matrix} \\
&\to \begin{bmatrix} 1 & 0 & 6 \\ 0 & 1 & -2 \end{bmatrix}
\end{align} [ 2 0 5 13 2 − 26 ] R 1 ÷ 13 → [ 2 0 5 1 2 − 2 ] − 5 R 2 R 2 → [ 2 0 0 1 12 − 2 ] ÷ 2 R 2 → [ 1 0 0 1 6 − 2 ] The solution comes from reexpressing the augmented matrix as
A x = b \vv{A} \vv{x} = \vv{b} Ax = b .
[ 1 0 0 1 ] [ x 1 x 2 ] = [ 6 − 2 ] \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
\begin{bmatrix} x_1 \\ x_2 \end{bmatrix} =
\begin{bmatrix} 6 \\ -2 \end{bmatrix} [ 1 0 0 1 ] [ x 1 x 2 ] = [ 6 − 2 ] Or, x 1 = 6 x_1 = 6 x 1 = 6 and x 2 = − 2 x_2 = -2 x 2 = − 2 .
Example: Pump circuit ¶ Incompressible flow can be written analogous to an electrical circuit as
− Δ P = R Q -\Delta P = RQ − Δ P = RQ where Δ P \Delta P Δ P is the pressure change, R is the resistance, and Q is the
volumetric flow rate. For the following pump “circuit”:
The pressure and mass balances for the nodes and loop give:
Q 1 + Q 3 = Q 2 Q 2 = Q 1 + Q 3 80 = 10 Q 2 + 20 Q 1 90 = 25 Q 3 + 10 Q 2 \begin{align}
Q_1 &+ Q_3 = Q_2 \\
Q_2 &= Q_1 + Q_3 \\
80 &= 10Q_2 + 20Q_1 \\
90 &= 25Q_3 + 10Q_2
\end{align} Q 1 Q 2 80 90 + Q 3 = Q 2 = Q 1 + Q 3 = 10 Q 2 + 20 Q 1 = 25 Q 3 + 10 Q 2 Find Q 1 Q_1 Q 1 , Q 2 Q_2 Q 2 , and Q 3 Q_3 Q 3 .
First, rearrange the equations into consistent linear form:
Q 1 − Q 2 + Q 3 = 0 Q 1 − Q 2 + Q 3 = 0 20 Q 1 + 10 Q 2 + 0 Q 3 = 80 0 Q 1 + 10 Q 2 + 25 Q 3 = 90 \begin{align}
Q_1 - Q_2 + Q_3 &= 0 \\
Q_1 - Q_2 + Q_3 &= 0 \\
20Q_1 + 10Q_2 + 0Q_3 &= 80 \\
0Q_1 + 10Q_2 + 25Q_3 &= 90
\end{align} Q 1 − Q 2 + Q 3 Q 1 − Q 2 + Q 3 20 Q 1 + 10 Q 2 + 0 Q 3 0 Q 1 + 10 Q 2 + 25 Q 3 = 0 = 0 = 80 = 90 Then, rewrite using matrix representation:
[ 1 − 1 1 1 − 1 1 20 10 0 0 10 25 ] [ Q 1 Q 2 Q 3 ] = [ 0 0 80 90 ] \begin{bmatrix}
1 & -1 & 1 \\
1 & -1 & 1 \\
20 & 10 & 0 \\
0 & 10 & 25
\end{bmatrix}
\begin{bmatrix}
Q_1 \\ Q_2 \\ Q_3
\end{bmatrix}
= \begin{bmatrix}
0 \\ 0 \\ 80 \\ 90
\end{bmatrix} ⎣ ⎡ 1 1 20 0 − 1 − 1 10 10 1 1 0 25 ⎦ ⎤ ⎣ ⎡ Q 1 Q 2 Q 3 ⎦ ⎤ = ⎣ ⎡ 0 0 80 90 ⎦ ⎤ Now, perform Gauss-Jordan elimination steps to solve for the unknown flow rates.
We form the augmented matrix, then use Row 1 to eliminate values in Rows 2 and
3:
[ 1 − 1 1 0 − 1 1 − 1 0 20 10 0 80 0 10 25 90 ] R 1 + R 1 − 20 R 1 R 1 → [ 1 − 1 1 0 0 0 0 0 0 30 − 20 80 0 10 25 90 ] \begin{bmatrix}
1 & -1 & 1 & 0 \\
-1 & 1 & -1 & 0 \\
20 & 10 & 0 & 80 \\
0 & 10 & 25 & 90
\end{bmatrix}
\begin{matrix}
\vphantom{R_1} \\ + R_1 \\ -20 R_1 \\ \vphantom{R_1}
\end{matrix}
\to
\begin{bmatrix}
1 & -1 & 1 & 0 \\
0 & 0 & 0 & 0 \\
0 & 30 & -20 & 80 \\
0 & 10 & 25 & 90
\end{bmatrix} ⎣ ⎡ 1 − 1 20 0 − 1 1 10 10 1 − 1 0 25 0 0 80 90 ⎦ ⎤ R 1 + R 1 − 20 R 1 R 1 → ⎣ ⎡ 1 0 0 0 − 1 0 30 10 1 0 − 20 25 0 0 80 90 ⎦ ⎤ Row 2 is all zeros because it was a redundant equation to Row 1. Swap Rows 2 and
4, then use the new Row 2 to eliminate value in Row 3:
[ 1 − 1 1 0 0 10 25 90 0 30 − 20 80 0 0 0 0 ] R 1 R 1 − 3 R 2 R 1 → [ 1 − 1 1 0 0 10 25 90 0 0 − 95 − 190 0 0 0 0 ] \begin{bmatrix}
1 & -1 & 1 & 0 \\
0 & 10 & 25 & 90 \\
0 & 30 & -20 & 80 \\
0 & 0 & 0 & 0
\end{bmatrix}
\begin{matrix}
\vphantom{R_1} \\ \vphantom{R_1} \\ -3 R_2 \\ \vphantom{R_1}
\end{matrix}
\to \begin{bmatrix}
1 & -1 & 1 & 0 \\
0 & 10 & 25 & 90 \\
0 & 0 & -95 & -190 \\
0 & 0 & 0 & 0
\end{bmatrix} ⎣ ⎡ 1 0 0 0 − 1 10 30 0 1 25 − 20 0 0 90 80 0 ⎦ ⎤ R 1 R 1 − 3 R 2 R 1 → ⎣ ⎡ 1 0 0 0 − 1 10 0 0 1 25 − 95 0 0 90 − 190 0 ⎦ ⎤ Normalize Row 3 (divide by -95), then eliminate values above in Column 3:
[ 1 − 1 1 0 0 10 25 90 0 0 1 2 0 0 0 0 ] − R 3 − 25 R 3 R 1 R 1 → [ 1 − 1 0 − 2 0 10 0 40 0 0 1 2 0 0 0 0 ] \begin{bmatrix}
1 & -1 & 1 & 0 \\
0 & 10 & 25 & 90 \\
0 & 0 & 1 & 2 \\
0 & 0 & 0 & 0
\end{bmatrix}
\begin{matrix}
- R_3 \\ -25 R_3 \\ \vphantom{R_1} \\ \vphantom{R_1}
\end{matrix}
\to
\begin{bmatrix}
1 & -1 & 0 & -2 \\
0 & 10 & 0 & 40 \\
0 & 0 & 1 & 2 \\
0 & 0 & 0 & 0
\end{bmatrix} ⎣ ⎡ 1 0 0 0 − 1 10 0 0 1 25 1 0 0 90 2 0 ⎦ ⎤ − R 3 − 25 R 3 R 1 R 1 → ⎣ ⎡ 1 0 0 0 − 1 10 0 0 0 0 1 0 − 2 40 2 0 ⎦ ⎤ Normalize Row 2 (divide by 10), then eliminate values above in Column 2:
[ 1 − 1 0 − 2 0 1 0 4 0 0 1 2 0 0 0 0 ] + R 2 R 1 R 1 R 1 → [ 1 0 0 2 0 1 0 4 0 0 1 2 0 0 0 0 ] \begin{bmatrix}
1 & -1 & 0 & -2 \\
0 & 1 & 0 & 4 \\
0 & 0 & 1 & 2 \\
0 & 0 & 0 & 0
\end{bmatrix}
\begin{matrix}
+ R_2 \\ \vphantom{R_1} \\ \vphantom{R_1} \\ \vphantom{R_1}
\end{matrix}
\to
\begin{bmatrix}
1 & 0 & 0 & 2 \\
0 & 1 & 0 & 4 \\
0 & 0 & 1 & 2 \\
0 & 0 & 0 & 0
\end{bmatrix} ⎣ ⎡ 1 0 0 0 − 1 1 0 0 0 0 1 0 − 2 4 2 0 ⎦ ⎤ + R 2 R 1 R 1 R 1 → ⎣ ⎡ 1 0 0 0 0 1 0 0 0 0 1 0 2 4 2 0 ⎦ ⎤ Turning back into an equivalent system of equations gives the final solution,
Q 1 = 2 Q_1 = 2 Q 1 = 2 , Q 2 = 4 Q_2 = 4 Q 2 = 4 , and Q 3 = 2 Q_3 = 2 Q 3 = 2 .
Number of solutions ¶ The number of solutions for the system of linear equations can be determined
from the row-reduced augmented matrix.
There is no solution if there is a row of zeroes with a nonzero last column.
[ 3 2 1 3 2 1 1 0 6 2 4 6 ] R 1 − ( 2 / 3 ) R 1 − 2 R 1 → [ 3 2 1 3 0 − 1 / 3 1 / 3 − 2 0 − 2 2 0 ] R 1 × − 3 ÷ 2 → [ 3 2 1 3 0 1 − 1 6 0 − 1 1 0 ] R 1 R 2 + R 2 → [ 3 2 1 3 0 1 − 1 6 0 0 0 12 ] \begin{align}
\begin{bmatrix}
3 & 2 & 1 & 3 \\
2 & 1 & 1 & 0 \\
6 & 2 & 4 & 6
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ -(2/3) R_1 \\ -2 R_1 \end{matrix}
&\to \begin{bmatrix}
3 & 2 & 1 & 3 \\
0 & -1/3 & 1/3 & -2 \\
0 & -2 & 2 & 0
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \times -3 \\ \div 2\end{matrix} \\
&\to \begin{bmatrix}
3 & 2 & 1 & 3 \\
0 & 1 & -1 & 6 \\
0 & -1 & 1 & 0
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \vphantom{R_2} \\ +R_2 \end{matrix} \\
&\to \begin{bmatrix}
3 & 2 & 1 & 3 \\
0 & 1 & -1 & 6 \\
0 & 0 & 0 & 12
\end{bmatrix}
\end{align} ⎣ ⎡ 3 2 6 2 1 2 1 1 4 3 0 6 ⎦ ⎤ R 1 − ( 2/3 ) R 1 − 2 R 1 → ⎣ ⎡ 3 0 0 2 − 1/3 − 2 1 1/3 2 3 − 2 0 ⎦ ⎤ R 1 × − 3 ÷ 2 → ⎣ ⎡ 3 0 0 2 1 − 1 1 − 1 1 3 6 0 ⎦ ⎤ R 1 R 2 + R 2 → ⎣ ⎡ 3 0 0 2 1 0 1 − 1 0 3 6 12 ⎦ ⎤ Since the last row is equivalent to 0 = 12 0 = 12 0 = 12 , there is a false equation and
the system has no solution.
There is one solution if there is one pivot for each unknown.
[ 3 2 1 3 2 1 1 0 6 2 5 6 ] R 1 − ( 2 / 3 ) R 1 − 2 R 1 → [ 3 2 1 3 0 − 1 / 3 1 / 3 − 2 0 − 2 3 0 ] R 1 × − 3 R 3 → [ 3 2 1 3 0 1 − 1 6 0 − 2 3 0 ] R 1 R 2 + 2 R 2 → [ 3 2 1 3 0 1 − 1 6 0 0 1 12 ] − R 3 + R 3 R 3 → [ 3 2 0 − 9 0 1 0 18 0 0 1 12 ] − 2 R 2 R 3 → [ 3 0 0 − 45 0 1 0 18 0 0 1 12 ] ÷ 3 R 3 → [ 1 0 0 − 15 0 1 0 18 0 0 1 12 ] \begin{align}
\begin{bmatrix}
3 & 2 & 1 & 3 \\
2 & 1 & 1 & 0 \\
6 & 2 & 5 & 6
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ -(2/3) R_1 \\ -2 R_1 \end{matrix}
&\to \begin{bmatrix}
3 & 2 & 1 & 3 \\
0 & -1/3 & 1/3 & -2 \\
0 & -2 & 3 & 0
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \times -3 \\ \vphantom{R_3} \end{matrix} \\
&\to \begin{bmatrix}
3 & 2 & 1 & 3 \\
0 & 1 & -1 & 6 \\
0 & -2 & 3 & 0
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \vphantom{R_2} \\ +2 R_2 \end{matrix} \\
&\to \begin{bmatrix}
3 & 2 & 1 & 3 \\
0 & 1 & -1 & 6 \\
0 & 0 & 1 & 12
\end{bmatrix}
\begin{matrix} -R_3 \\ +R_3 \\ \vphantom{R_3} \end{matrix} \\
&\to \begin{bmatrix}
3 & 2 & 0 & -9 \\
0 & 1 & 0 & 18 \\
0 & 0 & 1 & 12
\end{bmatrix}
\begin{matrix} -2R_2 \\ \vphantom{R_3} \end{matrix} \\
&\to \begin{bmatrix}
3 & 0 & 0 & -45 \\
0 & 1 & 0 & 18 \\
0 & 0 & 1 & 12
\end{bmatrix}
\begin{matrix} \div 3 \\ \vphantom{R_3} \end{matrix} \\
&\to \begin{bmatrix}
1 & 0 & 0 & -15 \\
0 & 1 & 0 & 18 \\
0 & 0 & 1 & 12
\end{bmatrix}
\end{align} ⎣ ⎡ 3 2 6 2 1 2 1 1 5 3 0 6 ⎦ ⎤ R 1 − ( 2/3 ) R 1 − 2 R 1 → ⎣ ⎡ 3 0 0 2 − 1/3 − 2 1 1/3 3 3 − 2 0 ⎦ ⎤ R 1 × − 3 R 3 → ⎣ ⎡ 3 0 0 2 1 − 2 1 − 1 3 3 6 0 ⎦ ⎤ R 1 R 2 + 2 R 2 → ⎣ ⎡ 3 0 0 2 1 0 1 − 1 1 3 6 12 ⎦ ⎤ − R 3 + R 3 R 3 → ⎣ ⎡ 3 0 0 2 1 0 0 0 1 − 9 18 12 ⎦ ⎤ − 2 R 2 R 3 → ⎣ ⎡ 3 0 0 0 1 0 0 0 1 − 45 18 12 ⎦ ⎤ ÷ 3 R 3 → ⎣ ⎡ 1 0 0 0 1 0 0 0 1 − 15 18 12 ⎦ ⎤ There are 3 pivot points and 3 unknowns, the solution is x 1 = − 15 x_1 = -15 x 1 = − 15 ,
x 2 = 18 x_2 = 18 x 2 = 18 , and x 3 = 12 x_3 = 12 x 3 = 12 .
There are infinitely many solutions if there are fewer pivots than unknowns.
[ 3 2 1 3 2 1 1 0 6 2 4 − 6 ] R 1 − ( 2 / 3 ) R 1 − 2 R 1 → [ 3 2 1 3 0 − 1 / 3 1 / 3 − 2 0 − 2 2 − 12 ] R 1 × − 3 ÷ − 2 → [ 3 2 1 3 0 1 − 1 6 0 1 − 1 6 ] − 2 R 2 R 2 R 3 → [ 3 0 3 − 9 0 1 − 1 6 0 0 0 0 ] ÷ 3 R 2 R 3 → [ 1 0 1 − 3 0 1 − 1 6 0 0 0 0 ] \begin{align}
\begin{bmatrix}
3 & 2 & 1 & 3 \\
2 & 1 & 1 & 0 \\
6 & 2 & 4 & -6
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ -(2/3) R_1 \\ -2 R_1 \end{matrix}
&\to \begin{bmatrix}
3 & 2 & 1 & 3 \\
0 & -1/3 & 1/3 & -2 \\
0 & -2 & 2 & -12
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \times -3 \\ \div -2\end{matrix} \\
&\to \begin{bmatrix}
3 & 2 & 1 & 3 \\
0 & 1 & -1 & 6 \\
0 & 1 & -1 & 6
\end{bmatrix}
\begin{matrix}-2 R_2 \\ \vphantom{R_2} \\ \vphantom{R_3} \end{matrix} \\
&\to \begin{bmatrix}
3 & 0 & 3 & -9 \\
0 & 1 & -1 & 6 \\
0 & 0 & 0 & 0
\end{bmatrix}
\begin{matrix}\div 3 \\ \vphantom{R_2} \\ \vphantom{R_3} \end{matrix} \\
&\to \begin{bmatrix}
1 & 0 & 1 & -3 \\
0 & 1 & -1 & 6 \\
0 & 0 & 0 & 0
\end{bmatrix}
\end{align} ⎣ ⎡ 3 2 6 2 1 2 1 1 4 3 0 − 6 ⎦ ⎤ R 1 − ( 2/3 ) R 1 − 2 R 1 → ⎣ ⎡ 3 0 0 2 − 1/3 − 2 1 1/3 2 3 − 2 − 12 ⎦ ⎤ R 1 × − 3 ÷ − 2 → ⎣ ⎡ 3 0 0 2 1 1 1 − 1 − 1 3 6 6 ⎦ ⎤ − 2 R 2 R 2 R 3 → ⎣ ⎡ 3 0 0 0 1 0 3 − 1 0 − 9 6 0 ⎦ ⎤ ÷ 3 R 2 R 3 → ⎣ ⎡ 1 0 0 0 1 0 1 − 1 0 − 3 6 0 ⎦ ⎤ There are 2 pivot points but 3 unknowns, so there is one free variable. The
solution is x 1 = − x 3 − 3 x_1 = -x_3 - 3 x 1 = − x 3 − 3 and x 2 = x 3 + 6 x_2 = x_3 + 6 x 2 = x 3 + 6 , with x 3 x_3 x 3 free.
Skill builder problems ¶ Form the augmented matrix and perform row reduction:
[ 5 − 2 20.9 − 1 4 − 19.3 ] s w a p R 2 → [ − 1 4 − 19.3 5 − 2 20.9 ] × − 1 R 2 → [ 1 − 4 19.3 5 − 2 20.9 ] R 1 − 5 R 1 → [ 1 − 4 19.3 0 18 − 75.6 ] R 1 ÷ 18 → [ 1 − 4 19.3 0 1 − 4.2 ] + 4 R 2 R 2 → [ 1 0 2.5 0 1 − 4.2 ] \begin{align}
\begin{bmatrix} 5 & -2 & 20.9 \\ -1 & 4 & -19.3 \end{bmatrix}
\begin{matrix} {\rm swap} \\ \vphantom{R_2}\end{matrix}
&\to \begin{bmatrix} -1 & 4 & -19.3 \\ 5 & -2 & 20.9\end{bmatrix}
\begin{matrix} \times -1 \\ \vphantom{R_2}\end{matrix} \\
&\to \begin{bmatrix} 1 & -4 & 19.3 \\ 5 & -2 & 20.9\end{bmatrix}
\begin{matrix} \vphantom{R_1} \\ -5 R_1 \end{matrix} \\
&\to \begin{bmatrix} 1 & -4 & 19.3 \\ 0 & 18 & -75.6\end{bmatrix}
\begin{matrix} \vphantom{R_1} \\ \div 18 \end{matrix} \\
&\to \begin{bmatrix} 1 & -4 & 19.3 \\ 0 & 1 & -4.2\end{bmatrix}
\begin{matrix} +4 R_2 \\ \vphantom{R_2} \end{matrix} \\
&\to \begin{bmatrix} 1 & 0 & 2.5 \\ 0 & 1 & -4.2\end{bmatrix}
\end{align} [ 5 − 1 − 2 4 20.9 − 19.3 ] swap R 2 → [ − 1 5 4 − 2 − 19.3 20.9 ] × − 1 R 2 → [ 1 5 − 4 − 2 19.3 20.9 ] R 1 − 5 R 1 → [ 1 0 − 4 18 19.3 − 75.6 ] R 1 ÷ 18 → [ 1 0 − 4 1 19.3 − 4.2 ] + 4 R 2 R 2 → [ 1 0 0 1 2.5 − 4.2 ] so x 1 = 2.5 x_1 = 2.5 x 1 = 2.5 and x 2 = − 4.2 x_2 = -4.2 x 2 = − 4.2 .
[ 1 4 8 2 8 17 ] R 1 − 2 R 1 → [ 1 4 8 0 0 1 ] \begin{align}
\begin{bmatrix} 1 & 4 & 8 \\ 2 & 8 & 17 \end{bmatrix}
\begin{matrix} \vphantom{R_1} \\ -2 R_1\end{matrix}
&\to \begin{bmatrix} 1 & 4 & 8 \\ 0 & 0 & 1\end{bmatrix}
\end{align} [ 1 2 4 8 8 17 ] R 1 − 2 R 1 → [ 1 0 4 0 8 1 ] The equations do not have a solution because the last row is false.
[ 0 1 1 − 2 0 4 6 − 12 1 1 1 2 ] R 1 s h u f f l e R 3 → [ 1 1 1 2 0 1 1 − 2 0 4 6 − 12 ] R 1 R 2 − 4 R 2 → [ 1 1 1 2 0 1 1 − 2 0 0 2 − 4 ] R 1 R 2 ÷ 2 → [ 1 1 1 2 0 1 1 − 2 0 0 1 − 2 ] − R 3 − R 3 R 3 → [ 1 1 0 4 0 1 0 0 0 0 1 − 2 ] − R 2 R 2 R 3 → [ 1 0 0 4 0 1 0 0 0 0 1 − 2 ] \begin{align}
\begin{bmatrix}
0 & 1 & 1 & -2 \\
0 & 4 & 6 & -12 \\
1 & 1 & 1 & 2
\end{bmatrix}
\begin{matrix}
\vphantom{R_1} \\ \rm shuffle \\ \vphantom{R_3}
\end{matrix}
&\to \begin{bmatrix}
1 & 1 & 1 & 2 \\
0 & 1 & 1 & -2 \\
0 & 4 & 6 & -12
\end{bmatrix}
\begin{matrix}
\vphantom{R_1} \\ \vphantom{R_2} \\ \ -4 R_2
\end{matrix} \\
&\to \begin{bmatrix}
1 & 1 & 1 & 2 \\
0 & 1 & 1 & -2 \\
0 & 0 & 2 & -4
\end{bmatrix}
\begin{matrix}
\vphantom{R_1} \\ \vphantom{R_2} \\ \div 2
\end{matrix} \\
&\to \begin{bmatrix}
1 & 1 & 1 & 2 \\
0 & 1 & 1 & -2 \\
0 & 0 & 1 & -2
\end{bmatrix}
\begin{matrix} -R_3 \\ -R_3 \\ \vphantom{R_3} \end{matrix} \\
&\to \begin{bmatrix}
1 & 1 & 0 & 4 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & -2
\end{bmatrix}
\begin{matrix}
-R_2 \\ \vphantom{R_2} \\ \vphantom{R_3}
\end{matrix} \\
&\to \begin{bmatrix}
1 & 0 & 0 & 4 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & -2
\end{bmatrix}
\end{align} ⎣ ⎡ 0 0 1 1 4 1 1 6 1 − 2 − 12 2 ⎦ ⎤ R 1 shuffle R 3 → ⎣ ⎡ 1 0 0 1 1 4 1 1 6 2 − 2 − 12 ⎦ ⎤ R 1 R 2 − 4 R 2 → ⎣ ⎡ 1 0 0 1 1 0 1 1 2 2 − 2 − 4 ⎦ ⎤ R 1 R 2 ÷ 2 → ⎣ ⎡ 1 0 0 1 1 0 1 1 1 2 − 2 − 2 ⎦ ⎤ − R 3 − R 3 R 3 → ⎣ ⎡ 1 0 0 1 1 0 0 0 1 4 0 − 2 ⎦ ⎤ − R 2 R 2 R 3 → ⎣ ⎡ 1 0 0 0 1 0 0 0 1 4 0 − 2 ⎦ ⎤ so x 1 = 4 x_1 = 4 x 1 = 4 , x 2 = 0 x_2 = 0 x 2 = 0 , and x 3 = − 2 x_3 = -2 x 3 = − 2 .
[ 0 4 4 24 3 − 11 − 2 − 6 6 − 17 1 18 ] s w a p R 2 R 2 R 3 → [ 3 − 11 − 2 − 6 0 − 4 4 24 6 − 17 1 18 ] R 1 R 2 − 2 R 1 → [ 3 − 11 − 2 − 6 0 4 4 24 0 5 5 30 ] R 1 ÷ 4 ÷ 5 → [ 3 − 11 − 2 − 6 0 1 1 6 0 1 1 6 ] R 1 R 2 − R 2 → [ 3 − 11 − 2 − 6 0 1 1 6 0 0 0 0 ] + 11 R 2 R 2 R 3 → [ 3 0 9 60 0 1 1 6 0 0 0 0 ] ÷ 3 R 2 R 3 → [ 1 0 3 20 0 1 1 6 0 0 0 0 ] \begin{align}
\begin{bmatrix}
0 & 4 & 4 & 24 \\
3 & -11 & -2 & -6 \\
6 & - 17 & 1 & 18
\end{bmatrix}
\begin{matrix}{\rm swap}\,R_2 \\ \vphantom{R_2} \\ \vphantom{R_3}\end{matrix}
&\to \begin{bmatrix}
3 & -11 & -2 & -6 \\
0 & -4 & 4 & 24 \\
6 & - 17 & 1 & 18
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \vphantom{R_2} \\ -2 R_1\end{matrix}\\
&\to \begin{bmatrix}
3 & -11 & -2 & -6 \\
0 & 4 & 4 & 24 \\
0 & 5 & 5 & 30
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \div 4 \\ \div 5\end{matrix}\\
&\to \begin{bmatrix}
3 & -11 & -2 & -6 \\
0 & 1 & 1 & 6 \\
0 & 1 & 1 & 6
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ \vphantom{R_2} \\ -R_2\end{matrix}\\
&\to \begin{bmatrix}
3 & -11 & -2 & -6 \\
0 & 1 & 1 & 6 \\
0 & 0 & 0 & 0
\end{bmatrix}
\begin{matrix}+11 R_2 \\ \vphantom{R_2} \\ \vphantom{R_3}\end{matrix}\\
&\to \begin{bmatrix}
3 & 0 & 9 & 60 \\
0 & 1 & 1 & 6 \\
0 & 0 & 0 & 0
\end{bmatrix}
\begin{matrix}\div 3 \\ \vphantom{R_2} \\ \vphantom{R_3}\end{matrix}\\
&\to \begin{bmatrix}
1 & 0 & 3 & 20 \\
0 & 1 & 1 & 6 \\
0 & 0 & 0 & 0
\end{bmatrix}
\end{align} ⎣ ⎡ 0 3 6 4 − 11 − 17 4 − 2 1 24 − 6 18 ⎦ ⎤ swap R 2 R 2 R 3 → ⎣ ⎡ 3 0 6 − 11 − 4 − 17 − 2 4 1 − 6 24 18 ⎦ ⎤ R 1 R 2 − 2 R 1 → ⎣ ⎡ 3 0 0 − 11 4 5 − 2 4 5 − 6 24 30 ⎦ ⎤ R 1 ÷ 4 ÷ 5 → ⎣ ⎡ 3 0 0 − 11 1 1 − 2 1 1 − 6 6 6 ⎦ ⎤ R 1 R 2 − R 2 → ⎣ ⎡ 3 0 0 − 11 1 0 − 2 1 0 − 6 6 0 ⎦ ⎤ + 11 R 2 R 2 R 3 → ⎣ ⎡ 3 0 0 0 1 0 9 1 0 60 6 0 ⎦ ⎤ ÷ 3 R 2 R 3 → ⎣ ⎡ 1 0 0 0 1 0 3 1 0 20 6 0 ⎦ ⎤ Hence,
x 1 − 3 x 3 = 20 → x 1 = 3 x 3 + 20 x 2 + x 3 = 6 → x 2 = x 3 + 6 \begin{align}
x_1 - 3x_3 &= 20 \to & x_1 &= 3 x_3 + 20 \\
x_2 + x_3 &= 6 \to & x_2 &= x_3 + 6
\end{align} x 1 − 3 x 3 x 2 + x 3 = 20 → = 6 → x 1 x 2 = 3 x 3 + 20 = x 3 + 6 with x 3 x_3 x 3 free.
[ 2 − 1 3 − 1 − 4 2 − 6 − 2 ] R 1 + 2 R 1 → [ 2 − 1 3 − 1 0 0 0 0 ] \begin{align}
\begin{bmatrix}
2 & -1 & 3 & -1 \\
-4 & 2 & -6 & -2
\end{bmatrix}
\begin{matrix}\vphantom{R_1} \\ +2R_1\end{matrix}
\to \begin{bmatrix}
2 & -1 & 3 & -1 \\
0 & 0& 0 & 0
\end{bmatrix}
\end{align} [ 2 − 4 − 1 2 3 − 6 − 1 − 2 ] R 1 + 2 R 1 → [ 2 0 − 1 0 3 0 − 1 0 ] Hence,
2 x 1 − x 2 + 3 x 3 = − 1 → x 1 = 1 2 ( x 2 + x 3 − 1 ) 2x_1 - x_2 + 3x_3 = -1 \to \quad x_1 = \frac{1}{2}(x_2 + x_3 - 1) 2 x 1 − x 2 + 3 x 3 = − 1 → x 1 = 2 1 ( x 2 + x 3 − 1 ) with x 2 x_2 x 2 and x 3 x_3 x 3 free.