Solving a linear system with matrices using Gaussian elimination - Matrices

Solving a linear system with matrices using Gaussian elimination

After a few lessons in which we have repeatedly mentioned that we are covering the basics needed to later learn how to solve systems of linear equations, the time has come for our lesson to focus on the full methodology to follow in order to find the solutions for such systems.

What is Gaussian elimination

Gaussian elimination is the name of the method we use to perform the three types of matrix row operations on an augmented matrix coming from a linear system of equations in order to find the solutions for such system. This technique is also called row reduction and it consists of two stages: Forward elimination and back substitution.

These two Gaussian elimination method steps are differentiated not by the operations you can use through them, but by the result they produce. The forward elimination step refers to the row reduction needed to simplify the matrix in question into its echelon form. Such stage has the purpose to demonstrate if the system of equations portrayed in the matrix have a unique possible solution, infinitely many solutions or just no solution at all. If found that the system has no solution, then there is no reason to continue row reducing the matrix through the next stage.

If is possible to obtain solutions for the variables involved in the linear system, then the Gaussian elimination with back substitution stage is carried through. This last step will produce a reduced echelon form of the matrix which in turn provides the general solution to the system of linear equations.

The Gaussian elimination rules are the same as the rules for the three elementary row operations, in other words, you can algebraically operate on the rows of a matrix in the next three ways (or combination of):

  1. Interchanging two rows
  2. Multiplying a row by a constant (any constant which is not zero)
  3. Adding a row to another row

And so, solving a linear system with matrices using Gaussian elimination happens to be a structured, organized and quite efficient method.

How to do Gaussian elimination

The is really not an established set of Gaussian elimination steps to follow in order to solve a system of linear equations, is all about the matrix you have in your hands and the necessary row operations to simplify it. For that, let us work on our first Gaussian elimination example so you can start looking into the whole process and the intuition that is needed when working through them:

Example 1

  • If we were to have the following system of linear equations containing three equations for three unknowns:
    System of linear equations to solve
    System of linear equations to solve
    System of linear equations to solve
    Equation 1: System of linear equations to solve
  • We know from our lesson on representing a linear system as a matrix that we can represent such system as an augmented matrix like the one below:

    Transcribing the linear system into an augmented matrix
    Equation 2: Transcribing the linear system into an augmented matrix
  • Let us row-reduce (use Gaussian elimination) so we can simplify the matrix:

    Row reducing (applying the Gaussian elimination method to) the augmented matrix
    Row reducing (applying the Gaussian elimination method to) the augmented matrix
    Row reducing (applying the Gaussian elimination method to) the augmented matrix
    Equation 3: Row reducing (applying the Gaussian elimination method to) the augmented matrix
  • Resulting in the matrix:

    Reduced matrix into its echelon form
    Equation 4: Reduced matrix into its echelon form

Notice that at this point, we can observe that this system of linear equations is solvable with a unique solution for each of its variables. What we have performed so far is the first stage of row reduction: Forward elimination. We can continue simplifying this matrix even more (which would take us to the second stage of back substitution) but we really don't need to since at this point the system is easily solvable. Thus, we look at the resulting system to solve it directly:

  • Resulting linear system of equations to solve
    Resulting linear system of equations to solve
    Resulting linear system of equations to solve
    Equation 5: Resulting linear system of equations to solve

From this set, we can automatically observe that the value of the variable z is: z=-2. We use this knowledge to substitute it on the second equations to solve for y, and the substitute both y and z values on the first equations to solve for x:

  • Solving the resulting linear system of equations
    Solving the resulting linear system of equations
    Solving the resulting linear system of equations
  • Applying the values of y and z to the first equation

    Solving the resulting linear system of equations
    Equation 6: Solving the resulting linear system of equations
  • And the final solution for the system is:

    Final solution to the system of linear equations
    Equation 7: Final solution to the system of linear equations for example 1

More Gaussian elimination problems have been added to this lesson in its last section. Make sure to work through them in order to practice.

Difference between gaussian elimination and gauss jordan elimination

The difference between Gaussian elimination and the Gaussian Jordan elimination is that one produces a matrix in row echelon form while the other produces a matrix in row reduced echelon form. A row echelon form matrix has an upper triangular composition where any zero rows are at the bottom and leading terms are all to the right of the leading term from the row above. Reduced echelon form goes beyond by simplifying much more (sometimes even reaching the shape of an identity matrix).

Difference between echelon form and row echelon form
Equation 8: Difference between echelon form and row echelon form

