# Solving Systems of Equations by Matrix Method

Matrix Method for solving systems of equations is also known as Row Echelon Method. The matrix method is similar to the method of Elimination as but is a lot cleaner than the elimination method.

Solving systems of equations by Matrix Method involves expressing the system of equations in form of a matrix and then reducing that matrix into what is known as Row Echelon Form.

Below are two examples of matrices in Row Echelon Form

The first is a **2 x 2** matrix in Row Echelon form and the latter is a **3 x 3**
matrix in Row Echelon form.

## Expressing Systems of Equations as Matrices

Given the following system of equations:

The above two variable system of equations can be expressed as a matrix system as follows

If we solve the above using the rules of matrix multiplication, we should end up with the system of equations that we started with. We can further modify the above matrices and hide the matrix containing the variables. We don't eliminate it but we just hide it so that we can make our computations cleaner.

The above is further modified into a single matrix as below

Often times a vertical line is drawn to indicate that the right most column represents the entries to the right of the equals sign in the system of equations.

The same can be done for a system of equations with three variables.

The above can be expressed as a product of matrices in the form:

Hiding the matrix containing the variables, we can express the above as:

Then putting it all in one matrix:

or as

The above form is referred to as an **Augmented matrix**. In Augmented matrix
above, we know that the entries to the left represent the coefficients to the variables
in the system of equations.

## Method of Reduction to Row Echelon Form

Before reading through this section, you should take a look at the Reduction to Echelon Form section under the Matrices section.

Now that you know how to reduce a matrix to Row Echelon Form, let's see how to apply the algorithm to the Augmented Matrices formed from systems of Equations.

**Example 1:**

Find the solution to the following system of equations

**Solution:**

The first step is to express the above system of equations as an augmented matrix.

Next we label the rows:

Now we start actually reducing the matrix to row echelon form. First we change the leading coefficient of the first row to 1.

We achieve this by multiplying R_{1} by ^{-1}⁄_{3}:

Next we change the coefficient in the second row that lies below the leading coefficient
in first row. This is achieved by multiplying the **R _{2}** by

^{-1}⁄

_{5}and then adding the result to R

_{1}.

Adding the result to **R' _{1}**:

So now our new matrix looks like this:

At this point, we re-introduce the variables into row 2 since we'll now have a one variable equation:

We can solve for **y** from the equation above:

Now that we have **y**, we can use back substitution to solve for **x** by
substituting for y in the two variable equation formed from **R' _{1}**:

Therefore the solution to the system of equations is **{x,y} = {2,-2}**

**Example 2:**

Solve for x, y and z in the system of equations below

**Solution:**

The first step is to turn three variable system of equations into a 3x4 Augmented matrix.

Next we label the rows of the matrix:

Since in the above augmented matrix we can't find any rows with one as the leading coefficient, we don't need to perform a row switching operation. However, we do need to modify row 1 such that its leading coefficient is 1.

We can achieve this by multiplying row 1 by ^{1}⁄_{3}:

Next we need to change all the entries below the leading coefficient of the first row to zeros.

For the second row, we can achieve this by first multiplying through by^{-1}⁄_{3}
and then adding the result to row 1.

Adding the result to row 1:

We then move on to row 3; here we multiply the row by ^{-1}⁄_{5}
and then add the result to row 1 in order to zero out the first element.

Adding the result to row 1:

We need the leading element in the second row to also be one. We obtain this result
by multiplying the second row by ^{-3}⁄_{2}:

Next we zero out the element in row three beneath the leading coefficient in row
two. To achieve this, we multiply the third row by^{5}⁄_{4}

Adding the result to row 2:

Finally we multiply row 3 by -12 in order to have the leading element of the third row as one:

From the above matrix, we solve for the variables starting with **z** in the
last row

Next we solve for y by substituting for z in the equation formed by the second row:

Finally we solve for x by substituting the values of y and z in the equation formed by the first row:

Therefore, the solution to the system of equations is **{x,y,z} = {1,-2,1}**