## 2.2 Using Matrices to Solve Systems of Equations

### Part B: Solving a System by Pivoting ("Gauss-Jordan")

(Based on Section 2.2 in Finite Mathematics and Finite Mathematics and Applied Calculus)

Some On-line Resources for This Topic:

Solution of Systems of Equations by Row Operations
(The discussion here is based on Section 2.2 of Finite Math and Finite Mathematics and Calculus Applied to the Real World. )

Here, we put row operations to work for us in solving systems of equations. (If you are not familiar with row operations, go to Part A of this tutorial by pressing "Prev Tutorial" on the sidebar.) First of all, let's start with a complicated looking system of equations, such as

 x2 + 2y3 = 16 -2x + y4 = 12

This system has the following augmented matrix.

 12 23 16 -2 14 12

We shall now reduce the matrix with our bare hands in a few simple steps by performing row operations to obtain a new matrix that will instantly tell us the solution of the system.

First Step: Clear all fractions and/or decimals (if any) by multiplying rows that contain them by a suitable number.

To clear the fractions, we multiply the first row by 6 and the second row by 4 as follows.

 12 23 16 6 R1 -2 14 12 4 R2
 3 4 1 -8 1 2

Now it's your turn to try Step 1. You must enter the row instructions, and also perform the associated row opearations! (For example, to enter the instruction that multiplies Row 1 by 2, type "2R1". To leave a row alone, leave the instruction blank..)

 12 -14 0 1 0.1 3 0 -1 4 13 12 1

Second Step: Designate the first non-zero entry in the first row as the pivot.

This gives the 3 as the pivot:

 first row 3 4 1 -8 1 2

Third Step: Use the pivot to clear its column using operations of type 3. By clearing a column, or pivoting,we mean winding up with a matrix in which the pivot is the only non-zero number in its column. This the goal is to end up with the -8 "cleared away:"

Goal:
cleared pivot column

 3 4 1 0 * *

The asterisks stand for whatever numbers come out of the calculation. We must accomplish that by replacing Row 2 using an operation of the third type listed above. Here, we do the following:

 3 4 1 -8 1 2 3 R2 + 8 R1
 3 4 1 0 35 14

Q Wait a minute! Just how did you come up with that row operation?
A Press here to open a pop-up window showing a method that always works, and requires little or no thought!

Q What about a bigger matrix?
A Here is an example of Steps 2 and 3 using a larger matrix:

Second Step Again: Designate the first non-zero entry in the first row as the pivot.

 1 1 5 6 3 3 1 10 1 3 2 5 .

Third Step Again: Use the pivot to clear its column using operations of type 3.

 1 1 5 6 3 3 1 10 R23 R1 1 3 2 5 R3R1
 1 1 5 6 0 6 16 28 0 4 3 11

Note All the row operations we use to pivot have the following form:

a Rc + b Rp

Here, a and b are always positive numbers.
Rc is the row you are changing. This is also the row next to which the instruction is written.
Rp is the pivot row -- the row containing the pivot.
Note that the only place a minus sign ever appears is between Rc and Rp.

Now it's your turn to try Steps 2 and 3. As before, you must enter the row instructions, and also perform the associated row opearations! For example, to enter the instruction that replaces Row 2 by 2R2-3R1, type "2R2-3R1" next to the row you want to change (Row 2). To leave a row alone, leave the instruction blank..

 2 -1 0 4 1 3 0 -1 -3 2 3 1

The next step is one that can be performed at any time.

Simplification Step: If at any stage of the process, all the numbers in a row are multiples of an integer, divide by that integer -- a type 2 operation.

Below, for example, we notice that the entries in Row 2 are divisible by 7, so we divide that row by 7.

 3 4 1 0 35 14 17 R2
 3 4 1 0 5 2

Fourth Step: Select the first non-zero number in the next row (Row 2) as pivot, and go to the Third Step.

This is a two-step process: First select a pivot on the second row. Next, perform the pivoting operation; that is, clear the pivot column (the pivot column is now the second column).

Goal:
clear the pivot column

 3 4 1 5 R1-4 R2 0 5 2
 15 0 -3 0 5 2

Q So how did you come up with that row operation?
A Press here to find out!

Q Can we see how the above steps work with a bigger matrix?
A Ok. Recall that we did the follwing operations on a larger matrix.

 1 1 5 6 3 3 1 10 R23 R1 1 3 2 5 R3R1
 1 1 5 6 0 6 16 28 0 4 3 11

We can now continue with Step 4 and use optional simplification steps along the way

Simplification Step: If at any stage of the process, all the numbers in a row are multiples of an integer, divide by that integer -- a type 2 operation.

 1 1 5 6 0 6 16 28 12 R2 0 4 3 11
 1 1 5 6 0 3 8 14 0 4 3 11

