Activity 3

advertisement
Math 438 ACTIVITY 3:
WHY:
Working with row operations: Elementary matrices, MAPLE
This activity introduces the concept of elementary row matrix and illustrates how these matrices can be used to
represent the Gauss-Jordan reduction process. Row reduction techniques will be used throughout the first half of the
course when we are studying linear programming and its prerequisites. Using technology for repetitive matrix
operations removes many of the sources of error common in pencil and paper work.
LEARNING OBJECTIVES:
1.
2.
3.
Discover the role of elementary matrices in row reduction.
Discover the relationship between elementary matrices and the inverse of a matrix.
Provide an opportunity to experience cooperative group learning using a computer algebra system.
CRITERIA:
1.
2.
3.
Depth of insight into how Gauss-Jordan elimination can be done using matrix multiplication of elementary matrices.
Success in carrying out the Maple exercise on elementary matrices and Gauss-Jordan elimination.
Quality of group role performance and understanding of what is expected in a learning exercise.
RESOURCES:
1.
2.
3.
4.
Chapter 0, Strategic Mathematics
MAPLE and the help system
The file Activity3.mw on the Public server (the p:-drive - file is Public/Courses/Math/Math438/Activity3.mw)
40 minutes
PLAN:
1.
2.
3.
Assess the team's understanding of the terms listed in the information section.
Execute the model Activity2.txt as described below. Have the recorder write down what happened at each step and any
discoveries the team made as the model was executed.
Use the model to answer the critical thinking questions.
INFORMATION:
Elementary Matrix
A matrix formed by applying an elementary row operation to an Identity matrix. Examples:
0 1 0 [from swapping
2 0 0 [from multiplying row 1 by 2)
1 0 0 (from adding 3 times row 3 to row 2)
1 0 0 R1 & R2]
0 1 0
[for 2R1-> R1]
0 1 3 target row [for R2+3R3->R2]
0 0 1
0 0 1
0 0 1 pivot row
We care because: Elementary matrices encode information on row operations. Each row operation can be carried out by
multiplying our matrix from the left by the corresponding elementary matrix - a process that allows us to keep a record (by
keeping track of the matrices) of the row operations. Rather than working with the augmented matrix in Gauss-Jordan
elimination, we could keep track of the row operations (in the coefficient matrix) and calculate one matrix for all the changes
(by multiplying the elementary matrices) and then apply all the changes at once to the constant column. This idea will be very
important in understanding our solution of Linear Programming problems.
If we carry out row operations to reduce an mxn (not necessarily square) matrix to row-echelon form, the corresponding
product of elementary matrices [Ek… E2 E1 - notice the order the first matrix is at the right]] gives a matrix M which could
be multiplied by the original matrix to reduce it to row-echelon form in one step. If the coefficient matrix is a square,
nonsingular matrix, this matrix M is, of course, the inverse of the coefficient matrix (because the row-echelon form of a
square nonsingular matrix is an identity matrix)
Inverse of a matrix
The nxn matrix C is the inverse of the nxn matrix D if CD is the (nxn) identity matrix. [Only square matrices can possibly
have inverses - the ones that actually do have inverses are called nonsingular matrics]
Math 438 Activity 3 p. 2
Vector form of a system of equations
If the coefficient matrix is A, we can represent the variables in a (column) vector X and the right-side values of the
equations by a (column) vector b and write the system as AX = b. If A has an inverse B (A has to be square and
nonsingular) then we can solkve this by multiplying both sides by B to get I = BA = Bb - from which we can read the
solution (which is unique, in this situation)
MAPLE INFORMATION
Maple commands follow the prompt >
Each command ends with a smicolon(;) if results are to be displayed or a colon (:) if not
Any text on a line following a # is considered a comment and is ignored by the program (multi-line comments require a # at
the start of each line)
To execute a command, put the cursor anywhere on its line and press Enter (but if you skip around, remember that matrices,
variables, etc. keep the values form the last command that you executed - not necessarily the line above on the page)
When a command is executed, the new values of variables, etc. replace the old values (as in a calculator). If you execute a
command that does something you didn’t want, you will usually need to change it and go back to the beginning of your
commands, then press “enter” repeatedly to get back to where you were.
A command may be edited by usual methods, copied, pasted, etc.
If a command is copied and moved, the old results remain in their old place (until the new command is executed)
Some commands used in this exercise:
with(linalg): loads the linear algebra commands package into Maple
A:=matrix([[row1],[row2 ],[row3]]); defines matrix A - We will use various names) as the matrix with first row [row1]
(enter with commas - note square brackets for a vector or matrix - the parentheses are for the matrix function), second row
[row2], etc. - continue for as many rows as you need - all the same length, of course
b:=vector([list]); defines b as a vector with entries [list]
M:=augment(A,b); defines matrix M as a matrix with first columns from matrix A, last column from vector b
E:=diag(1,1,1); defines E as a diagonal matrix (3x3 here - three entries) with 1's on the main diagonal, 0's elsewhere (could
use numbers other than 1's, don't all have to be the same)
EL:=addrow(A,r1,r2,c); Makes a matrix EL from a matrix A, using row r1 to change row r2 by adding c times r1
A_INV:=multiply(A,B); makes matrix A_INV the product AxB of matrices A & B (order matters)
EL:=mulrow(A,r,c); makes EL the matrix obtained from A by multiplying row r by the value c
EL:=swaprow(A,r1,r2); makes EL the matrix obtained from A by swapping rows r1 and r2
Model:
This model shows the steps for using Maple to carry out Gauss-Jordan elimination and find the inverse of a square matrix
using elementary row operations and elementary matrices. The commands for beginning the process are in a Maple text file,
with comments on the meaning of the steps shown.
The system to be solved in this model is:
x + 2y - 3z = 4
2x + 6y - 8z = 6
3x + 4y - 4z = 8
Launch the Maple program (from the Start menu) and open the file Activity3.mw (on the p: drive in courses/Math/Math438)
Step through the commands in the workspace (executing each line) - observe what happens at each step After the commands already typed, continue, using the commands above (use copy/paste to avoid a lot of retyping), to
convert AUG to row-echelon form and convert A_INV to the inverse of the coefficient matrix A. [In this case, you do get a
true inverse matrix - the system has a unique solution. In general, you would get a "reduction" matrix - multiplying this
reduction matrix by the original would give the row-echelon form]
Exercises
1.
On paper, set up the augmented matrix for this system of equations. Use MAPLE to solve by reducing the augmented matrix
to row-echelon form. Write down the elementary matrix for each step - everyone should keep a copy of these.
4x  4y  2z  8
x  2y
 0
