Two different stores sell two different products – pens and pencils.
In store 1, pens sell for 30p and pencils sell for 20p.
In store 2, pens sell for 25 p and pencils sell for 22p.
We can represent this data in a two way table.
|
Pens |
Pencils |
Store 1 |
30 |
20 |
Store 2 |
25 |
22 |
Leaving out the first row and the first column gives us the cost matrix
Suppose that someone goes shopping for pens and pencils and wants to know the cheapest place to shop. They want to buy 4 pens and 5 pencils.
In store 1 they would pay 4*30+5*20=220p
In store 2 they would pay4*25+5*22=210p
Obviously store 2 is cheaper. We can do this calculation with matrices by representing the number of pens and pencils to be bought as a vector. Multiplying the cost matrix by this vector gives the costs of buying from the two stores.
This can be extended to any number of stores selling any number of products. If stores 1 and 2 sold rubbers at 10p and 15 p respectively, and store 3 sold pens at 24p, pencils at 30 and rubbers at 5p, the cost matrix would be
If a shopper wanted to buy 4 pens, 5 pencils and 6 rubbers, we would find
Store 3 is now the cheapest.