Exercise 1.4.4. Compute the number of multiplications required to multiply an mxn matrix A by an n-dimensional vector x. Also compute the number of multiplications required to multiply A by an nxp matrix B.

Answer: The result of multiplying A (which is mxn) by x (which is nx1) is an mx1 column vector b. Each entry of b is the inner product of a row of A (containing n entries) with all the n entries of x, and therefore requires n multiplications. Since b has m entries, the total number of multiplications is thus m times n or .

More formally, for each entry of b we have

Each sum requires n multiplications, and there are m sums in toto.

When multiplying A times B, the result is the mxp matrix AB. Each entry of AB is the inner product of a row of A (containing n entries) and a column of B (also containing n entries), and requires n multiplications. Since AB contains m times p entries, the total number of multiplications is therefore m times p times n or .

More formally, for each entry of B we have

Each sum requires n multiplications, and there are m times p sums in toto.

NOTE: This continues a series of posts containing worked out exercises from the (out of print) book Linear Algebra and Its Applications, Third Edition by Gilbert Strang.

If you find these posts useful I encourage you to also check out the more current Linear Algebra and Its Applications, Fourth Edition, Dr Strang’s introductory textbook Introduction to Linear Algebra, Fourth Edition and the accompanying free online course, and Dr Strang’s other books.

### Like this:

Like Loading...

*Related*

thank uuuuuuu very much