Using elementary operations for solving equations
If we wish to perform a sequence of elementary operations then it amounts to multiplying by a series of matrices
on the left
. We can easily keep track of all these by tacking on an identity matrix and performing the operations on it as well. the resulting operations are then properly combined and the result is stored where the identity matrix is originally placed.
This is illustrated below.
Example (continued):
Note that
eye(3)
stands for
or just
if the size is understood from the context. We just made a Maple procedure to quickly enter it.
> MM:=augment(M,eye(3));
> MM1:=swaprow(MM,1,2);
> MM2:=addrow(MM1,1,3,-2);
> T:=submatrix(MM2,1..3,5..7);
Thus
is the desired matrix which should take us from the initial
to the final
. We just check it!
> checkit:=evalm(T&*MM);
Full work: We now finish the work on the above system to illustrate this method of solution. We continue with MM2 .
First pick a new pivot in position (
)
and clean under it.
> MM3:=addrow(MM2,2,3,-3);
The equations are now in an essentially solved form, the matrix being in an upper triangular shape. Note that the simple Maple command gausselim(M) would give the same answer, without the extra information about steps.
> gausselim(M);
The end game: You can either solve these simplified equations by back-substitution or continue to work with them by further row transformations done from bottom to top.
We illustrate the second method.
> MM4:=addrow(MM3,3,2,2);
> MM5:=addrow(MM4,3,1,3);
> MM6:=addrow(MM5,2,1,1);
It seems convenient to multiply the last equation by
. We use our own function
multrow
for this purpose.
Note that this operation was performed earlier in our previous work. The point is that it can be done at any time and is optional! It is only a matter of what organization you prefer.
> MM7:=multrow(MM6,3,-1);
>
The visible solution is that the values of the variables in order are
.
You should verify that the backsubstitution method yields the same answer.