Matrices For grade 1, undergraduate students Abstract. Matrix theory plays a very important role for solving linear equations, representing some linear transformations such as T: n→ n , and applying in many other fields. Keywords. Matrix; the operations of matrix .Some notations Definition. A rectangular array of numbers composed of m rows and n columns a11 a A 21 am1 a12 a22 am 2 ... a1n ... a2 n ... amn is called an m n matrix (read m by n matrix1). We also say that the matrix A is of, or has, size m n . Remark. If there is possibility of confusing entries from two adjacent columns as a product we will insert commas between the entries of a given row to carefully distinguish which entry belongs to which column. The elements ai1 , ai 2 , ain form the i-th row of A and the elements a1 j , a2 j , a mj , form the j-th column of A. We will often write A (aij ) 1 im 1 j n for A, or simply A (aij ) when m and n are understood from context. Remark. The order of the subscripts is important; the first subscript denotes the row and the second subscript the column to which an entry belongs. Just as with vectors in That is: n , two matrices are equal iff they have the same entries. Definition. If A (aij ) and B (bij ) are m n matrices, then A B iff aij bij for i=1,2…, m and j=1,…,n. Our study of linear transformations suggests the following definitions. Definition. If A (aij ) and A B , is the matrix C (cij ) , B (bij ) are two m n matrices, their sum, where (cij ) (aij ) (bij ) , i=1,2…, m , j=1,2…,n. Definition. If A (aij ) is an m n matrix and r is a number then rA, the scalar multiple of A by r, is the matrix C (cij ) where cij raij , i=1,2…, m and j=1,…,n. The following result is a routine verification of definitions: Proposition 1. The matrices of size m n form a vector space under the operations of matrix addition and scalar multiplication. We denote this vector space by Mmn. The dimension of the vector space Mmn is not hard to compute. We take our lead from the method we used to show that dim n=n. Introduce the m n matrix Ers (eij ) by the requirement 0 if i r , j s , eij 1 if i r , j s . For example the 6 4 matrix E32 is 0 0 0 0 0 0 0 0 0 1 0 0 E32 . 0 0 0 0 0 0 0 0 0 0 0 0 It is then a routine verification to prove: Proposition 2. The vectors Therefore dim M mn mn . EXAMPLE 1. Ers | r 1, 2,..., m, s 1, 2,..., n form a basis for M mn . 1 4 0 1 3 3 0 1 2 9 4 2 2 1 0 7 6 1 1 1 4 3 0 2 2 0 9 1 2 7 1 6 0 3 4 1 3 4 5 0 7 9 3 5 1 EXAMPLE 2. 1 4 6 0 1 0 1 1 4 7 2 0 1 7 9 1 2 3 7 9 1 0 4 1 6 1 0 4 1 7 2 1 0 2 1 3 7 7 9 9 1 5 5 4 8 1 2 4 14 18 EXAMPLE 3. 4 3 1 12 4 7 4 28 16 6 4 24 16 Definition. If A (aij ) is an m n matrix and B (bij ) is an n p matrix, their matrix product A B is the m p matrix AB (cij ) , where n ci j a i kb k 1 k j where i 1,..., m, j 1,..., p. Thus the entry of the i-th row and j-th column of the product. A.B is obtained by taking the i-th row ai1 , ai 2. ., . ,ai n of the matrix A and the j-th column of the matrix B b1 j , b2 j , b nj , multiplying the corresponding entries together and adding the resulting products, i.e. ai1 b1 j ai 2 b2 j . . . ai k b k j. . . a i b n ,n j where i 1, 2,..., m, j 1, 2,... p. Remark. Note that for the product of A and B to be defined the number of columns of A must be equal to the number of rows of B. Thus the order in which the product of A and B is taken is very important, for A B can be defined without A B being defined. Compute the matrix product EXAMPLE 4. (1 4 3 ) 5 . 6 2 Solution. Note the answer is a 1 1 matrix. 4 (1 2 3) 5 (4 10 18) (32). 6 Remark. Note that the product 4 5 ( 1 6 2 3) is not defined. EXAMPLE 5. Compute the matrix product 0 0 0 1 0 0 1 1 0 Answer 0 0 1 0 0 0 0 0 0 EXAMPLE 6. Let 1 2 3 A 4 5 6 and 0 0 0 1 0 0 1 1 . 0 1 B 1 1 2 2 2 3 4 3 4 3 4 Calculate the product A B Solution. We have 1 2 3 1 2 3 1 2 3 4 5 6 1 2 3 4 4 4 2 4 6 , 3 6 9 , 4 8 1 2 1 2 3 1 8 , 1 6 2 0 4 5 6 8 1 0 1 2 , 1 2 1 5 6 1 2 1 8 2 4 1 5 3 0 4 5 6 0 Remark. 24 Note that the product B A is not defined. Definition. A matrix A is said to be a square matrix of size n iff it has n rows and n columns (that is the number of rows equals the number of columns equals n). Remark. It is easy to see that if A and B are square matrices of size n then the products AB and BA are both defined. However they may not be equal.. EXAMPLE 7. Let 1 A 0 0 3 a n d B 3 2 0 1 Compute the matrix products AB and BA. Solution. We have 1 A B 0 0 3 3 2 0 3 1 6 0 , B A 3 3 2 0 1 1 0 0 3 3 2 0 3 and so we see that AB BA. Remark. As the preceding example shows even if AB and BA are defined we should not expect that AB=BA. Notation. If A is a square matrix then AA is defined and is denoted by A2. Similarly, A... A n times n is defined and denoted by A EXAMPLE 8. Let 0 0 A . 1 0 Calculate A2 Solution. We have 0 0 0 0 0 0 A2 . 1 0 1 0 0 0 Thus not only does matrix multiplication behave strangely in which it is not commutative, it is also possible for the square of a matrix with nonzero entries to have only zero entries. The rules of matrix operations Now, we may summarize the basic rules of matrix operations in the following formulas: (assume that the indicated operations are defined, that is , that the sizes are correct for the operations to make sense.) (1) A+B=B+A (2) A+(B+C)=A+(B+C) (3) r(A+B)=rA+rB (4) A+0=A (5) 0A=0 (6) A+(-1)A=0 (7) (r+s)A=rA+sA (8) (A+B)·C=A·C+C·B (9) 0·A=0=A·0 (10) A·(B·C)=(A·B) ·C ( where0 (0ij )andoij 0) In discussing matrices it is convenient to distinguish certain special types of matrices. Special types of matrices The identity matrix, the identity matrix of size n is the square n n matrix denoted by I, where 0 1 0 0 0 1 1 ifi j , I 0 0 1 0 (iij ) where iij 0 ifi j. 0 0 1 For example, the identity matrices of size1,2,3and 4 are 1 1 0 0 1 0 0 1 , , 0 1 0, 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 The following important facts are easily verified IB=B for any n p matrix B, AI=A for any m n matrix A. Scalar matrices. A square matrix A= aij is called a scalar matrix iff A=rI for some number r. For example 3 0 0 1 0 0 0 3 0 3 0 1 0 0 0 3 0 0 1 is a scalar matrix but 3 0 0 0 3 0 0 0 3 is not scalar matrix. The following formulas are easily checked (1) (aI)B=aB for any n p matrix B. (2) A(aI)=aA for any m n matrix B. For example 3 0 0 1 3 1 0 3 0 2 6 3 2 0 0 3 3 9 3 Diagonal matrices. For any square matrix A= ( aij ) of size n, a11 , a22 , the entries , ann are called the diagonal entries of A. For example, the diagonal entries of 3 2 1 6 5 4 9 8 7 are 3,5,7. A square matrix is said to be a diagonal matrix iff its only nonzero entries are on the diagonal. That is A= ( aij ) is a diagonal matrix iff ai 0 for i j . For example I and aI are diagonal matrices as it is 3 0 0 0 3 0 0 0 3 Remark. The diagonal entries themselves need not be nonzero . For example 0 0 0 0 1 0 and 0 0 0 0 0 0 0 0 0 0 0 0 are also diagonal matrices. In general a diagonal matrix looks like a11 A 0 ann a22 0 where the giant 0s mean that all other entries are zero. If A and B are diagonal matrices of size n then so are AB and BA. Indeed if a11 A 0 0 and a nn b11 B 0 0 b nn then a11b11 AB 0 a22b22 0 =BA an bn Triangular matrices. A square matrix A is said to be lower triangular iff A= ( aij ) where aij 0 if j i . For example 1 0 0 0 2 0 3 1 3 is a lower triangular matrix. A triangular matrix A= ( aij ) where aii 0, i 1, , n (that is ,all of whose diagonal entries are 0) is said to be strictly triangular. An example of a strictly triangular matrix is 0 0 0 1 0 0 2 3 0 The Zero matrix. The zero matrix of size m n is the m n matrix 0 all of those entries are 0. Idempotent matrices. A square matrix A is said to be idempotent iff A A . 2 There are lots of idempotent matrices. Here are a few examples 1 1 , 0 0 1 0 0 0 1 0 0 0 0 as may be easily checked by explicit computation. Nilpotent matrices. A square matrix A is said to be nilpotent iff there is an integer q such Aq 0 .(The smallest such integer q is called the index of nilpotence of A). 3 For example if A is the matrix of the shift operator on R , that is 1 0 0 A 0 1 0 0 0 0 then 0 0 0 0 0 0 0 0 0 A 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 2 and 0 0 0 0 0 0 0 0 0 A 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 3 so the A is nilpotent of index 3. Nonsingular matrices. A square matrix A is said to be invertible or nonsingular iff there exists a matrix B such that AB=I and BA=I. If A is nonsingular then the matrix B With AB=I=BA is called the inverse matrix of A and is denoted by A1 . It A is nonsingular then the matrix B with AB=I=BA is called the inverse matrix of A and is denoted by A1 It is a theorem that we can prove that if there exists a matrix B such that AB=I. Then also BA=I. 1 Thus to check that B= A we need only calculate one of the two products AB and BA and see if they are I. For example if 0 1 0 A 1 0 0 0 0 1 then 0 1 0 A1 1 0 0 0 0 1 for we have 0 1 0 0 1 0 0 1 0 AA 1 0 0 1 0 0 1 0 0 I 0 0 1 0 0 1 0 0 1 1 and therefore A= A . An example of a matrix that is not invertible is 0 0 0 1 0 0 0 1 0 and more generally we have ; A nilpotent matrix is not invertible. For suppose that A is a nilpotent matrix that is invertible. Let B be an inverse for A. Since A is nilpotent there is an integer q such that Aq 0 Then 0 Aq B Aq 1 AB Aq 1I Aq 1 so Aq 1 0 We may then repeat the above trick to show Aq 2 0 If we repeat this trick q 1 times we will get A0 But then I AB 0B 0 which is impossible. We may also show: The only invertible idempotent matrix is I. For if A is an idempotent matrix then A A 2 implies A IA BAA BA2 BA I . So A=I as claimed. Symmetric and skew-symmetric matrices. A square matrix A= a is said to symmetric ij iff aij a ji for i, j..., n; it is said to be skew-symmetric iff aij -a ji for i, j 1, 2,..., n. For example 1 0 1 0 0 0 and 1 1 3 0 1 2 3 1 2 3 4 5 6 5 7 8 6 8 9 are symmetric matrices, and 1 1 2 1 0 3 and -2 3 0 0 1 1 0 are skew-symmetric matrices. Notice that the matrix 1 0 1 0 0 0 -1 1 3 is not skew-symmetric because a 1 1 a11 That is to say, if a matrix A= aij is skew-symmetric then the equations a11 a11; a22 a22 ,...,ann ann certainly imply that a11 0; a22 0,...,ann 0 , that is skew-symmetric matrix has all its diagonal entries equal to 0. The skew-symmetric matrix 0 1 A 1 0 is interesting because it is also nonsingular since 0 1 0 1 1 0 = . 1 0 1 0 0 1 Proposition 3 A 2 2 matrix a b A c d is nonsingular iff ad bc 0. A1 If ad bc 0, then 1 d b ad bc c a PROOF. Suppose that ad bc 0. B ,Let 1 d b ad bc c a Then BA 1 d b a b ad bc c a c d 1 da bc bd bd ad bc ca ac ca ad 0 1 ad bc ad bc ad bc 0 1 0 I 0 0 and therefore A is nonsingular with A1 1 d b ad bc c a as claimed. Suppose conversely that A is nonsingular, but that contradiction. Let ad bc 0 . We will deduce a d b C c a Then computing as above 0 ad bc CA (ad bc) I 0. ad bc 0 This gives the equation C CI C ( AA1 ) (CA) A1 0 A1 0 . Therefore d b 0 0 C c a 0 0 so that a 0, b 0, c 0, d 0 . But then A=0 also, so I AA1 0 A1 0 so 1 0 0 0 0 1 0 0 and hence 1=0, which is impossible. SOME EXERCISES 1. Perform the following matrix multiplications 0 1 0 1 0 1 1 0 0 1 , 0 0 2 1 0 1 0 1 0 1 00 1 2 2 , 0 1 0 11 0 2 2 0 1 0 0 0 1 2 3 1 0 0 4 5 6 . 0 0 0 7 8 9 2. Which of the following matrices are nonsingular, idempotent, nilpotent, symmetric, or skew-symmetric? 1 1 0 1 A F 0 0 1 0 1 1 1 0 B G 1 1 0 1 1 1 1 0 C H 1 1 1 0 1 1 4 0 D J 1 1 0 2 1 1 0 0 E K 1 1 1 0 Find the inverse for those that are invertible. 3. If A aij is a matrix we define the transpose of A to be the matrix A aij where bij aij . Find the transpose of each of the following matrices: 1 2 3 1 2 3 4 5 6 1 0 11 2 0 1 0 3 4 1 0 05 6 Show for any matrix A that A =A. t t 4. Let A be a square matrix. Show that A is symmetric iff A A . A is skew-symmetric iff t A At . 5. For any square matrix A show that A At is symmetric and A At is skew-symmetric. 6. Let A be an idempotent matrix. Show that I-A is also idempotent. 7. A square matrix A is said to commute with a matrix B iff AB=BA. When does a 3 3 matrix A commute with the matrix Ers ? 8. Show that if a 3 3 matrix A commutes with every 3 3 matrix B then A is a scalar matrix. (Hint: If A commutes with every matrix B it commutes with the 9 matrices Ers , r , s 1, 2,3. ). 9. Find all 2 2 matrices that commute with 1 1 . 0 1 10. Construct a 3 3 matrix A such that A I . 3 11. Let A be a 3 3 matrix, D be the diagonal matrix d1 0 D 0 d2 0 0 (a) (b) 0 0 . d3 Compute D:A Compute A:D 12. Let A be 3 3 matrix. Compute E12 A, A E12 , E21 A, A E21 . What conclusion can you obtain in general for Ers .A and A Ers ? 13. If A is an idempotent square matrix show I-2A is invertible (Hint: Idempotent correspond to projections. Interpret I-2A as a reflection. Try the 2 2 case first. Then try to generalize.)