Math 22 Fall 2004
Linear Algebra with Applications
Class Demo for the Echelon Forms
September 27, 2004
Load the package for doing Linear Algebra
> | with(Student[LinearAlgebra]): |
Define a matrix (4 rows, 5 columns) to work with
> | M := <<0|-1|2|-3|4>,<2|-4|4|3|-10>,<3|-1|-4|0|-5>,<1|-2|2|-1|-3>>; |
Step 1: Choose column 1 as our pivot column.
We start by transforming it into an echelon form.
Step 2: Select any non-zero entry as a pivot and
bring it into the pivot position (to the top)
> | M := SwapRows(M, 1, 4); # Bring the pivot entry into the 1st row |
Step 3: Use the row replacement operations to create zeros in
all positions below the pivot.
> | M := AddRow(M, 2, 1, -2); # Make entry below the pivot in row 2 zero
M := AddRow(M, 3, 1, -3); # Make entry below the pivot in row 3 zero |
Step 4: Repeat Steps 1-3 for the next column
Pivot column is column 2 now. Bring it into an Echelon Form
> | M := SwapRows(M, 2, 4); # Bring the pivot in the 2nd column to the 2nd row |
> | M := AddRow(M, 3, 2, 5); # Make the entries below the pivot zero |
Column 3 is in the Echelon Form already. Go to column 4.
> | M := MultiplyRow(M, 3, 1/12); # Scale the row 3 a bit to make our life easier |
> | M := AddRow(M, 4, 3, 5); # Make the entries in column 4 below the pivot zero |
The matrix is in the Echelon Form now
Step 5: Starting from the last column, make all the pivots 1
and all the entries above them zero.
> | M := MultiplyRow(M, 3, -1); # Make the pivot in the 4th column 1 |
> | M := AddRow(M, 2, 3, 3); # Make the entry above it in row 2 zero
M := AddRow(M, 1, 3, 1); # Make the entry above it in row 1 zero |
> | M := MultiplyRow(M, 2, -1); # Make the pivot in column 2 1 |
> | M := AddRow(M, 1, 2, 2); # Make the entry above the pivot zero |
The matrix is in the reduced Echelon Form now
Conclusion: the original linear system was inconsistent
Modify it: if there were no last row now, the system would be
> | M1 := LinearAlgebra[DeleteRow](M, 4); |
This linear system is consistent. It has 1 free variable, x[3],
and 3 basis variables, x[1], x[2], and x[4].
Here is the corresponding linear system:
> | EqSystem := GenerateEquations(M1, [x[1], x[2], x[3], x[4]]); |
Its general solution is
> | solve(convert(EqSystem, set)); |
The parametric description of the solution set is
> | LinearSolve(M1); |