The history of Gaussian elimination and its names is quite interesting, you will be surprised to know that the name "Gaussian" was attributed to this methodology by mistake in the last century. In reality the algorithm to simultaneously solve a system of linear equations using matrices and row reduction has been found to be written in some form in ancient Chinese texts that date to even before our era. Then in the late 1600's Isaac Newton put together a lesson on it to fill up something he considered as a void in algebra books. After the name "Gaussian" had been already established in the 1950's, the Gaussian-Jordan term was adopted when geodesist W. Jordan improved the technique so he could use such calculations to process his observed land surveying data. If you would like to continue reading about the fascinating history about the mathematicians of Gaussian elimination do not hesitate to click on the link and read.

There is really no physical difference between Gaussian elimination and Gauss Jordan elimination, both processes follow the exact same type of row operations and combinations of them, their difference resides on the results they produce. Many mathematicians and teachers around the world will refer to Gaussian elimination vs Gauss Jordan elimination as the methods to produce an echelon form matrix vs a method to produce a reduced echelon form matrix, but in reality, they are talking about the two stages of row reduction we explained on the very first section of this lesson (forward elimination and back substitution), and so, you just apply row operations until you have simplified the matrix in question. If you arrive to the echelon form you can usually solve a system of linear equations with it (up until here, this is what would be called Gaussian elimination). If you need to continue the simplification of such matrix in order to obtain directly the general solution for the system of equations you are working on, for this case you just continue to row-operate on the matrix until you have simplified it to reduced echelon form (this would be what we call the Gauss-Jordan part and which could be considered also as pivoting Gaussian elimination).

