Home | 18.013A | Chapter 3 | Section 3.4 | | Tools Glossary Index Up Previous Next

Exercise 3.8

Build a spreadsheet that multiplies 4 by 4 matrices.

Solution:

You can build a spreadsheet that will multiply two matrices of a given size (or smaller) by entering one instruction and copying it appropriately.

This takes the drudgery, such as it is, out of multiplying matrices, and allows you to find higher powers of matrices as well.

How?

Suppose your 4 by 4 (say) matrix A is in locations A1 to A4, B1 to B4, C1 to C4 and D1 to D4 and your matrix B is in locations F1 - F4, G1 - G4, H1 - H4, and I1 - I4.

Then enter the following formula in K1

=$A1*F$1+$B1*F$2+$C1*F$3+$D1*F$4

(notice that the dollar signs go on the indices that change from term to term in the formula of the instruction.)

This formula will put the dot product of the first row of A and the first column of B in the square K1.

Now copy this entry (using a fill or copy command) into rows 1-4 and columns from K upward as far as you like, say to A Z .

Up Previous Next