Exercise 1: Sizes first: when a product exists, and what shape it has
Before a single entry is computed, a product has to pass a size test. An matrix can multiply an matrix, because each row of the first has exactly as many entries as each column of the second, and the result is . The figure shows the rule on a pair that is not in the questions: the INNER sizes must agree, the OUTER sizes give the shape.
Throughout, and .
- a) Sizes only. is , is , is some matrix and is a column of , that is . For each of , , , , , , and , say whether it exists and give its size.
- b) Compute and . What is the first thing you notice, before comparing a single entry?
- c) With , compute and .
- d) is . What size must a matrix have for both and to exist? For which , can the question whether even be asked?
- e) Give the entry of the triple product , choosing the bracketing that costs the fewest multiplications.
Show the solution
Answers
- a) : ; : ; : ; : undefined; : undefined; : ; : ; : undefined
- b) , : not even the same size
- c) , a ; , a
- d) must be ; can only be asked when
- e) , computed as row 3 of times column 1 of
a) The test is always the same: write the two sizes side by side and look at the two numbers in the MIDDLE. is , inner , so it exists and is . is , inner , so it exists and is . is , which is . is , inner : it does not exist, even though does. is , inner : undefined. is a sum, and a sum needs IDENTICAL sizes, not matching inner ones: is like , so the sum exists and is , while would not. is , and is , inner , undefined. Writing out the two sizes costs three seconds and it is the only line that catches a product that does not exist before you have spent a page computing it.
b) Row of against column of . Row 1 of is : against column 1 of , , it gives ; against column 2, , it gives . Row 2, , gives and . So . For , row 1 of is and the columns of are , , , giving , , ; row 2, , gives , , ; row 3, , gives , , . So . The first thing to notice needs no entry at all: is and is . Non-commutativity starts here, in its crudest form. For non-square factors the two orders are not even comparable.
c) is , a matrix: . is , a matrix whose entry is , so . The same two factors in the two orders give a number in one case and nine numbers in the other. A student who writes has computed the wrong product, and nothing in the arithmetic warns them: only the sizes do. Notice also that is symmetric and that its diagonal adds up to , a first sighting of the trace identity of exercise 7.
d) If is , then needs to have rows and needs to have columns, so is . Then is and is . The equation compares two matrices, so it only makes sense when they have the same size, that is : commuting is a question about SQUARE matrices, and exercise 6 only asks it there.
e) is , a matrix, and associativity lets us bracket it either way. first builds the matrix , nine entries; first builds the matrix , four entries, already found in b). Take the cheaper one. The entry of is row 3 of times column 1 of : . The check through the other bracketing, row 3 of times column 1 of , gives as well. What you may NOT do is move a factor: is associativity, allowed, while would be commutativity, forbidden.