Solving System of Linear Equations
Solving System of Linear Equations
A system of linear equations consists of two or more linear equations made up of two or more
variables, such that all equations in the system are considered simultaneously. To find the unique
solution to a system of linear equations, we must find a numerical value for each variable in the
system that will satisfy all of the system’s equations at the same time. Some linear systems may
not have a solution, while others may have an infinite number of solutions. In order for a linear
system to have a unique solution, there must be at least as many equations as there are variables.
Even so, this does not guarantee a unique solution.
Example: Here are two linear equations:
2x + y = 5
−x + y = 2
Together they are a system of linear equations.
Can you discover the values of x and y yourself? (Just have a go, play with them a bit.)
system of linear equations: A set of two or more equations made up of two or more variables
that are considered simultaneously.
dependent system: A system of linear equations in which the two equations represent the same
line; there are an infinite number of solutions to a dependent system.
inconsistent system: A system of linear equations with no common solution because they
represent parallel lines, which have no point or line in common.
independent system: A system of linear equations with exactly one solution pair (x,y)
Each of the requirements of a reduced row-echelon matrix can satisfied using the elementary row
operations.
5+ 4−1=0
[ 0 10−3=11
0 0 1=3 ]
It's fairly easy to see how to proceed in this case. I'll just back-substitute the z-value from the
third equation into the second equation, solve the result for y, and then plug z and y into the first
equation and solve the result for x.
10y – 3(3) = 11
10y – 9 = 11
10y = 20
y=2
5x + 4(2) – (3) = 0
5x + 8 – 3 = 0
5x + 5 = 0
5x = –5
x = –1
The reason this system was easy to solve is that the system was "triangular"; this refers to the
equations having the form of a triangle, because of the lower equations containing only the later
variables. system of equations with "triangle" of terms highlighted
Now, adding −1 times the first row to the second row yields zeros below the first entry in the
first column:
Interchanging the second and third rows then gives the desired upper‐triangular coefficient
matrix:
The third row now says z = 4. Back‐substituting this value into the second row gives y = 1, and
back‐substitution of both these values into the first row yields x = −2. The solution of this system
is therefore (x, y, z) = (−2, 1, 4).
The objective of pivoting is to make an element above or below a leading one into a zero.
The "pivot" or "pivot element" is an element on the left hand side of a matrix that you want the
elements above and below to be zero.
Normally, this element is a one. If you can find a book that mentions pivoting, they will usually
tell you that you must pivot on a one. If you restrict yourself to the three elementary row
operations, then this is a true statement.
However, if you are willing to combine the second and third elementary row operations, you
come up with another row operation (not elementary, but still valid).
You can multiply a row by a non-zero constant and add it to a non-zero multiple of
another row, replacing that row.
So what? If you are required to pivot on a one, then you must sometimes use the second
elementary row operation and divide a row through by the leading element to make it into a one.
Division leads to fractions. While fractions are your friends, you're less likely to make a mistake
if you don't use them.
What's the catch? If you don't pivot on a one, you are likely to encounter larger numbers. Most
people are willing to work with the larger numbers to avoid the fractions.
Pivoting works because a common multiple (not necessarily the least common multiple) of two
numbers can always be found by multiplying the two numbers together. Let's take the example
we had before, and clear the first column.
x y z rh
s
3 2 - 3
4
2 3 3 15
5 - 1 14
3
Helpful Hints
Although you do not have to pivot on a one, it is highly desirable. Pivoting on a one
means that you're multiplying by 1 (which is easy to do).
It is nice to pivot on the main diagonal, but not absolutely necessary. Some people like to
start in the upper left and work their way down to the lower right.
As long as you pivot only once per row and column, the columns which have been
cleared will remain cleared.
Since the point of pivoting is to clear the pivot column, picking a column which already
has zeros in it saves time because you don't have to change the row that contains the zero.
Selecting a Pivot
Since there is no one in the first row, we have two options: Either we divide the first row by
three and work with fractions, or we pivot on the three and get large numbers. That is the option
I'm going to use. I'll pivot on the three in R1C1. Go ahead and circle that as the pivot element.
Depending on your browser, you may see the pivot elements circled in red or just with a * in
front of it.
x y z rh
s
*3 2 - 3
4
2 3 3 15
5 - 1 14
3
The idea is to make the boxed (yellow) numbers into zero. Using the combined row operation
(this is not an elementary operation), that could be done by 3R2 - 2R1 → R2 and 3R3 - 5R1 → R3.
The only row not being changed is the row containing the pivot element (the 3). The whole point
of the pivot process is to make the boxed values into zero. Go ahead and rewrite the pivot row
and clear (make zero) the pivot column.
x y z rh
s
*3 2 - 3
4
0
0
To replace the values in row 2, each new element is obtained by multiplying the element being
replaced in the second row by 3 and subtracting 2 times the element in the first row from the
same column as the element being replaced.
To perform the pivot, place one finger on the pivot (circled number), and one finger on the
element being replaced. Multiply these two numbers together. Now, place one finger on the
boxed number in the same row as the element you're replacing and the other finger in the pivot
row and the same column as the number your replacing. Multiply these two numbers together.
Take the product with the pivot and subtract the product without the pivot.
x y z rh
s
*3 2 - 3
4
2 3 3 15
5 - 1 14
3
To replace the 3 in R2C2, you would take 3(3) - 2(2) = 9 - 4 = 5.
To replace the 3 in R2C3, you would take 3(3) - 2(-4) = 9 +8 = 17.
To replace the 15 in R2C4, you would take 3(15) - 2(3) = 45 - 6 = 39.
To replace the -3 in R3C2, you would take 3(-3) - 5(2) = -9 - 10 = -19.
To replace the 1 in R3C3, you would take 3(1) - 5(-4) = 3 + 20 = 23
To replace the 14 in R3C4, you would take 3(14) - 5(3) = 42 - 15 = 27.
x y z rhs
pivot row, copy pivot row, pivot row, pivot row,
3 copy copy copy
2 -4 3
pivot column, 3(3) - 2(2) 3(3) - 2(-4) 3(15) - 2(3)
clear 5 17 39
0
pivot column, 3(-3) - 5(2) 3(1) - 5(-4) 3(14) - 5(3)
clear -19 23 27
0
Or, if you remove the comments, the matrix after the first pivot looks like this.
x y z rh
s
3 2 -4 3
0 5 17 39
0 - 23 27
19
It is now time to repeat the entire process. We go through and pick another place to pivot. We
would like it to be on the main diagonal, a one, or have zeros in the column. Unfortunately, we
can't have any of those. But since we have to multiply all the other numbers by the pivot, we
want it to be small, so we'll pivot on the 5 in R2C2 and clear out the 2 and -19.
x y z rh
s
3 2 -4 3
0 *5 17 39
0 - 23 27
19
Begin by copying down the pivot row (2nd row) and clearing the pivot column (2nd column).
Previously cleared columns will remain cleared.
x y z rh
s
0
0 *5 17 39
0 0
Here are the calculations to find the next interation. Pay careful attention to the 3rd row where
we're subtracting -19 times a value. Since we're subtracting a negative, I went ahead and wrote it
as plus 19.
x y z rhs
5(3) - 2(0) pivot column, 5(-4) - 2(17) 5(3) - 2(39)
15 clear -54 -63
0
pivot row, copy pivot row, copy pivot row, pivot row,
0 5 copy copy
17 39
previously pivot column, 5(23) + 19(17) 5(27) + 19(39)
cleared clear 438 876
0 0
x y z rhs
15 0 -54 -63
0 5 17 39
0 0 438 876
Notice that all the elements in the first row are multiples of 3 and all the elements in the last row
are multiples of 438. We'll divide to reduce the rows.
x y z rh
s
5 0 - -21
18
0 5 17 39
0 0 1 2
That had the added benefit of giving us a 1, exactly where we want it to be to pivot. So, we'll
pivot on the 1 in R3C3 and clear out the -18 and 17. Circle your pivot and box the other numbers
in that column to clear.
x y z rh
s
5 0 - -21
18
0 5 17 39
0 0 *1 2
Copy down the pivot row and clear the pivot column. Previously cleared columns will remain
cleared as long as you don't pivot in a row or column twice.
x y z rh
s
0 0
0 0
0 0 *1 2
Notice that each time, there are fewer calculations to perform. Here are the calculations for this
pivot. Again, since the value in the pivot column in the first row is -18 and we're subtracting, I
wrote it as + 18.
x y z rhs
1(5) +18(0) previously pivot column, 1(-21) + 18(2)
5 cleared clear 15
0 0
previously 1(5) - 17(0) pivot column, 1(39) - 17(2)
cleared 5 clear 5
0 0
pivot row, copy pivot row, copy pivot row, copy pivot row,
0 0 1 copy
2
x y z rh
s
5 0 0 15
0 5 0 5
0 0 1 2
Notice that the first and second rows are multiples of 5, so we can reduce those rows.
x y z rh
s
1 0 0 3
0 1 0 1
0 0 1 2
And the final answer is x = 3, y = 1, and z = 2. You can also write that as an ordered triplet
{(3,1,2)}.