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 [Maple Math] or just [Maple Math] if the size is understood from the context. We just made a Maple procedure to quickly enter it.

> MM:=augment(M,eye(3));

[Maple Math]

> MM1:=swaprow(MM,1,2);

[Maple Math]

> MM2:=addrow(MM1,1,3,-2);

[Maple Math]

> T:=submatrix(MM2,1..3,5..7);

[Maple Math]

Thus [Maple Math] is the desired matrix which should take us from the initial [Maple Math] to the final [Maple Math] . We just check it!

> checkit:=evalm(T&*MM);

[Maple Math]

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 ( [Maple Math] ) and clean under it.

> MM3:=addrow(MM2,2,3,-3);

[Maple Math]

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);

[Maple Math]

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);

[Maple Math]

> MM5:=addrow(MM4,3,1,3);

[Maple Math]

> MM6:=addrow(MM5,2,1,1);

[Maple Math]

It seems convenient to multiply the last equation by [Maple Math] . 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);

[Maple Math]

>

The visible solution is that the values of the variables in order are [Maple Math] .

You should verify that the backsubstitution method yields the same answer.