We will leave the extensive explanation on row reduction and echelon forms for the next lesson, for now you need to know that, unless you have an identity matrix on the left hand side of the augmented matrix you are solving (in which case you don't need to do anything to solve the system of equations related to the matrix), the Gaussian elimination method (regular row reduction) will always be used to solve a linear system of equations which has been transcribed as a matrix.

Gaussian elimination examples

As our last section, let us work through some more exercises on Gaussian elimination (row reduction) so you can acquire more practice on this methodology. Throughout many future lessons in this course for Linear Algebra, you will find that row reduction is one of the most important tools there are when working with matrix equations. Therefore, make sure you understand all of the steps involved in the solution for the next problems.

Example 2

  • Solve the following linear system using Gaussian elimination:

    System of linear equations with two variables
    System of linear equations with two variables
    Equation 9: System of linear equations with two variables
  • Transcribing the system of linear equations into an augmented matrix we obtain the matrix equation:
    Resulting augmented matrix
    Equation 10: Resulting augmented matrix
  • Row reducing the augmented matrix
    Equation 11: Row reducing the augmented matrix
  • We can clearly see from the resulting matrix that y=5-y=-5 \; meaning that y=5y=5 \; . We substitute this value into the equation equivalent to the first row of the resulting augmented matrix to solve for the variable x:
    Matrix solving for x
    Equation 12: Solving for x
  • Therefore the final solution for the system of linear equations is:
    Solution for the system of equations
    Equation 13: Final solution for the system of equations

Example 3

  • Solve the following linear system using Gaussian elimination:

    System of linear equations with three variables
    System of linear equations with three variables
    System of linear equations with three variables
    Equation 14: System of linear equations with three variables

For this system we know we will obtain an augmented matrix with three rows (since the system contains three equations) and three columns to the left of the vertical line (since there are three different variables). On this case we will go directly into the row reduction, and so, the first matrix you will see on this process is the one you obtain by transcribing the system of linear equations into an augmented matrix.

  • Row reducing the augmented matrix
    Row reducing the augmented matrix
    Equation 15: Row reducing the augmented matrix

Notice how we can tell right away that the variable z is equal to zero for this system since the third row of the resulting matrix shows the equation -9z = 0. We use that knowledge and check the second row of the matrix which would provide the equation 2y - 6z = 0, plugging the value of z = 0 \, into that equation results in y \, also being zero. Thus, we finally substitute both values of y and z \, into the equation that results from the first row of the matrix: x + 4y + 3z = 1, since both y and z \, are zero, then this gives us x = 1. And so, the final solution to this system of equations looks as follows:

  • Final solution to the system of equations
    Equation 16: Final solution to the system of equations

Example 4

  • Solve the following linear system using Gaussian elimination:

    System of linear equations with three variables
    System of linear equations with three variables
    System of linear equations with three variables
    Equation 17: System of linear equations with three variables
  • We transcribe the linear system as an augmented matrix and then we start the Gaussian elimination process:
    Row reducing the augmented matrix
    Row reducing the augmented matrix
    Row reducing the augmented matrix
    Equation 18: Row reducing the augmented matrix

From which we can see that the last row provides the equation: 6z = 3 and therefore z = 1/2. We substitute this in the equations resulting from the second and first row (in that order) to calculate the values of the variables x and y:

  • Solving for x and y
    Solving for x and y
    Solving for x and y
  • Applying the values of y and z to the first equation:
    Solving for x and y
    Solving for x and y
    Equation 19: Solving for x and y
  • Therefore, the final solution to the system of linear equations is:
    Final solution to the system of equations
    Equation 20: Final solution to the system of equations

Example 5

  • Solve the following linear system using Gaussian elimination:
    System of linear equations with two variables
    System of linear equations with two variables
    Equation 21: System of linear equations with two variables
  • Transcribing the linear system as an augmented matrix and row reducing:
    Row reducing the augmented matrix
    Equation 22: Row reducing the augmented matrix
  • Which automatically tells us y = 8. And so, substituting this value into the equation from the first row we obtain: 4x - 5y = 4x - 5(8) = 4x - 40 =-6 4x = 34 \, and therefore the value of x is: x = 172\frac{\small17}{\small2} . And the final solution to this system of equations is:

    Final solution to the system of equations
    Equation 23: Final solution to the system of equations

Example 6

  • Solve the following linear system using Gaussian elimination:
    System of linear equations with three variables
    System of linear equations with three variables
    System of linear equations with three variables
    Equation 24: System of linear equations with three variables
  • Converting the system of equations into an augmented matrix and then row reducing:
    Row reducing the augmented matrix
    Row reducing the augmented matrix
    Equation 25: Row reducing the augmented matrix
  • From the third row in the resulting matrix we know that z = 3. Using this value into the equations from rows one and two, we solve for x and y:
    Solving for x and y
    Solving for x and y
    Solving for x and y
    Applying the values of y and z to the first equation:
    Solving for x and y
    Solving for x and y
    Equation 26: Solving for x and y
  • And so, the final solution to the system of linear equations is:
    Final solution to the system of linear equations
    Equation 27: Final solution to the system of linear equations

To finalize our lesson for today we have a link recommendation to complement your studies: Gaussian elimination an article which contains some extra information about row reduction, including an introduction to the topic and some more examples. As we mentioned before, be ready to keep on using row reduction for almost the whole rest of this course in Linear Algebra, so, we see you in the next lesson!

Solving a linear system with matrices using Gaussian elimination

Now that we have learned how to represent a linear system as a matrix, we can now solve this matrix to solve the linear system! We use a method called "Gaussian elimination". This method involves a lot of matrix row operations. Our goal is to make it so that all entries in the bottom left of the matrix are 0. Once that is done, we take a look at the last row and convert it to a linear system. Then we solve for the variable. Then we look at the second last row, convert it to a linear system, and solve for the other variable. Rinse and repeat, and you will find all the variables which solve the linear system!

Lessons

Notes:
Note
Gaussian elimination (or row reduction) is a method used for solving linear systems. For example,

x+y+z=3x+y+z=3
x+2y+3z=0x+2y+3z=0
x+3y+2z=3x+3y+2z=3

Can be represented as the matrix:
linear system in matrix form

Using Gaussian elimination, we can turn this matrix into

applying gaussian elimination to a matrix (watch the intro video to learn how to do this!)

Now we can start solving for x,yx,y and zz.

So in the third row, we see that 3z=6-3z=6. So z=2z=-2.

In the second row, we see that 2y+4z=62y+4z=-6. Since we know that z=2z=-2, then we can substitute it into the second row and solve for yy. So,

2y+4z=62y+4z=-6 2y+4(2)=6 2y+4(-2)=-6
2y8=6 2y-8=-6
2y=2 2y=2
y=1 y=1

So now we know that z=2z=-2, and y=1y=1. Now let us take a look at the first row and solve for xx.

x+y+z=3x+y+z=3 x+12=3 x+1-2=3
x1=3 x-1=3
x=4 x=4

Since we have solved for x,yx,y and zz, then we have just solved the linear system.
  • 1.
    Gaussian Elimination
    Solve the following linear systems:
Teacher pug

Solving a linear system with matrices using Gaussian elimination

Don't just watch, practice makes perfect.

We have over 1850 practice questions in Algebra for you to master.