# Use Python, NumPy, And Matplotlib To Complete The Following Tasks:

3.4.1 Applications of Multiplying a Matrix Times a Vector

The geometric applications of multiplying a matrix by a vector are very important and interesting, but too complex for a short discussion here. These are

discussed in Chapter 6.

The simplest applications of M ·v are those for which we are interested in

the dot product of each of the rows with the vector separately. For instance,

in Application 2.4 (grocery shopping), let B be a matrix of shopping baskets,

where B[i, j] is the number of item j that person i is buying, and let p be a

vector of prices, where p [j] is the price of item j. Then B · p is a vector of total

cost for each person; that is, (B · p)[i] is the cost of the shopping basket for

person i.

Similarly, let P be a matrix of prices of items at stores, where P[i, j] is the

price of item j at store i, and let b be the vector of a shopping basket, where

b [j] is the number of item j to be bought. Then P ·b is the vector of the cost of

the basket by store; that is (P ·b)[i] is the cost of the shopping basket at store i.

More interesting, perhaps, are the applications in which M represents a

transformation of the vector as a whole.