Linear Algebra and Its Applications, exercise 1.4.4

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 mn.

More formally, for each entry b_i of b we have

b_i = \sum_{j = 1}^{j = n} a_{ij}x_j, \: { \rm for } \: i = 1, \ldots, m

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 mnp.

More formally, for each entry c_{ij} of B we have

c_{ij} = \sum_{k = 1}^{k = n} a_{ik}b_{kj}, \: { \rm for } \: i = 1,  \ldots, m \: { \rm and } \: j = 1, \ldots, p

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.

This entry was posted in linear algebra. Bookmark the permalink.

1 Response to Linear Algebra and Its Applications, exercise 1.4.4

  1. Mus-haf Akil says:

    thank uuuuuuu very much

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s