4: Matrices 41: Organizing Data into Matrices A matrix is just a grid of numbers That's all However, matrices can be quite useful The size of a matrix is given as r c, where the matrix has r rows and c columns Below are two images of a 3 4 matrix Row 1 a b c d Row Row 3 e f g h i j k l Column Column 4 a b c d e f g h i j k l Column 1 Column 3 Sometimes, subscripts are used to identif the individual elements (cells) in a matrix Note that the first digit of the subscript is the row, and the second digit is the column a11 a1 a13 a14 A a1 a a3 a 4 a31 a3 a33 a 34 To refer to a matrix without listing its elements, an italicized capital roman letter is tpicall used (like the A in the example above) To refer to the elements of a matrix in general, a subscripted lowercase italicized roman letter (the same as the matrix) is used (like a 3 in the example above) 4: Adding and Subtracting Matrices Adding and Subtracting Matrices Unlike the real numbers, not all matrices can be added or subtracted In particular, onl matrices of the same size (same number of rows; same number of columns) can be added or subtracted To add two matrices, add elements in the same position in the two matrices (ie, The element in row i and column j of A+ B is aij + bij ) HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE 1 OF 10
Do exactl the same thing to subtract two matrices! Like the real numbers, addition of matrices is commutative the order of addition makes no difference Solving Matrix Equations If ou have an equation made up of matrices like X + A B and ou want to solve for matrix X, then what should ou do? Subtract matrix A, of course! X + A B X + A A B A X B A 0 4 1 [1] Add 7 0 3 + 3 1 0 4 0 4 1 0+ 1 4+ 1 6 7 0 3 7 0 3 + + + 3 1 0 4 3+ 0 1+ 4 3 5 1 6 6 [] Subtract 9 1 1 6 6 1 6 6 1 0 9 1 9 1 0 1 6 0 1 [3] Solve for X: X + 1 6 0 3 3 1 6 0 1 0 1 1 6 1 7 X + 1 X 1 10 1 6 0 3 3 3 3 6 0 3 3 43: Matrix Multiplication Scalar Multiplication A scalar is a regular number Scalar multiplication means multipling a scalar against a matrix To do this, simpl multipl each element of the matrix b the scalar HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE OF 10
Matrix Multiplication Matrix multiplication is one matrix times another However, not all matrices can be multiplied and just in case that wasn't fun enough, matrix multiplication is not commutative the order of the matrices matters! Two matrices can be multiplied if the number of columns in the left hand matrix equals the number of rows in the right hand matrix The resulting matrix will have the same number of rows as the left hand matrix and the same number of columns as the right hand matrix Left hand matrix Right hand matrix a b b c identical multiplication is possible the result will be a c The procedure for actuall multipling the matrices is involved basicall, ou will multipl ever element in a left hand row with ever (corresponding) element in a right hand column, then add For example: a11 a1 b11 b1 b13 a11b 11+ a1b1 a11b 1+ a1b a11b 13+ a1b3 a1 a b1 b b 3 a1b11 ab1 a1b1 ab a1b13 ab + + + 3 This will require some practice 1 6 6 0 1 6 1 1 6 6 0 1 0 [4] Multipl: ( ) ( ) 1 6 0 1 [5] Multipl: 1 Here's a wa to arrange the matrices to make multipling a little easier (it lines up the required rows and columns for each element of the answer): HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE 3 OF 10
0-1 -1 1 6???? The answer is ( )( ) + ( )( ) ( )( ) + ( )( ) ( )( ) ( )( ) ( )( ) ( )( ) 1 0 6 1 1 1 6 6 11 9 0 + 3 1 9 1 + 3 3 3 1 0 1 1 [6] Multipl 3 1 5 1 0 4 0 The arrangement I suggested above ma be of some help here! The answer: ( 1)( 1) + ( )( 3) + ( )( 4) ( 1)( 0) + ( )( 1) + ( )( ) ( 1)( 1) + ( )( 5) + ( )( 0) 3 6 9 ( 1)( 1) + ( 0)( 3) + ( )( 4) ( 1)( 0) + ( 0)( 1) + ( )( ) ( 1)( 1) + ( 0)( 5) + ( )( 0 ) 9 4 1 45: x Matrices, Determinants and Inverses The Identit and Inverses A matrix with an equal number of rows and columns is called a square matrix The real numbers have two identities additive (0) and multiplicative (1) Square matrices 0 0 have the same things The zero matrix is 0 0 0 Actuall, the smbol 0 is used regardless 0 0 0 of the size of the matrix, so this is also the zero matrix: 0 0 0 0 The zero matrix is the 0 0 0 additive identit adding it results in no change Also, adding a matrix with its opposite (negation) results in the zero matrix The identit matrix is a square matrix with 1's along the left-right diagonal (the main 1 0 diagonal), and zeros everwhere else The identit matrix is I 0 1 This is a multiplicative identit multipling b this matrix results in no change Also, due to its nature, it actuall doesn't matter which side ou multipl on when using the identit matrix The inverse of a matrix is another matrix that, when multiplied, results in the (multiplicative) 1 identit: the inverse of A is A 1 1, so that A A A A I In the real numbers, we call this the reciprocal however, that's the onl place that we'll use that term especiall since ever real number has an reciprocal, but not ever matrix has an inverse HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE 4 OF 10
Finding the inverse of a matrix requires that we learn about The Determinant This is a special number that describes a matrix Not ever matrix has one! a b Given a matrix A c d, the determinant of A is det( A) A ad bc If the determinant is non-zero, then the matrix has an inverse, and is called non-singular (if the determinant is zero, then the matrix is singular) a b 1 1 d b Given a non-singular matrix A c d, the inverse of the matrix is A A c a Solving Matrix Equations When last we solved matrix equations, we could onl handle matrices that were added or subtracted Now, we can handle multiplication! (there is no matrix division) Specificall, we can solve equations of the form AX B How can we get that A off of X and solve? Use the inverse! 1 1 1 1 AX B A AX A B IX A B X A B Of course, this will require that the inverse exists [7] Find 1 1 It is ( 1)( ) ( 1)( ) 0 [] Find the inverse of the matrix M First, the determinant: ( )( ) ( )( ) 1 1 1 1 1 1 + 1 3 Thus, 1 1 1 1 M 3 3 3 1 1 1 1 3 3 [9] Solve 6 4 x 14 6 1 HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE 5 OF 10
6 4 x 14 x 6 4 14 Isolate the variables: 6 1 6 1 I'll let m technolog find the 1 1 x 6 4 14 1 9 14 inverse for me 6 1 1 1 Finall, multipl: 3 3 1 x 1 9 14 1 1 1 Thus, the solution is x 1, 3 3 1 46: 3x3 Matrices, Determinants and Inverses The Determinant 1 0 0 First, note that the multiplicative identit is now I3 0 1 0 0 0 1 The determinant of a 3 3 matrix is a little more complicated that that of a There is a fine diagram on page 0 of the text that I'll not attempt to duplicate here Inverses You'll note that the book doesn't even attempt to show how to find the inverse of a 3 3 matrix b hand so neither will I (et) Just use our calculator of course, I'll be giving instructions on how to do this in class (unless ou actuall read the manual for our calculator ) Solving Matrix Equations is exactl the same [10] Find 1 5 1 3 0 6 1 M technolog tells me that this is 4 [11] Find 1 1 0 3 1 1 1 HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE 6 OF 10
Again, m technolog tells me that the answer is 4 1 3 1 1 1 1 1 3 1 x 1 [1] Solve 5 0 3 3 1 z 10 7 5 7 1 1 3 1 1 1 3 1 1 9 9 9 1 3 x x 4 1 1 5 0 3 5 0 3 3 9 9 9 3 3 1 z z 3 1 13 10 11 13 9 9 9 3 47: Inverse Matrices and Sstems Matrices can be used to solve sstems of equations ou just have to know how to translate from the equations into matrices First, write our equations in standard form This will make three matrices the coefficient matrix (A), the variable matrix (X), and the constant matrix (B) Use our previousl learned techniques (and our calculator) to solve x + z 3 [13] Solve x + z x + z 3 1 1 x 3 The three matrices are A 1 1, X and B 1 1 z 3 1 1 x 3 The matrix equation is 1 1 1 1 z 3 3 1 1 1 1 1 3 x 3 1 1 5 3 The solution is 1 1 z 1 1 3 3 3 1 3 5 HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE 7 OF 10
4: Augmented Matrices and Sstems Cramer's Rule Let's sa that we have a matrix equation AX B note that the size of A will be n n, and B will be n 1 There is another wa to solve for the n variables of the sstem! Let matrix D 1 be the same as matrix A, but replace the first column with the elements from matrix B Let matrix D be the same as A, but replace the second column with the elements from matrix B Keep this up until ou've created n of these matrices (up to D n ) D The solution for the first variable is 1 A ; the solution for the second variable is D ; and so A on, up to the solution for the n th variable D n A Gaussian Elimination There is another wa to use the elimination method one that removes all of the variables, and just manipulates the coefficients and constants The method is called Gaussian Elimination Start with a matrix equation, as before: AX B From this, we will create an augmented matrix b tacking matrix B on as an extra column in matrix A Tpicall, we draw a dashed vertical line after the last column of A and before matrix B There are three rules (operations) in this method 1 Switch an two rows Multipl a row b a constant 3 Add a multiple of an row into another row There are two possible goals of this method 1 Row Echelon Form: ones along the main diagonal, and zeros below (onl) Reduced Row Echelon Form: ones along the main diagonal, and zeros above and below In other words, where matrix A had been, there is now the identit matrix I When ou have row echelon form, then ou have solved for the final variable This can be plugged back in to find the value of the other variables However, when ou have reduced row echelon form, then ou have solved for all variables! The wa to work efficientl is to create a one in the upper left corner, then use that one to make zeros underneath Next, make a one in row two column Use that one to make zeros above and below Keep this up until ou're done If ou end up with a row of all zeros, then there are an infinite number of solutions to the sstem If ou end up with a row that contains all zeros except for the last column, then there is no solution to the sstem There is an extension to this, called Gauss-Jordan Elimination In this method, augment matrix A with the identit I Now use the row operations to achieve reduced row echelon form Where matrix I had been, there is now 1 A! [14] Convert this to reduced row echelon form: 1 3 1 1 1 3 HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE OF 10
There is alread a one in the upper left corner To make a zero underneath, I'll do ( 1) R1 + R 1 3 1 (add row 1 into row ) The result is 0 4 4 Now do 1 4 R (multipl row b 1 ) The 4 1 3 1 result is 0 1 1 Finall, do ( 3) R + R1 (negative three times row two added into row 1) 1 0 From that we get 0 1 1 The solution is x, 1 x+ 1 [15] Solve b Gaussian elimination x + 3 5 1 1 1 1 The augmented matrix is 3 5 ( ) R1 + R gives 0 7 7 Next, 1 7 R 1 1 1 0 1 0 1 1 Finall, ( ) R + R1 gives 0 1 1 The solution is x 1, 1 gives x+ 3z [16] Solve x + + 5z 4 b Gaussian elimination + 3z 0 1 0 3 The augmented matrix is 1 1 5 4 0 1 3 0 1 0 3 ( 1) R1 + R 0 1 0 1 3 0 1 0 3 ( 1) R + R3 0 1 0 0 5 1 0 3 1 R3 0 1 5 0 0 1 5 HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE 9 OF 10
1 0 3 6 ( ) R3 + R 0 1 0 5 0 0 1 5 16 1 0 0 5 6 ( 3) R3 + R1 0 1 0 5 0 0 1 5 16 6 The solution is x,, z 5 5 5 HOLLOMAN S ALGEBRA HONORS AH NOTES 04, PAGE 10 OF 10