Jonathan Jones jej1997 12
Week 2 Problem 2.2.27
http://twri.tamu.edu/~jjones/math311/2.2.27.html

> with(linalg[matrix]):

(2.2.27) To make a loaf of bread, the bakery uses 2 cups of flour and 1 cup of sugar. To make a pie, it uses 1 cup of flour and 3 cups of sugar. Sugar costs 3 cents per cup, flour costs 2 cents per cup. In addition, there is a sales tax of 1 cent per cup on both commodities. Show how to organize the facts into matrices, and find the matrix that should be used to calculate how much the bakery must pay the suppliers and how much it must pay the government if it buys ingredient s for bloaves of bread and ppies.

The cost of a taxable item is construed as a vector with two components: list price and tax. The price component is a multiple of the basis vector l, representing one cent of the item's list price. The tax component is a multiple of the basis vector t, representing one cent of the item's tax. That is, an item with a list price of $1, plus 8 cents tax, has a cost of 100l+ 8t. So, according to the problem statement, one cup of sugar costs s= 3l+ t, and one cup of flour costs f= 2l + t.

> s = matrix(1, 2, [3, 1]) &* matrix(2, 1, [l, t]); eq1 := %:
f = matrix(1, 2, [2, 1]) &* matrix(2, 1, [l, t]); eq2 := %:

[Maple Math]

[Maple Math]

The ingredients of a bakery good is construed as a vector with two components: flour and sugar. The flour component is a multiple of the basis vector f, representing one cup of the flour requirement. The sugar component is a multiple of the basis vector s, representing one cup of the sugar requirement. That is, a bakery good made with 2 cups of flour and 3 cups of sugar has a recipe of 2f+ 3s. So, according to the problem statement, the recipe for a loaf of bread is B = 2f+ s, and the recipe for a pie is P= f+ 3s.

> B = matrix(1, 2, [2, 1]) &* matrix(2, 1, [f, s]); eq3 := %:
P = matrix(1, 2, [1, 3]) &* matrix(2, 1, [f, s]); eq4 := %:

[Maple Math]

[Maple Math]

The total expense of a bakery is construed as a vector with two components: bread and pie. The bread component is a multiple of the basis vector B, representing the cost of baking one loaf of bread. The pie component is a multiple of the basis vector P, representing the cost of baking one pie. That is, a bakery that makes 100 loaves of bread and 50 pies incurs a total expense of 100B+ 50P. According to the problem statement, the bakery incurs an expense of E= bB+ pP.

> E = matrix(1, 2, [b, p]) &* matrix(2, 1, [B, P]); eq5 := %:

[Maple Math]

We're given the bakery's expenses in terms of the basis vectors Band P; we are interested in the bakery's expenses in terms of the basis vectors land t. We have a function for Ein terms of B and P; we have functions for Band Pin terms of fand s, and we have functions for fand sin terms of land t. The composition of these functions gives us Ein terms of land t.

Substituting the functions for Band Pinto the function for E, we get the following:

> subs({eq3, eq4}, eq5);

[Maple Math]

This is, by the definition of matrix multiplication, equivalent to the following:

> E = matrix(1, 2, [b, p]) &* (matrix(2, 2, [[2, 1], [1, 3]]) &* matrix(2, 1, [f, s])); eq6 := %:

[Maple Math]

We now substitute the functions for fand s:

> subs({eq1, eq2}, eq6);

[Maple Math]

Again applying the definition of matrix multiplication, we find the equivalent:

> E = matrix(1, 2, [b, p]) &* (matrix(2, 2, [[2, 1], [1, 3]]) &* (matrix(2, 2, [[2, 1], [3, 1]]) &* matrix(2, 1, [l, t])));

[Maple Math]

By the associative property of matrix multiplication, we can simplify thus:

> E = matrix(1, 2, [b, p]) &* matrix(2, 2, [[7, 3], [11, 4]]) &* matrix(2, 1, [l, t]);

[Maple Math]

The function for Ein terms of the basis vectors land tis

> E = evalm(matrix(1, 2, [b, p]) &* matrix(2, 2, [[7, 3], [11, 4]])) &* matrix(2, 1, [l, t]);

[Maple Math]

so that if the bakery bakes bloaves of bread and ppies, it incurs a total expense of

> evalm(%);

[Maple Math]

(7b+ 11p) cents owed to suppliers, and (3b+ 4p) cents owed to the government.