Lecture2, Matrices

43
Chapter 2 Matrices 2.1 Operations with Matrices 2.2 Properties of Matrix Operations 2.3 The Inverse of a Matrix 2.4 Elementary Matrices 2.1

description

Lecture2, Matrices

Transcript of Lecture2, Matrices

Chapter 2 Matrices 2.1Operations with Matrices 2.2Properties of Matrix Operations 2.3The Inverse of a Matrix 2.4Elementary Matrices 2.1 2.2 2.1Operations with Matrices Matrix: n mn mmn m m mnnnijMa a a aa a a aa a a aa a a aa Ae(((((((

= =] [3 2 13 33 32 312 23 22 211 13 12 11 (i, j)-th entry (or element): ijanumber of rows:m number of columns:n size:mn Square matrix: m = n 2.3 For[ ]and [ ] ,ij m n ij m nA a B b = = Equal matrices: two matrices are equal if they have the same size (m n) and entries corresponding to the same position are equal if and only iffor 1 , 1ij ijA B a b i m j n = = s s s s Ex 1: Equality of matrices ((

=((

=d cb aB A 4 32 1If ,then1, 2, 3,and4 A B a b c d = = = = =2.4 Matrix addition: If[ ] ,[ ] ,ij m n ij m nA a B b = =then [ ] [ ] [ ] [ ]ij m n ij m n ij ij m n ij m nA B a b a b c C + = + = + = = Ex 2: Matrix addition ((

=((

+ + + =((

+((

3 15 02 1 1 03 2 1 12 13 11 02 1=((((

+((((

231231((((

+ + 2 23 31 1((((

=0002.5 Matrix subtraction: B A B A ) 1 ( + = Scalar multiplication: If[ ]and is a constant scalar,ij m nA a c= Ex 3: Scalar multiplication and matrix subtraction ((((

=2 1 21 0 34 2 1A((((

=2 3 13 4 10 0 2B Find (a) 3A,(b) B,(c) 3A B then[ ]ij m ncA ca=2.6 (a) ((((

=2 1 21 0 34 2 13 3A (b) ( )((((

= 2 3 13 4 10 0 21 B(c) ((((

((((

= 2 3 13 4 10 0 26 3 63 0 912 6 33 B ASol: ((((

=6 3 63 0 912 6 3 ( ) ( ) ( )( ) ( ) ( )( ) ( ) ( )((((

=2 3 1 3 2 31 3 0 3 3 34 3 2 3 1 3((((

=2 3 13 4 10 0 2((((

=4 0 76 4 1012 6 12.7 Matrix multiplication: If[ ]and[ ] ,ij m n ij n pA a B b = =then[ ] [ ] [ ] ,ij m n ij n p ij m pAB a b c C = = =nj innkj i j i kj ik ijb a b a b a b a c + + + = ==12 2 1 1where size ofC=AB (((((

=((((((

(((((((

in ij i inn nj nn jn jnn n nin i inc c c cb b bb b bb b ba a aa a aa a a 2 112 2 211 1 112 12 11 12 11 The entry cij is obtained by calculating the sum of the entry-by-entry product between the ith row of A and the jth column of B should be equal 2.8 3 21 34 25 0A ( (= ( ( 2 23 24 1B (=( Ex 4: Find AB Sol: 3 23 2( 1)( 3) (3)( 4) ( 1)(2) (3)(1)(4)( 3) ( 2)( 4) (4)(2) ( 2)(1)(5)( 3) (0)( 4) (5)(2) (0)(1)9 14 615 10AB + + ( (= + + ( ( + + ( (= ( ( Note: (1) BA is not multipliable (2) Even BA is multipliable, ABBA2.9 Matrix form of a system of linear equations in n variables: = + + += + + += + + +m n mn m mn nn nb x a x a x ab x a x a x ab x a x a x a2 2 1 12 2 2 22 1 211 1 2 12 1 11= = = A x b equations linearmsingle matrix equationA= x b1 n n m 1 m(((((

=(((((

(((((

m n mn m mnnbbbxxxa a aa a aa a a 21212 12 22 211 12 112.10 Partitioned matrices: ((

=((((

=22 2112 1134 33 32 3124 23 22 2114 13 12 11A AA Aa a a aa a a aa a a aAsubmatrix 11 12 13 14 121 22 23 24 231 32 33 34 3a a a aA a a a aa a a a (( ((= = (( (( rrr| |11 12 13 1421 22 23 24 1 2 3 431 32 33 34a a a aA a a a aa a a a ( (= = ( ( c c c c Partitioned matrices can be used to simplify equations or to obtain new interpretation of equations (see the next slide) row vector column vector 2.11 | |11 12 121 22 21 21 2nnnm m mna a aa a aAa a a ( ( (= = ( ( c c c12nxxx ( ( (= ( ( x11 1 12 2 121 1 22 2 21 1 2 21n nn nm m mn nma x a x a xa x a x a xAa x a x a x+ + + ( (+ + + ( = ( (+ + + x A linear combination of the column vectors of matrix A: (((((

+ +(((((

+(((((

=mnnnnm maaaxaaaxaaax 212221221211111c= 2c= nc= 1 1 2 2 n nx x x = + + + c c c Ax can be viewed as the linear combination of column vectors of A with coefficients x1, x2,, xn | |121 2 nnxxx ( ( (= ( ( c c c You can derive the same result if you perform the matrix multiplication for matrix A expressed in column vectors and x directly 2.12 Diagonal matrix: a square matrix in which nonzero elements are found only in the principal diagonal Trace operation: ) , , , (2 1 nd d d diag A =n nnMddde(((((

= 0 00 00 02111 22If[ ] ,then( )ij n n nnA a Tr A a a a= + + + It is the usual notation for a diagonal matrix. 2.13 2.2Properties of Matrix Operations Three basic matrix operators, introduced in Sec. 2.1:(1) matrix addition (2) scalar multiplication (3) matrix multiplication Zero matrix: 0 0 00 0 00 0 0m nm n ( ( (= ( ( 0Identity matrix of order n): 1 0 00 1 00 0 1nn nI ( ( (= ( ( 2.14 then(1)A+B = B+A (2)A+(B+C) = (A+B)+C (3)( cd ) A = c ( dA ) (4)1A = A (5)c( A+B ) =cA + cB (6)( c+d ) A = cA + dA If ,,,and, are scalars,m nA B C M c de Properties of matrix addition and scalar multiplication: (Commutative property () of addition) (Associative property () of addition) (Associative property of scalar multiplication) (Multiplicative identity property, and 1 is the multiplicative identity for all matrices) (Distributive () property of scalar multiplication over matrix addition) (Distributive property of scalar multiplication over real-number addition) Notes: All above properties are very similar to the counterpart properties for real numbers 2.15 If ,and is a scalar,m nA Mcethen(1) m nA A+ = 0(2) ( )m nA A+ = 0(3) 0or m n m ncAc A = = = 0 0 Notes: All above properties are very similar to the counterpart properties for the real number 0 Properties of zero matrices: So, 0mn is also called the additive identity for the set of all mn matrices Thus , A is called the additive inverse of A 2.16 (1) (BC) = (AB ) C (2) (B+C) = AB + AC (3) (A+B)C = AC + BC (4) c (AB) = (cA) B = A (cB) Properties of the identity matrix: If , then(1) (2) m n nmA M AI AI A Ae == Properties of matrix multiplication: (Associative property of matrix multiplication) (Distributive property of LHS matrix multiplication over matrix addition) (Distributive property of RHS matrix multiplication over matrix addition) For real numbers, the properties (2) and (3) are the same since the order for the multiplication of real numbers is irrelevant. For real numbers, in addition to satisfying above properties, there is a commutative property of real-number multiplication, i.e., cd = dc. For real numbers, the role of 1 is similar to the identity matrix. However, 1 is unique for real numbers and there could be many identity matrices with different sizes 2.17 1 01 2 1 0 2, ,and3 1 .2 1 3 2 12 4A B C ( (( (= = = (( ( ( Ex : Matrix Multiplication is Associative Calculate (AB)C and A(BC) for Sol: 1 01 2 1 0 2( ) 3 12 1 3 2 12 41 05 4 0 17 43 11 2 3 13 142 4AB C (| | (((=| ((( \ . ( ( (( (= = (( ( ( 2.18 1 01 2 1 0 2( ) 3 12 1 3 2 12 41 2 3 8 17 42 1 7 2 13 14A BC| | ( (( | (=(( | ( | ( \ . (((= = ((( 2.19 Properties for Ak: Definition of Ak : repeated multiplication of a square matrix: 1 2 matrices, , ,kkA A A AA A AA A = = =(1) AjAk = Aj+k (2) (Aj)k = Ajk where j and k are nonegative integers and A0 is assumed to be I 11220 00 00 00 00 00 0kkkknnddddD Ddd ( ( ( ( ( (= =( ( ( ( ( For diagonal matrices: 2.20 11 12 121 22 21 2If ,nnm nm m mna a aa a aA Ma a a ( ( (= e ( ( 11 21 112 22 21 2thenmm Tn mn n mna a aa a aA Ma a a ( ( (= e ( ( Transpose of a matrix: The transpose operation is to move the entry aij (original at the position (i, j)) to the position (j, i) Note that after performing the transpose operation, AT is with the size nm 2.21 ((

=82A(b) ((((

=9 8 76 5 43 2 1A(c) ((((

=1 14 21 0ASol:(a) ((

=82A| | 8 2 = TA(b) ((((

=9 8 76 5 43 2 1A((((

= 9 6 38 5 27 4 1TA(c) ((((

=1 14 21 0A((

= 1 4 11 2 0TA(a) Ex : Find the transpose of the following matrix 2.22 A AT T= ) ( ) 1 (T T TB A B A + = + ) ( ) 2 () ( ) ( ) 3 (T TA c cA =) ( ) 4 (T T TA B AB = Properties of transposes: Properties (2) and (4) can be generalized to the sum or product of multiple matrices. For example, (A+B+C)T = AT+BT+CT and (ABC)T = CTBTAT Since a real number also can be viewed as a 1 1 matrix, the transpose of a real number is itself, that is, for, aT = a. In other words, transpose operation has actually no function on real numbers a R e2.23 2 1 21 0 30 2 1A ( (= ( ( 3 12 13 0B ( (= ( ( Sol: Ex : Show that (AB)T and BTAT are equal 2 1 2 3 1 2 12 6 1( ) 1 0 3 2 1 6 11 1 20 2 1 3 0 1 2TTTAB| | ((( ( | (((= = =( | ((( | ((( \ .2 1 03 2 3 2 6 11 0 21 1 0 1 1 22 3 1T TB A ( (( (= = (( ( ( 2.24 A square matrix A is symmetric ifA = AT Ex: ((((

=65 43 2 1 Ifc ba A is symmetric, find a, b, c? A square matrix A is skew-symmetric ifAT = A Skew-symmetric matrix: Sol: ((((

=65 43 2 1c ba A((((

=6 5 34 21cb aAT5 , 3 , 2 = = = c b aTA A = Symmetric matrix: 2.25 ((((

=03 02 1 0 Ifc ba A is a skew-symmetric, find a, b, c? Note: TAAmust be symmetric Pf: symmetric is) ( ) (TT T T T T TAAAA A A AA

= =Sol: (((

=03 02 1 0c ba A((((

= 0 3 20 10cb aATTA A =3 , 2 , 1 = = = c b a Ex: The matrix A could be with any size, i.e., it is not necessary for A to be a square matrix. In fact, AAT must be a square matrix. 2.26 ab = ba(Commutative property of real-number multiplication) If, then is defined, but is undefined m p AB BA = ( 1) m m m mM BA M AB n p m e e = = (3) then, IfIf ,, then,m m n nm p m n AB M BA M = = e e ( 2) (Sizes are not the same) (Sizes are the same, but resultant matrices are not equal) Real number: Matrix: BA AB =p n n m Three situations for BA: n p m n Before finishing this section, two properties will be discussed, which is held for real numbers, but not for matrices: the first is the commutative property of matrix multiplication and the second is the cancellation law 2.27 ((

=1 23 1A((

=2 01 2BSol: ((

=((

((

=4 45 22 01 21 23 1ABBA AB =((

=((

((

=2 47 01 23 12 01 2BA Ex : Sow that AB and BA are not equal for the matrices. and (noncommutativity of matrix multiplication) 2.28 Notes: (1) A+B = B+A (the commutative law of matrix addition) (2)(the matrix multiplication is not with the commutative law) (so the order of matrix multiplication is very important) BA AB = This property is different from the property for the multiplication operations of real numbers, for which the order of multiplication is with no difference 2.29 (Cancellation law is not necessary to be valid) 0 , = = c bc acb a = (Cancellation law for real numbers) Matrix: and (is not a zero matrix) AC BC C C = = 0(1) If C is invertible, then A = B (2) If C is not invertible, then Real number: B A= Here I skip to introduce the definition of invertible because we will study it soon in the next section 2.30 ((

=((

=((

=2 12 1 ,3 24 2 ,1 03 1C B ASol: ((

=((

((

=2 14 22 12 11 03 1ACSo, although, BC AC = B A=((

=((

((

=2 14 22 12 13 24 2BC Ex :(An example in which cancellation is not valid) Show thatAC=BC 2.31 2.3 The Inverse of a Matrix n nM Aeif there exists a matrix such that,n n nB M AB BA Ie = = Note: A square matrix that does not have an inverse is called noninvertible (or singular) Consider, then(1) A is invertible (or nonsingular) (2) B is the inverse of A Inverse matrix: The definition of the inverse of a matrix is similar to that of the inverse of a scalar, i.e., c (1/c) = 1 Since there is no inverse (or said multiplicative inverse) for the real number 0, you can imagine that noninvertible matrices act a similar role to the real number 0 is some sense 2.32 If B and C are both inverses of the matrix A, then B = C. Pf: C BC IBC B CACI AB CI AB=====) () (Consequently, the inverse of a matrix is unique. Notes: (1) The inverse of A is denoted by 1 AI A A AA = = 1 1 ) 2 ( Theorem 1 : The inverse of a matrix is unique (associative property of matrix multiplication and the property for the identity matrix) 2.33 | |Gauss-JordanElimination 1| | A I I A ( Find the inverse of a matrix by the Gauss-Jordan Elimination: 2.34 (((

=3 2 61 0 10 1 1A( 1)1,21 1 0 1 0 0 0 1 1 1 1 0 6 2 3 0 0 1A ( ( ( ( Sol: | |(((

=1 0 00 1 00 0 13 2 61 0 10 1 1

I A( 6)1,31 1 0 1 0 0 0 1 1 1 1 00 4 3 6 0 1A ( ( ( ( ( 1)31 1 0 1 0 0 0 1 1 1 1 00 0 1 2 4 1M ( ( ( ( ( 4)2,31 1 0 1 0 0 0 1 1 1 1 00 0 1 2 4 1A ( ( ( ( Ex : Find the inverse of the following matrix 2.35 (1)3,21 1 0 1 0 00 1 0 3 3 10 0 1 2 4 1A ( ( ( ( (1)2,11 0 0 2 3 10 1 0 3 3 10 0 1 1 4 1A ( ( ( ( So the matrix A is invertible, and its inverse is ((((

=1 4 21 3 31 3 21A] [1 = A I Check it by yourselves: I A A AA = = 1 1

2.36 Matrix Operations in Excel TRANSPOSE: calculate the transpose of a matrix MMULT: matrix multiplication MINVERSE: calculate the inverse of a matrix MDETERM: calculate the determinant of a matrix SUMPRODUCT: calculate the inner product of two vectors For TRANSPOSE, MMULT, and MINVSRSE, since the output should be a matrix or a vector, we need to input the formula first, then choose the output range, and finally put focus on the formula description cell and press Ctrl+Shift+Enter to obtain the desired result. See Matrix operations in Excel.xls downloaded from my website. 2.37 If A is an invertible matrix, k is a positive integer, and c is a scalar, then A A A = 1 1 1) ( and invertible is (1)1 1(2)isinvertibleand( ) ( )k k k kA A A A = =1 11(3)c isinvertible if0 and( ) A c cA Ac = = Theorem 2: Properties of inverse matrices T T TA A A ) ( ) ( and invertible is (4)1 1 =11 1Ex.2 3 2 4 0.1 0.34 1 3 1 0.4 0.20.1 0.4( ) ( )0.3 0.2TT TA A AA A (((= = = ((( (= = ( T is not the number of power. It denotes the transpose operation 2.38 Theorem 3: The inverse of a product If A and B are invertible matrices of order n, then AB is invertible and 1 1 1) ( = A B AB1 1Thus, if is invertible, then its inverse isAB B A Pf:1 1 1 1 1 1 1( )( ) ( ) ( ) ( ) AB B A A BB A A I A AI A AA I = = = = = Note: (1) It can be generalized to the product of multiple matrices (2) It is similar to the results of the transpose of the products of multiple matrices (see Slide 2.23) ( )111213113 2 1 = A A A A A A A An n ( )1 2 3 3 2 1TT T T Tn nA A A A A A A A =(associative property of matrix multiplication) 2.39 Theorem 4: Cancellation properties for matrix multiplication If C is an invertible matrix, then the following properties hold: (1) If AC=BC, then A=B (right cancellation property) (2) If CA=CB, then A=B (left cancellation property) Pf: B ABI AICC B CC AC BC C ACBC AC===== ) ( ) () ( ) (1 11 1-1(is invertible, so exists) C C Note: If C is not invertible, then cancellation is not valid. (Associative property of matrix multiplication) 2.40 Theorem 5: Systems of equations with a unique solution If A is an invertible matrix, then the system of linear equations Ax = b has a unique solution given by 1A= x bPf:( A is nonsingular) 1 111

AA A AI AA ====x bx bx bx bThis solution is unique. 1 2If and weretwosolutionsofequation , A = x x x b1 2then A A = = x b x1 2 = x x (left cancellation property) 2.41 Ex : Use an inverse matrix to solve each system (a) (b) (c) 2 3 13 3 12 4 2x y zx y zx y z+ + = + + =+ + = 2 3 43 3 82 4 5x y zx y zx y z+ + =+ + =+ + =2 3 03 3 02 4 0x y zx y zx y z+ + =+ + =+ + =Gauss-Jordan Elimination 12 3 1 1 1 03 3 1 1 0 12 4 1 6 2 3A A (( (( = = (( (( Sol: 2.42 (a) (b) (c) 11 1 0 1 21 0 1 1 16 2 3 2 2A ((( (((= = = ((( ((( x b11 1 0 4 41 0 1 8 16 2 3 5 7A ((( (((= = = ((( ((( x b11 1 0 0 01 0 1 0 06 2 3 0 0A ((( (((= = = ((( ((( x b This technique is very convenient when you face the problem of solving several systems with the same coefficient matrix. Because once you have A-1, you simply need to perform the matrix multiplication to solve the unknown variables. If you only want to solve one system, the computation effort will be less for the G. E. plus the back substitution or the G. J. E. 2.43 Before finishing this section, let us revisit a statement : if a homogeneous system has any nontrivial solution, this system must have infinitely many nontrivial solutions 11 11Suppose there is a nonzero solution for this homegeneous system such that. Then it is straightforward to show that must be another solution, i.e., ( ) (A tA t t A==xx 0 xx x1) ( )Finally, since can be any real number, it can be concluded that there areinfinitely many solutions for this homogeneous systemtt= = 0 0

The fourth property of matrix multiplication