Linear Algebra Powertool
Solving a system by Gaussian Elimination
Worksheet by Russell Blyth
Start linear algebra computations by loading the linalg package:
> with(linalg);
Warning, the protected names norm and trace have been redefined and unprotected
Enter the augmented matrix of the system.
> A:=matrix([[-1,1,-1,-8],[1,1,1,0],[2,4,8,-2]]);
Let's switch the first two rows to get a 1 as the (1,1) entry (we could also multiply row 1 by -1).
> B:=swaprow(A,1,2);
Now add suitable multiples of the first row to each of the second and third rows. Note that a colon instead of a semicolon suppresses printing the result of a command, which allows for multiple commands on one input line. Using the colon in the command with(linalg) would suppress the list of commands in the linalg package.
> B:=addrow(B,1,2,1): B:=addrow(B,1,3,-2);
Multiply row 2 by 1/2 to get a leading 1 in row 2 (note Maple does rational arithmetic exactly).
> B:=mulrow(B,2,1/2);
Add a suitable multiple of row 2 to row 3 to clear out the (3,2) entry.
> B:=addrow(B,2,3,-2);
> B:=mulrow(B,3,1/6);
Now solve the system using backsubstitution.
Maple will automate the process of row reducing even further:
> gausselim(A);
Note that gausselim does not produce leading 1's
> gaussjord(A);
The same result is given by rref (= reduced row echelon form)
> rref(A);
>
>