06. Matrix multiplication, 3

06. Matrix multiplication, 3

Multiplying bigger matrices

(0.00) Suppose A is an m-by-n matrix (m rows and n columns) and B is an n-by-p matrix (n rows and p columns). To save our sanity, suppose m = 2, n = 3, p = 4: A equals A_{1 1}, A_{1 2}, A_{1 3}; A_{2 1}, A_{2 2}, A_{2 3} and B equals B_{1 1}, B_{1 2}, B_{1 3}, B_{1 4}; B_{2 1}, B_{2 2}, B_{2 3}, B_{2 4}; B_{3 1}, B_{3 2}, B_{3 3}, B_{3 4}.

(2.36) I claim that there's an obvious way to define A B given everything we've seen so far.

  • To get the top left entry of A B, we multiply the top row of A into the first column of B, giving A_{1 1} B_{1 1} + A_{1 2} B_{2 1} + A_{1 3} B_{3 1}.

  • To get the next entry along, we multiply the top row of A into the second column of B.

  • We keep going: to get the entry of A B in the ith row and the jth column, we multiply the ith row of A into the jth column of B.

This means we end up with 2 rows (same number as A) and 4 columns (same number as B).

(4.38) You might ask: what happens if A is m-by-n and B is k-by-p but n is not equal to k? For example: A_{1 1}, A_{1 2}; A_{2 1}, A_{2 2} times B_{1 1}, B_{1 2} doesn't make any sense: the rows of A have length 2 and the columns of B have height 1, so we can't multiply rows into columns.

(6.13) This is reasonable: A defines a transformation from R 2 to R 2 and B defines a transformation from R 2 to R, so while you can define B times A From R 2 to R 2 to R, you have no way of composing the transformations as A B (the domain of A is not the target of B).

(8.15) As an exercise, do the following multiplications: the 3-by-3 matrix 0, 0, 1; 1, 0, 0; 0, 1, 0 times the 3-by-1 matrix x; y; z the 2-by-3 matrix 1, 2, 3; minus 1, a half, 0 times the 3-by-2 matrix 2, minus 3; minus 1, 0; 0, 1 the 1-by-4 matrix 1, minus 1, 1, minus 1 times the 4-by-1 matrix 1; 2; 3; 4 the 4-by-1 matrix 1; 2; 3; 4 times the 1-by-4 matrix 1, minus 1, 1, minus 1. (see the video for solutions).