# Gaussian elimination method

On this post you will learn what the Gaussian elimination method is and how to solve a system of equations by the Gaussian elimination method.

## What is the Gaussian elimination method?

The Gaussian elimination method, also called row reduction method, is an algorithm used to solve a system of linear equations with a matrix. The Gaussian elimination method consists of expressing a linear system in matrix form and applying elementary row operations to the matrix in order to find the value of the unknowns.

However, to understand how Gaussian elimination works, we must first know how to express a system of linear equations in matrix form and what row operations can be computed. So, we will explain these two things first, and then we will see how to apply Gaussian elimination method.

### Augmented matrix of a system of linear equations

In linear algebra, a system of equations can be expressed in matrix form: the coefficients of the unknown x correspond to the first column of the matrix, the coefficients of the unknown y to the second column, the coefficients of the unknown z to the third column, and the constants to the fourth column.

For example:

The matrix that represents the system of equations is called augmented matrix.

The objective of the Gaussian method is to convert the initial system of equations into a echelon system, that is, a system in which each equation has one less unknown than the previous one:

In other words, we have to transform the augmented matrix into a matrix in row echelon form:

To do this, we have to apply elementary operations on the rows of the matrix. So, let’s see what operations can be done in the Gaussian elimination method.

### Elementary row operations

To convert the augmented matrix to a matrix in row echelon form, you can perform any of the following elementary operations:

• Interchange two rows of the matrix.

For example, we can interchange rows 2 and 3 of a matrix:

• Multiply or divide all the terms in a row by a nonzero number.

For example, we can multiply the first row by 4, and divide the third row by 2:

• Add to a row another row multiplied by a scalar.

For example, in the following matrix we add row 3 multiplied by 1 to row 2:

## How to do Gaussian elimination

Now we are going to see with a solved example how to solve a system of linear equations using the Gaussian elimination method:

First of all, we find the augmented matrix of the system of equations:

As we will see later, it is better if the first number of the first row is 1. Therefore, we are going to change the order of rows 1 and 2:

The goal of the Gaussian elimination method is to make the numbers below the main diagonal 0. So, we have to transform the red numbers to 0:

To eliminate these numbers we must do the appropriate elementary rows operations.

For example, the number -1, which is the first element in the second row, is the negative of 1, the first element in the first row. So if we add the first row to the second row, the -1 will be eliminated:

By adding the rows we obtain the following matrix:

In this way we have transformed the -1 into a 0.

Now we are going to zero the number 2 out. To do so, we add the first row multiplied by -2 to the third row:

And the following matrix is obtained:

Now we have to convert the -8 to 0. To do this, we multiply the third row by 3 and add the second row multiplied by 8:

Therefore, we obtain the following matrix:

As you can see, with all these transformations we have made all the numbers below the main diagonal 0. That is, the matrix is in row echelon form (or triangular form).

Now we must transform the matrix into a system of equations with unknowns. For this, remember that the first column of the matrix corresponds to the unknown x, the second column to the unknown y, the third column to the unknown z, and the last column are the constants of the equations:

And finally, to solve the system we have to find the values of the unknowns from the bottom up. Since the last equation only has one unknown, and therefore, we can easily find its value:

Now we back-substitute into the second row to evaluate the unknown y:

And we do the same with the first equation of the system: we back-substitute the values of the other unknowns and solve for x:

Thus, the solution of the system of equations is:

We have solved the system of equations by transforming the augmented matrix into a matrix in echelon form. However, there are authors who prefer to continue applying row operations until the matrix is in reduced row echelon form (zeros above and below the main diagonal), in this case, the process is called Gauss-Jordan elimination.