Groupings, Shopping Lists, Vectors: part 13

In prior posts in this series we have seen two completely different kinds of applications for the idea of matrix multiplication: in part 11 we looked at pricing out an order, and in part 12 we looked at drawing a three-dimensional object in two dimensions using a simple form of perspective.  As different as these situations are, in both we could see vectors and matrices appear rather naturally, and in both we could see inner product of vectors and matrix multiplication playing a key role.  We could ask ourselves the question: how come vectors and matrices appear so naturally; and we could ask a different but similar question: how come inner products and matrix multiplication appear so naturally.  They are actually quite different questions, and in this post I only intend to tackle the first one.  What is so natural about vectors and matrices?

To answer that question, lets first revisit what these things are that we’ve been calling vectors and matrices.  Roughly speaking, a vector is a bunch of numbers, but not just numbers – numbers coupled with some unambiguous indication of what each number means.

If I have a pile of coins, I may notice that it consists of 3 quarters, 5 nickels, 2 dimes and 7 pennies.  The numbers involved are 3, 5, 2 and 7.  But unless I keep careful track of what the 3 represents and what the 2 represents, I may get confused easily.  3 quarters and 5 nickels and 2 dimes and 7 pennies is not the same as 2 quarters and 7 dimes and 3 pennies and 5 nickels, but it is the same as 2 dimes and 5 nickels and 7 pennies and 3 quarters.  One way of saying that is that the numbers come in a certain denomination and that the denomination is as important as the number.  There might be an objection that we should just say \$1.27 and be done with it.  Who cares about the make up of that \$1.27 total?  Well, in some situations you might: when a parking meter takes quarters and dimes but no nickels or pennies, or when you want to give your kid a 50 cent allowance and she has no change.  To use a bit more ‘adult’ example, imagine you run a clothing store, and you decide that its current level of inventory, at \$47,000, is too high.  Surely you’d care about how many you have of each item (so you can match it with your knowledge about how fast each item is selling) rather than merely knowing the total.  Or let’s think about a grocery store, that is running low on inventory.  You think they’d simply call their suppliers and say: “bring us two trucks worth of inventory!”?  Surely they’d specify how much of this they want, and how much of that.

If a vector is a bunch of numbers, a matrix is a bunch of vectors – but not just any vectors.  Rather, the vectors share something, so that the bunch of vectors can be displayed in a rectangular arrangement. The picture above, from part 11, shows an order matrix on the left, and this matrix contains the orders for Joe and Jerry.  This matrix contains two order vectors, one for Joe and one for Jerry.  These vectors share the same set of products from the menu, and this allows them to be joined into a matrix.  You can see that this is done in part by including stuff that Jerry didn’t order.  Jerry didn’t order coke, but an entry for coke (a zero entry) was included in Jerry’s order vector, and this is part a general technique that can often be meaningfully used to join vectors into a single matrix.  (In real-life applications of matrices you’ll often find matrices that are largely filled with zeros.)

Because the matrix is a rectangular arrangement, you can get a vector from a matrix by taking either a horizontal slice or a vertical slice.  You could look at the order matrix and extract a vertical slice for fries, and this slice shows all the orders for fries (Joe ordered 3 and Jerry ordered 1) independently of all the other products that were ordered.

It is also possible (and common) to consider a vector as a special case of a matrix.  A vector could look like a matrix with only a single row (such a vector is often called a row vector), or a vector could look like a matrix with only a single column (such a vector is often called a column vector).

If we look at our example of matrix multiplication above, and imagine that Joe was the only one putting in an order.  In that case, the order matrix would just be Joe’s order vector, and the totals matrix would similarly be restricted to Joe’s totals vector.  We could say that a row vector multiplied by a matrix gives us a row vector as a result.

Starting out again from the matrix multiplication shown above, we could imagine that we no longer cared about calorie and sodium information, and erased that from the menu information matrix.  Correspondingly, the totals matrix would no longer carry calorie and sodium totals, and would be reduced to a total price vector.  We could say that a matrix multiplied by a column vector gives us a column vector.

Vectors and matrices show up naturally in spreadsheets as well as in data base tables.  In addition, if you fill out any standard form, the collection of forms filled out by multiple people will yield a matrix.  There is no need for magic or terror when looking at matrices – they are a rather simple organizing tool for data.  Basic operations on matrices like addition and multiplication are relatively straightforward too, as we’ve seen in the example of pricing out an order.  It’s too bad that textbook treatments so often obscure the underlying simplicity of the ideas.

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