MATLAB Tutor
Part 11: Row Operations
on Matrices
In the last step of Part 10 of this
Tutorial, we tried to solve the linear system of equations
x + 4y + 3z = 10
2x + y – z = -1
3x – y – 4z = 11
We found that the system had no solutions. In this part, we want to investigate
why not. We will use matrix row operations to find out.
- First we need to save the coefficients
of the system in a matrix, and the right-hand side vector in another matrix, and
then form the matrix of the augmented system.
Enter
A = [1 4 3
2 1 -1
3 -1 -4]
b = [10; -1; 11]
M = [A, b]
%Augmented matrix
The augmented matrix is an
equivalent representation of the system of equations. When we multiply
an equation by a constant and add it to another equation, then the solution set
of the new system is the same as the old. This is what we are doing when we use
row operations on the augmented matrix.
We multiply a row of the augmented matrix by a constant and add
it to another row to get a simpler matrix. The solution set of the simplified
system corresponding to the new augmented matrix is the same as the old. In the
steps below, we will row reduce the augmented matrix to a very simple form, step
by step. Later we will see that it can all be done with a single command.
- First we will try to get all
zeros in the first column beneath the 1 in the first row. To do that, we multiply
the first row by -2 and add it to the second row. Then, we multiply the first row
by -3 and add it to the third row. Recall that the ith row is just M(i, :)
in MATLAB. Enter
M(2, :) = -2*M(1, :) + M(2, :)
M(3, :) = -3*M(1, :) + M(3, :)
- Now, we need to get a 1 into
the (2,2) element of the new augmented matrix. We can do that by multipling the
second row by (-1/7). Enter
M(2, :) = (-1/7)*M(2, :)
- Add multiples of the second
row to the first and third rows to "zero out" the second column, except for the 1 in
the (2,2) position.
- Normally, the next step would be
to divide the third row by a constant to get a 1 in the (3,3) position and then
add multiples of the third row to the first two rows to get zeros above the 1
in the third column.
That procedure will not work for this augmented matrix. Do you see now why the
corresponding linear system has no solution?
- The row reduction we have just
accomplished can be done with a single MATLAB command, "rref", which stands for
row-reduced echelon form. Enter
M = [A, b]
rref(M)
Note that this reduction goes a step futher than ours. If we had divided our row
three by 20 and used the resulting 1 in the (3,4) place to eliminate the ones in
the fourth column above it, then we would have obtained the "rref" result.
- If a linear system has a solution,
it is easy to just read it off from the row-reduced echelon form. Form the augmented
matrix and use rref to solve each of the following systems from Part 10 of this
Tutorial:
-
x - 2y + z
= 0
2y
- 8z = 8
-4x + 5y + 9z = -9
-
x - 2y +
z + 2w
= 0
2y
- 8z + w = 8
-4x + 5y + 9z - w = -9
|
CCP Home |
Materials | Linear Algebra | Module Contents | Back | Forward |