Now that we have our system of linear equations in augmented matrix form, we can solve for the unknown variables using a technique called Gauss-Jordan Elimination. In regular algebra, we may try to solve the system by combining equations to eliminate variables until we can solve for a single one. Having one variable solved for then allows us to solve for a second variable, and we can continue that process until all variables are solved for.

The same goal can be used for solving for the unknown variables when in the matrix representation. We start with forming our augmented matrix.

[a1b1c1d1a2b2c2d2a3b3c3d3]\begin{bmatrix} a_{1} & b_{1} & c_{1} \bigm| d_{1} \\ a_{2} & b_{2} & c_{2} \bigm| d_{2} \\ a_{3} & b_{3} & c_{3} \bigm| d_{3} \\ \end{bmatrix}

To solve for the system, we want to put our augmented matrix into something called row echelon form where all elements below the diagonal are equal to zero. This looks like the following:

[a1b1c1d1a2b2c2d2a3b3c3d3][1b1c1d101c2d2001d3]\begin{bmatrix} a_{1} & b_{1} & c_{1} \bigm| d_{1} \\ a_{2} & b_{2} & c_{2} \bigm| d_{2} \\ a_{3} & b_{3} & c_{3} \bigm| d_{3} \\ \end{bmatrix} \rightarrow \begin{bmatrix} 1 & b_{1}' & c_{1}' \bigm| d_{1}' \\ 0 & 1 & c_{2}' \bigm| d_{2}' \\ 0 & 0 & 1 \hspace{1.25mm} \bigm| d_{3}' \\ \end{bmatrix}

Note that the values with apostrophes in the row echelon form matrix mean that they have been changed in the process of updating the matrix. Once in this form we can rewrite our original equation as:

x+b1y+c1z=d1y+c2z=d2z=d3\begin{aligned} x + b_{1}' y + c_{1}'z = d_{1}' \\ y + c_{2}'z = d_{2}' \\ z = d_{3}' \\ \end{aligned}

This allows us to solve the equations directly using simple algebra. But how do we get to this form?

To get to row echelon form we swap rows and/or add or subtract rows against other rows. A typical strategy is to add or subtract row 1 against all rows below in order to make all elements in column 1 equal to 0 under the diagonal. Once this is achieved, we can do the same with row 2 and all rows below to make all elements below the diagonal in column 2 equal to 0.

Once all elements below the diagonal are equal to 0, we can simply solve for the variable values, starting at the bottom of the matrix and working our way up.

It’s important to realize that not all systems of equations are solvable! For example, we can perform Gauss-Jordan Elimination and end up with the following augmented matrix.

[122503130002]\begin{bmatrix} 1 & -2 & -2 \bigm| 5 \\ \bf 0 & 3 & -1 \bigm| 3 \\ \bf 0 & \bf 0 & \enspace\; {\bf 0 } \bigm| 2 \end{bmatrix}

This final augmented matrix here suggests that 0z = 2, which is impossible!


Let’s walk through an example of Gauss-Jordan elimination going through the animation on the right step-by-step.

Step 1
Put system of equations into augmented matrix form.

Step 2
Cancel out the first two entries in row 2 by adding the values of row 1 to row 2.

Step 3
Cancel out the first entry in row 3 by adding the values of row 1 to one-half of each value in row 3.

Step 4
Swap row 2 and row 3.

Step 5
Normalize the diagonals (make them all equal 1). Multiply each value in row 2 by 1/2 and each value in row 3 by -1.

Step 6
Put augmented matrix into system of equations form.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?