Lecture 7: Properties of Matrix Multiplication Winfried Just Department of Mathematics, Ohio University January 25, 2016 Winfried Just, Ohio University MATH3200, Lecture 7: Properties of Matrix Multiplication Some familiar-looking properties Let A = [aij ]k×m , B = [bij ]n×p , and C = [cij ]q×r be matrices. Then A(BC) = (AB)C = ABC (Associativity Law), We need here: m = n and p = q. The order of ABC will then be k × r . A(B + C) = AB + AC (Left Distributivity Law), We need here: m = n = q and p = r . The order of A(B + C) will then be k × r . (B + C)A = BA + CA (Right Distributivity Law), We need here: k = p = r and n = q. The order of (B + C)A will then be q × m. Homework 15: Prove the Left Distributivity Law. Ohio University – Since 1804 Winfried Just, Ohio University Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication Applications of the Associativity Law We have used the Associativity Law A(BC) = (AB)C already when we considered compositions of transformations: TA (TB (~v)) = A(B~v) = (AB)~v = (TA ◦ TB )(~v). Our next application of the Associativity Law will rely on the observation that sums of vectors can be expressed as inner products: 1 1 ... x1 " n # X x 2 1 .= xn = x1 x2 . . . .. `=1 xn Ohio University – Since 1804 Winfried Just, Ohio University 1 1 xn . .. 1 Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication Calculating grades: The instructor’s spreadsheet again Let a11 a21 A= . .. a12 a22 .. . ... ... a1n a2n .. = [aij ]m×n . am1 am2 ... amn Assume m is the number of students in the class, n is the number of gradable items, and the entry aij represents the score of student i on gradable item number j. Let ~x be the vector of total scores for each student and let ~y be a vector of mean scores for each item. Question: (a) How can you express ~x as the product of A and a vector ~v? Would the result of this operation give you a row vector or a column vector ~x? ~? (b) How can you express ~y as the product of A and a vector w Would the result of this operation give you a row vector or a column vector ~y? Ohio University – Since 1804 Winfried Just, Ohio University Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication The answer: Let a11 a21 A= . .. a12 a22 .. . ... ... a1n a2n .. = [aij ]m×n . am1 am2 ... amn Assume m is the number of students, n is the number of gradable items, and aij the score of student i on gradable item number j. Let ~x be the vector of total scores for each student and let ~y be a vector of mean scores for each item. 1 1 Then ~x = A . and ~y = m1 m1 . . . m1 A .. 1 The row vector has m entries and the column vector has n entries. Ohio University – Since 1804 Winfried Just, Ohio University Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication Another use of the Associativity Law: Homework 1 again Let A be the instructor’s spreadsheet. Method 1 of calculating the mean total score, adding up the total scores of all students and dividing the result by m, can be expressed as the inner product 1 . 1 1 . . . 1 A .. m 1 Similarly, Method 2 of calculating the mean total score, adding up the mean scores of all gradable items, can be expressed as 1 1 1 . . 1 1 . 1 . . . 1 A .. m ... m A . = m 1 1 The Associativity Law implies that the two products are equal. Ohio University – Since 1804 Winfried Just, Ohio University Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication Commutativity fails Even for square matrices A = [aij ]n×n and B = [bij ]n×n we may have AB 6= BA. Consider the example: 0 1 4 5 c11 c12 AB = = 2 3 6 7 c21 c22 4 5 0 1 d11 d12 BA = = 6 7 2 3 d21 d22 Ohio University – Since 1804 Winfried Just, Ohio University Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication Commutativity fails Even for square matrices A = [aij ]n×n and B = [bij ]n×n we may have AB 6= BA. Consider the example: 0 1 4 5 6 c12 AB = = 2 3 6 7 c21 c22 c11 = a11 b11 + a12 b21 = 0 + 6 = 6. 4 5 0 1 10 d12 BA = = 6 7 2 3 d21 d22 d11 = b11 a11 + b12 a21 = 0 + 10 = 10. Since c11 6= d11 , the matrices AB and BA differ in at least one element and we conclude that AB 6= BA. Ohio University – Since 1804 Winfried Just, Ohio University Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication The transpose of a product Let A = [aij ]k×n and B = [bij ]n×p . Is then (AB)T = AT BT ? Not in general. The expression on the right may not even be defined. But we always have: (AB)T = BT AT Since BT has order p × n and AT has order n × k, the product BT AT is defined. (We are assuming here that all elements of these matrices are numbers, which we will from now on always do when we work with the transpose.) Homework 16: Test the above claims for 1 A= B= 3 4 5 2 Ohio University – Since 1804 Winfried Just, Ohio University Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication Multiplication of symmetric matrices is commutative Let A = [aij ]n×n and B = [bij ]n×n be symmetric, that is, AT = A and BT = B. Homework 17: Assume A and B are symmetric and of the same order. Prove that the product AB is also a symmetric matrix. That is, prove the (AB)T = AB. Now let A, B be symmetric. Then: BA = BT AT = (AB)T = AB. The first equality follows from the definition of symmetry. The second equality follows from reading (AB)T = BT AT backward. The third equality follows from the result of Homework 17. Thus multiplication of symmetric matrices is commutative. Ohio University – Since 1804 Winfried Just, Ohio University Department of Mathematics MATH3200, Lecture 7: Properties of Matrix Multiplication