3x  y  z
 7
Math 438 Activity 3 p. 3
2.
Consider the following system of equations and the matrix equation as shown
3 5x  4
3x  5y  4

    
4x  7y  5
4 7y  5
What happens if we multiply both sides of the matrix equation (must multiply with D on the left on both sides of the equation)
 7 5
by the matrix D  
 ?
4 3 
Why? Can you find the solution to the system immediately from what you have just done?
3.
As with #2, but this time for the non-square system
x  2y  z  3s  4t
2x  4y  2z  5s  5t
3x  6y  2z  4s  2t
x
1 2 1 3 4y
 0


 0 whose matrix form is 2 4 2 5 5z
3 6 2 4 2 s
 5



t



 




0
 
0
5
 
3.6 2 .2


and matrix D =  1.4 1 .2 [Notice that D couldn’t be multiplied on the right on either side of the equationn]
 2
1 0 


x  1
2 4
   
   
y  0
 1   0 
[Note that the general solution of this system is z   1  y  0   t  1 ]
   
   
s  0
 0   3 
   
   
t  0
 0   1 
Critical Thinking:
1.
2.
3.
There are two orders in which you could multiply the elementary matrices (E1xE2xE3... or ...E3xE2xE1) you obtained in
exercise 1 - which is the correct order for obtaining a matrix D that is the inverse of the coefficient matrix A - or doesn't it
matter? Why?
Which is easier - solving a system by hand or using MAPLE? Would the size (number of variables, number of equations) of
the problem afffect your response?
Maple has a "pivot" (A:= pivot(matrix, row position, column position); )command that can be used to carry out the row
reduction (step by step) without calculating the elementary matrices or the inverse (or reduction) matrix. What would be lost
and what would be gained by using this command instead of carrying out the mulrow and addrow steps?
Download