Groupings, Shopping Lists, Vectors: part 7

In part 6 of this series, I introduced an operation called inner product between two vectors, as a way to find the total price of an order using a price list.  In this post, I want to give a bunch of other examples where the same pattern shows up.

But before I do so, I want to ‘fess up’ to something.  It’s the kind of thing that irritates me when I see others do it.  I did something that didn’t make any particular sense in the context in which I used it – it only makes sense in a future setting, in this case a setting that is several posts away.  We do this in math class all the time: we put the motivation into the future “some day this will all make sense.  You need this because of the 9th grade test, or because of graduate school.”  Instead, I think it is really important that the math makes sense now, always now, not in the future.
Truth is that my displaying the vector inner product using one horizontal vector and one vertical vector was not something that was particularly appropriate in the problem setting that I used.  It may have gotten in the way somewhat.  So let me correct that here and use a representation that is appropriate to the situation at hand.

 cheeseburger \$1.50 chickenburger \$1.80 coke \$1.20 diet coke \$1.20 fries \$1.50 hamburger \$1.40 ice cream treat \$1.90 kid meal \$3.00
 coke cheeseburger hamburger fries 3 1 5 2
 \$ \$15.10

it would be more natural to use a representation like this (which more closely matches many order forms you may see):

 Item Price × Order = Amount cheeseburger \$1.50 × 1 = \$1.50 chickenburger \$1.80 × = coke \$1.20 × 3 = \$3.60 diet coke \$1.20 × = fries \$1.50 × 2 = \$3.00 hamburger \$1.40 × 5 = \$7.00 ice cream treat \$1.90 × = kid meal \$3.00 × = Total = \$15.10

This representation matches more clearly how most of us would think about an order being priced. The two starting vectors(the order vector and the price vector) can be seen in this arrangement, though they are a bit indistinct.  If you’d feel better if the blank entries are replaced by zeros, you are welcome to do it that way:

 Item Price × Order = Amount cheeseburger \$1.50 × 1 = \$1.50 chickenburger \$1.80 × 0 = \$0.00 coke \$1.20 × 3 = \$3.60 diet coke \$1.20 × 0 = \$0.00 fries \$1.50 × 2 = \$3.00 hamburger \$1.40 × 5 = \$7.00 ice cream treat \$1.90 × 0 = \$0.00 kid meal \$3.00 × 0 = \$0.00 Total = \$15.10

OK – now on to other examples of inner products.

Weighted Average – One that most teachers are familiar with is that of computing an average score based on a series of tests, each with its own weight.  So let’s say there was a test in September, and one in October, and one in November, and a final in December.  Let’s say the scores on each are in the range from 0 to 100, and that the final is supposed to count twice as heavily as the other tests.

The weights vector would be:

 September 0.2 October 0.2 November 0.2 December 0.4

The weight vector is the same for all students, and is independent of the scores.

A particular student would have a set of scores.  Let’s assume Jesse’s scores are like this:

 September 60 October 70 November 50 December 100

The final score for Jesse would be the inner product of his score vector and the weights vector:
60 × .20 + 70 × .20 + 50 × .20 + 100 × .40 = 12 + 14 + 10 + 40 = 76.

(This matches the result you’d get if you took the average of 60, 70, 50, 100, 100 where you’d repeat the December score twice.  That’s another way to give the December score double the weight of the others.  60 + 70 + 50 + 100 + 100 = 380, and if you divide that by 5 – which is the number of scores added together – you get the same 76.)

Total Calories – Just like we can price an order by computing the inner product of the order vector with a price vector, we can get the total calories of an order by computing the inner product of the order vector with a calorie vector.

Number of Cups – We can keep track of inventory through inner products, too.  A store will typically want to replace the inventory that’s been sold, and for that it wants to keep track of the total amount sold.  This is probably most useful  when done for a particular period, like a day.  To keep the example simple, let’s assume we’re keeping track for each single order (and then add these up for all orders in a day).  The store would want to keep track of the number of hamburger patties used up, the number of slices of pickle used, etc.  In this example, we’ll keep track of the number of cups used for a particular order.  Again, this can be done by taking the inner product of the order vector with the following vector:

 cheeseburger 0 chickenburger 0 coke 1 diet coke 1 fries 0 hamburger 0 ice cream treat 0 kid meal 1

which we might name the “cup vector”.  You can verify for yourself that the inner product of our example order

 coke cheeseburger hamburger fries 3 1 5 2

with the cup vector would yield 3 cups.  For (3×1 cup) + (1×0 cups) + (5×0 cups) + (2×0 cups) = 3 cups.

We’ll see more examples of inner products later, including geometric examples.  I think we’ve got enough here to gives us a natural introduction to a new topic in the next post: we are going to introduce matrices.

This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.