Lecture 4: Products of Matrices Winfried Just, Ohio University January 22 24, 2018
Matrix multiplication has a few surprises up its sleeve Let A = [a ij ] m n, B = [b ij ] m n be two matrices. The sum A + B behaves exactly as one might expect, the product AB doesn t. A + B is defined whenever m = m and n = n. AB may not be defined for matrices of the same order, and is sometimes meaningful for matrices of different orders. When A + B = [c ij ], then always c ij = a ij + b ij. When AB = [d ij ], then usually d ij a ij b ij. A + B = B + A, exactly as for addition of numbers. Unlike in multiplication of numbers, it is possible that AB BA.
When can we multiply two matrices? Let A = [a ij ] k n, B = [b ij ] m p be two matrices. Then the product AB is defined if, and only if, n = m, that is, the number of columns of A is equal to the number of rows of B. 1 0 3 1 4 A = 1 6 7 B = 1 7 C = 0 0 0 3 0 AB is defined (3 columns, 3 rows), AC is not defined (3 columns, 2 rows), AA is defined (3 columns, 3 rows), BA is not defined (2 columns, 3 rows), BB is not defined (2 columns, 3 rows), BC is defined (2 columns, 2 rows), CA is defined (3 columns, 3 rows), CB is defined (3 columns, 3 rows), CC is not defined (3 columns, 2 rows). [ 5 6 ] 7 4 3 2
The order of the product Let A = [a ij ] k n and B = [b ij ] n p be such that the number of columns of A is equal to the number of rows of B. Then the product AB is defined and has order k p. 1 0 3 1 4 [ ] A = 1 6 7 B = 1 7 5 6 7 C = 4 3 2 0 0 0 3 0 AB has order 3 2, AA has order 3 3, BC has order 3 3, CA has order 2 3, CB has order 2 2.
Some observations Let A be a matrix. The product AA exists if, and only if, A is square. When it exists, the product AA has the same order as A. Even when AA T and A T A both exist, they will have the same order only if A is a square matrix. If v is a 1 n row vector and w is an m 1 column vector, then v w exists if, and only if, n = m and has dimension 1 1 in this case. If v is a 1 n row vector and w is an m 1 column vector, then w v exists and has dimension m n.
Product of a row vector and a matrix Let A be a matrix of order m n. Let v be a 1 m row vector. va = [ a 11... a 1n ] v 1... v m.. = [ ] w 1... w n a m1... a mn Then va is a 1 n row vector. We can say that postmultiplying (multiplying from the right) an m-dimensional row vector v by A transforms v into a row vector w = va of dimension n.
Products of square matrices and column vectors Let A be a matrix of order m n. Let v be an n 1 column vector. a 11... a 1n v 1 w 1 A v =... =. a m1... a mn Then A v is an m 1 column vector. We can say that premultiplying (multiplying from the left) an n-dimensional column vector v by A transforms v into a column vector w = A v of dimension m. v n w m
The definition of the product Let A = [a ij ] k n and B = [b ij ] n p be such that the number of columns of A is equal to the number of rows of B. Then the product AB is the matrix C = [c ij ] k p such that for all i = 1,..., k and j = 1,..., p: c ij = a i1 b 1j + a i2 b 2j + + a in b nj = n a il b lj. l=1 a 11... a 1l... a 1n b 11... b 1j... b 1p c 11... c 1j... c 1p...... a i1... a il... a in b l1... b lj... b lp...... =... c i1... c ij... c ip... a k1... a kl... a kn b n1... b nj... b np c k1... c kj... c kp
An example of a matrix product Let A = [a ij ] 2 3 and B = [b ij ] 3 3. Then the product AB is the matrix C = [c ij ] 2 3 such that for all i = 1, 2 and j = 1, 2, 3: AB = c ij = a i1 b 1j + a i2 b 2j + a i3 b 3j = 3 a il b lj. l=1 [ ] 4 2 [ ] 1 1 0 1 3 2 1 c11 c = 12 c 13 0 2 3 c 1 1 2 21 c 22 c 23
An example of a product: c 11 Let A = [a ij ] 2 3 and B = [b ij ] 3 3. Then the product AB is the matrix C = [c ij ] 2 3 such that for all i = 1, 2 and j = 1, 2, 3: AB = c ij = a i1 b 1j + a i2 b 2j + a i3 b 3j = 3 a il b lj. l=1 [ ] 4 2 [ ] 1 1 0 1 3 2 1 2 c12 c = 13 0 2 3 c 1 1 2 21 c 22 c 23 c 11 = a 11 b 11 + a 12 b 21 + a 13 b 31 = 1 3 + 0 = 2.
An example of a product: c 12 Let A = [a ij ] 2 3 and B = [b ij ] 3 3. Then the product AB is the matrix C = [c ij ] 2 3 such that for all i = 1, 2 and j = 1, 2, 3: AB = c ij = a i1 b 1j + a i2 b 2j + a i3 b 3j = 3 a il b lj. l=1 [ ] 4 2 [ ] 1 1 0 1 3 2 1 2 6 c13 = 0 2 3 c 1 1 2 21 c 22 c 23 c 12 = a 11 b 12 + a 12 b 22 + a 13 b 32 = 4 + 2 + 0 = 6.
An example of a product: c 13 Let A = [a ij ] 2 3 and B = [b ij ] 3 3. Then the product AB is the matrix C = [c ij ] 2 3 such that for all i = 1, 2 and j = 1, 2, 3: AB = c ij = a i1 b 1j + a i2 b 2j + a i3 b 3j = 3 a il b lj. l=1 [ ] 4 2 [ ] 1 1 0 1 3 2 1 2 6 1 = 0 2 3 c 1 1 2 21 c 22 c 23 c 13 = a 11 b 13 + a 12 b 23 + a 13 b 33 = 2 1 + 0 = 1.
An example of a product: c 21 Let A = [a ij ] 2 3 and B = [b ij ] 3 3. Then the product AB is the matrix C = [c ij ] 2 3 such that for all i = 1, 2 and j = 1, 2, 3: AB = c ij = a i1 b 1j + a i2 b 2j + a i3 b 3j = 3 a il b lj. l=1 [ ] 4 2 [ ] 1 1 0 1 3 2 1 2 6 1 = 0 2 3 9 c 1 1 2 22 c 23 c 21 = a 21 b 11 + a 22 b 21 + a 23 b 31 = 0 + 6 + 3 = 9.
An example of a product: c 22 Let A = [a ij ] 2 3 and B = [b ij ] 3 3. Then the product AB is the matrix C = [c ij ] 2 3 such that for all i = 1, 2 and j = 1, 2, 3: AB = c ij = a i1 b 1j + a i2 b 2j + a i3 b 3j = 3 a il b lj. l=1 [ ] 4 2 [ ] 1 1 0 1 3 2 1 2 6 1 = 0 2 3 9 7 c 1 1 2 23 c 22 = a 21 b 12 + a 22 b 22 + a 23 b 32 = 0 4 3 = 7.
An example of a product: c 23 Let A = [a ij ] 2 3 and B = [b ij ] 3 3. Then the product AB is the matrix C = [c ij ] 2 3 such that for all i = 1, 2 and j = 1, 2, 3: AB = c ij = a i1 b 1j + a i2 b 2j + a i3 b 3j = [ 1 1 0 0 2 3 ] 4 2 1 3 2 1 = 1 1 2 3 a il b lj. l=1 [ 2 6 ] 1 9 7 8 c 23 = a 21 b 13 + a 22 b 23 + a 23 b 33 = 0 + 2 + 6 = 8.
Homework 10 For every angle α, define [ ] cos α sin α R α = sin α cos α Homework 10: Derive a formula for the product R α R β that is as simple as possible.
The inner product of two vectors Assume x is a 1 n row vector and y is an m 1 column vector. Then x y exists if, and only if, n = m, that is, if these vectors have the same dimension. If the product x y exists, it has order 1 1. x y = [ ] y 2 x 1 x 2... x n. = [c], y n where c = x 1 y 1 + x 2 y 2 + + x n y n = n l=1 x ly l is called the inner product or dot product of x and y. y 1
The inner product: Examples Let Then x = [ 2 4 ] y = [ ] 1 3 x y = [(2)( 1) + (4)(3)] = [10], x z = [(2)(2) + (4)( 1)] = [0], x u is undefined. z = [ ] 2 1 0 u = 1 3
An application of inner products Sums of vectors can be expressed as inner products: x 1 [ [ ] x 2 n ] 1 1 1... 1. = x l = [ ] 1 x 1 x 2... x n l=1. x n 1
Homework 11 Homework 11: Let v be the 1 m row vector all of whose elements are 1, let w be the n 1 column vector all of whose elements are 1, and let A be an m n matrix. Give verbal descriptions of va and of A w.
Homework 12 Homework 12: Consider the following matrices: A = [ 1 2 ] 3 4 5 6 B = [ 1 0 ] 4 5 9 0 C = [ 10 ] 2 2 1 Find all of the following matrix products that are defined. AB AC CA AB T B T A
A second look at the definition of the product AB a 11... a 1l... a 1n b 11... b 1j... b 1p c 11... c 1j... c 1p...... a i1... a il... a in b l1... b lj... b lp...... =... c i1... c ij... c ip... a k1... a kl... a kn b n1... b nj... b np c k1... c kj... c kp c ij = a i1 b 1j + a i2 b 2j + + a in b nj = n a il b lj. Recall that a i denotes the vector in row i of A, and b j denotes the vector in column j of B. l=1 In this notation, [c ij ] = a i b j.
The outer product of two vectors Assume x is a 1 n row vector and y is an m 1 column vector. Then y x exists always and is a matrix C = [c ij ] m n of order m n, called the outer product of y and x. y 1 c 11... c 1j... c 1n. [ ]... y x = y i x1... x j... x n = c i1... c ij... c in.... y m c m1... c mj... c mn Here c ij = y i x j for all i = 1,..., m and j = 1,..., n.
The outer product: An example Let x = [ 2 4 1 ] y = [ ] 1 3 Then the inner product x y is undefined and the outer product y x = [ ] [ ] 1 [2 ] ( 1)(2) ( 1)(4) ( 1)( 1) 4 1 = 3 (3)(2) (3)(4) (3)( 1) y x = [ 2 4 ] 1 6 12 3
A third look at the definition of the product AB Let A = [a ij ] k n, B = [b ij ] n p and AB = [c ij ] k p. A B = b [a 11... a 1l... a 1n ] 11.... [a i1... a il... a in ] b l1.... [a k1... a kl... a kn ] b n1... b 1j. b lj. b nj... b 1p. b lp. b np a 1 b 1... a 1 b j... a 1 b p [c 11 ]... [c 1j ]... [c 1p ]... = a i b 1... a i b j... a i b p... =... [c i1 ]... [c ij ]... [c ip ]... a k b 1... a k b j... a k b p [c k1 ]... [c kj ]... [c kp ] Thus we can obtain AB from the outer product A B of the column vector A and the row vector B by dropping all internal brackets. Ohio University Since Winfried 1804 Just, Ohio University MATH3200, Lecture 4: Matrix Department Products of Mathematics