Fourth Step: Select the first non-zero entry in the next row as pivot, and go to Step 3.

 1 1 5 6 3 R1 + R2 0 3 8 14 0 4 3 11 3 R34 R2
 3 0 7 4 0 3 8 14 0 0 23 23

Simplification Step:

 3 0 7 4 0 3 8 14 0 0 23 23 123 R3
 3 0 7 4 0 3 8 14 0 0 1 1

Step 4:

 3 0 7 4 R17 R3 0 3 8 14 R2 + 8 R3 0 0 1 1
 3 0 0 3 0 3 0 6 0 0 1 1

At this point, we have run out of rows (there is no next row to go to) so we are done with the pivoting.

We have one last step:

Final Step: Turn all the pivots into 1's by dividing each of the rows by the value of its pivot.

23 matrix:  15 0 -3 115 R1 0 5 2 15 R2
 1 0 - 15 0 1 25
34 matrix:  3 0 0 3 0 3 0 6 0 0 1 1

 13 R1 13 R2
 1 0 0 1 0 1 0 2 0 0 1 1

And we're done! Look at the 23 matrix first: The first row now corresponds to the equation

 1(x) + 0(y) = - 15 or x = - 15

The second row corresponds to

 0(x) + 1(y) = 25 or y = 25
So we have solved for x and y!

Similarly, the 34 matrix

 1 0 0 1 0 1 0 2 0 0 1 1

tells us that

x = 1, y = 2, z = -1, or (x, y, z) = (1, 2, -1).

You can review the whole process from start to finish by pressing here for the 23 matrix or here for the 34 matrix

Press the "Chapter Summary" button on the sidebar for a convenient summary of this procedure and also other material.

Consider the following system.

 x2 - 5y2 = 1 3x5 + y = 1

Q Which of the following corresponds to the augmented matrix after fractions are cleared?

 1 -5 2 3 5 5
 1 -5 1 3 1 1
 5 -5 1 6 2 1

Q The instruction required to perform the first pivot operation is:

 -R2 + 3 R1, written next to Row 2 3 R2-R1, written next to Row 2 R2-3 R1, written next to Row 1 R2-3 R1, written next to Row 2

Q The result of the above pivot operation is

 1 -5 2 0 -10 -1
 1 -5 2 0 20 -1
 1 -5 2 0 -20 1
 0 20 -1 3 5 5

Q The instruction required to perform the next pivot operation is:

 4 R1- R2, written next to Row 1 4 R1 + R2, written next to Row 1 20 R1 + 5 R2, written next to Row 1

Q The result of the above pivot operation is

 1 0 7 0 20 -1
 1 15 1 0 20 -1
 20 0 35 0 20 -1
 4 0 7 0 20 -1

Q The solution of the original system of equations is

 x = 7 ,  y = -1 x = 47 ,  y = -20 x = 74 ,  y = - 120 x = -14 ,  y = 720

Note Sometimes, things don't work out so smoothly. For instance, you might wind up with a row of zeros, or a row like this: [0   0   9]. Just how to deal with this is discussed in the next tutorial.

Here is one with four unknowns.

Consider the following sustem of equtions

 0.1x + 0.1y + 0.4w = 0 2x 12 z = 2 y - z + w = 12 z + 2w = 1

The result of clearing fractions and decimals, and then performing the first pivot operation is:
 1 1 0 4 0 0 -4 1 -16 4 0 2 -2 2 1 0 0 1 2 1
 1 1 0 4 0 0 -2 1 -8 2 0 1 -1 1 1 0 0 1 2 1
 1 1 0 4 0 0 4 1 16 4 0 2 -2 2 1 0 0 1 2 1

Q The result of the next pivot operation (followed by a simplification step) is:
 4 0 1 0 4 0 -4 1 -16 4 0 0 -1 -4 2 0 0 1 2 1
 4 0 1 0 4 0 1 - 14 4 -1 0 0 -1 -4 2 0 0 1 2 1
 1 0 1 0 4 0 -4 1 -16 4 0 0 -1 -4 2 0 0 1 2 1

Q The result of the next two pivoting steps (including some simplification steps) is:
 1 0 0 0 3 0 -1 0 0 -6 0 0 -1 0 -4 0 0 0 -2 3
 1 0 0 0 0 0 -1 0 0 -6 0 0 -1 0 -4 0 0 0 -2 3
 1 0 0 0 4 0 -1 0 0 4 0 0 -1 0 2 0 0 0 2 1

Q The solution of the system is:

 no solution (1, 6, 4, -3/2) (0, 6, 4, -2/3) (0, 6, 4, -3/2)

Tired of tutorials for now? Try some of the exercises in Section 2.2 of Finite Math, or Finite Mathematics and Calculus Applied to the Real World and then go on to the next tutorial to help answer unresolved questions.

Last Updated: March, 2006