Why Multiply Matrices?

With a little practice, it is not too difficult to multiply two matrices. Add WolframAlpha or a graphing calculator to the mix…and you should blaze through the simplest problems. But what good is matrix multiplication?

The Mundo Candy Company makes three types of chocolate candy: Cheery Cherry, Mucho Mocha, and Almond Delight. The company produces its products in San Diego, Mexico City, and Managua using two main ingredients: chocolate and sugar.
Each kilogram of Cheery Cherry requires .5 kg of sugar and .2 kg of chocolate, each kilogram of Mucho Mocha requires .4 kg of sugar and .3 kg of chocolate; and each kilogram of Almond Delight requires .3 kg of sugar and .3 kg of chocolate. The cost of 1 kg of sugar is $4 in San Diego, $2 in Mexico City, and $1 in Managua. The cost of 1 kg of chocolate is $3 in San Diego, $5 in Mexico City, and $7 in Managua.Put the information above in a matrix in such a way that when you multiply the matrices, you get a matrix representing the ingredient cost of producing each type of candy in each city.

Start by putting the information in a matrix. There are two ingredients and three types of candy so we need either a 2 x 3 or 3 x 2. Either will be fine as long as we label the rows and columns. I choose to use a 2 x 3:

Because the product has to correspond to candy type and cities, the product must be a 3 x 3 matrix. To get this from the 2 x 3 above, we’ll need to multiply a 3 x 2 times the 2 x 3. Based on the information above, the rows must correspond to cities and the columns to ingredients:

Now let’s carry out the multiplication:

To get the entry in the second row, first column of the product we need to multiply the second row in the first matrix by the first column in the second matrix and add the results:

Other entries are calculated similarly. Since we are multiplying amounts of ingredients times cost per amount, the product is a total cost. How should we label the product?

so

Using these labels we can locate the cost of any of the three candies in each of the three cities. For instance, the cost of Cheery Cherry is Mexico City would be $2.

How Do You Solve An Application That Results In A Dependent System Of Equations?

Some of the most interesting problems to solve are problems that lead to a system of linear equations where there are more variables than equations. Typically, these systems have many possible equations. Figuring out which of those solutions make sense and which do not is challenging.

Here is one such example

A restaurant owner orders a replacement set of knives, fork, and spoons. The box arrives containing 40 utensils and weighing 141.3 ounces (ignoring the weight of the box). A knife, fork, and spoon weigh 3.9 ounces, 3.6 ounces, and 3.0 ounces, respectively.

How many knives, forks and spoons are in the box?

Since we are being asked to find the number of knives, forks, and spoons, let’s make the following designations:

K: number of knives

F: number of forks

S: number of spoons

The first thing to notice is that you are given a total number of utensils (40) and a total weight for the utensils (141.3 ounces). These are the prime candidates for writing out the equations.

Starting with

Total number of utensils = 40

It is fairly obvious that

K + F + S = 40

Starting with

Total weight of utensils = 141.3

We can deduce that the individual weights are

Weight of knives = 3.9 K

Weight of forks = 3.6 F

Weight of spoons = 3.0 S

So

3.9 K + 3.6 F + 3.0 S = 141.3

Now what? Your experience in these sections probably tells you that you need another equation in the three unknowns to be able to solve for K, F, and S. This is true if there is a unique solution to this problem. But this problem actually has many possible solutions (ie. There are many ways to have 40 utensils that weigh 141.3 ounces).

So let’s simply solve the problem as is with Gauss-Jordan elimination:

K + F + S = 40

3.9 K + 3.6 F + 3.0 S = 141.3

Start by converting this to an augmented matrix:

To put into row echelon form, let’s multiply the first row by -3.9 and add it to the second row. Put the result in row 2:

To make the first nonzero number in the second row a 1, multiply the entire row by 1/-0.3 and replace the second row with that result:

This is now in row echelon form. It is almost as if there was a third row in the matrix, but it is all zeros.

With one more row operation, we can put the system in reduced row echelon form.

Converting this back to a system of equations, we get

K – 2S = -9

F + 3S = 49

To get our solutions, the first equation for K and the second equation for F:

K = 2S – 9

F = -3S+49

This is pretty easy to do since the system was in reduced row echelon form.

The variable S can be any value that makes sense for the problem. For instance, we certainly know that S (the number of spoons) should be non-negative integers like S = 0, 1, 2, … If we make up a table, we can make some interesting observations:

We need the numbers of each type of utensil to be positive…to do that we’ll require the number of spoons to be S = 5, 6, 7, …, 16. So even though the system has an infinite number of solutions, only certain ones make sense. In other words, any ordered triple of the form (K, F, S) = (2S – 9, -3S + 49, S) as long as S is an integer from 5 to 16.

How Do I Find The Inverse Of A 2 x 2 Matrix?

Suppose the given square matrix is called A. To find the inverse of any matrix, we write the matrix in a larger matrix along side an identity matrix of the same size,

$latex \displaystyle \left[ \left. A\, \right|\,I \right]$

Now use row operations to rewrite this matrix so that the identity appears on the left side. The inverse of the original matrix will be on the right side of the transformed matrix,

$latex \displaystyle \left[ \left. I\, \right|\,{{A}^{-1}} \right]$

Continue reading “How Do I Find The Inverse Of A 2 x 2 Matrix?”

How Do You Solve a Linear System with WolframAlpha?

Many of you may already be familiar with using a graphing calculator to put a matrix in reduced row echelon form. Did you know that you can do the same thing with WolframAlpha?

To see how this is done, let’s start from the system of linear equations

wolframrref_03

Convert this system into a 3 x 4 augmented matrix:

wolframrref_04

WolframAlpha understands several commands for putting an augmented matrix into reduced row echelon form. You can use the command rref { }or the command row reduce { }. The matrix goes inside the curly brackets. However, the matrix must be put in carefully. Each row needs to be typed in inside of curly brackets with the entries separated by a commas. In this case, you would type

wolframrref_01

on the command line in WolframAlpha.

After you press Enter, the reduced row echelon form is computed,

wolframrref_02

This indicates that the solution to the system is

x = 65,000, y = 45,000, z = 40,000.

How Do You Find The Inverse Of A 2 x 2 Matrix?

Suppose the given square matrix is called A. To find the inverse of any matrix, we write the matrix in a larger matrix along side an identity matrix of the same size,

$latex \displaystyle \left[ \left. A\, \right|\,I \right]$

Now use row operations to rewrite this matrix so that the identity appears on the left side. The inverse of the original matrix will be on the right side of the transformed matrix,

$latex \displaystyle \left[ \left. I\, \right|\,{{A}^{-1}} \right]$

For instance, suppose we want to find the inverse of

$latex \displaystyle A=\left[ \begin{matrix}
2 & 2 \\
2 & 1 \\
\end{matrix} \right]$

Start with

$latex \displaystyle \left[ \left. \begin{matrix}
2 & 2 \\
2 & 1 \\
\end{matrix}\, \right|\,\begin{matrix}
1 & 0 \\
0 & 1 \\
\end{matrix} \right]$

$latex \displaystyle \frac{1}{2}{{R}_{1}}\to {{R}_{1}}$

$latex \displaystyle \left[ \left. \begin{matrix}
1 & 1 \\
2 & 1 \\
\end{matrix} \right|\begin{matrix}
\frac{1}{2} & 0 \\
0 & 1 \\
\end{matrix} \right]$

$latex \displaystyle -2{{R}_{1}}+{{R}_{2}}\to {{R}_{2}}$

$latex \displaystyle \left[ \left. \begin{matrix}
1 & 1 \\
0 & -1 \\
\end{matrix} \right|\begin{matrix}
\frac{1}{2} & 0 \\
-1 & 1 \\
\end{matrix} \right]$

$latex \displaystyle -1{{R}_{2}}\to {{R}_{2}}$

$latex \displaystyle \left[ \left. \begin{matrix}
1 & 1 \\
0 & 1 \\
\end{matrix} \right|\begin{matrix}
\frac{1}{2} & 0 \\
1 & -1 \\
\end{matrix} \right]$

$latex \displaystyle -1{{R}_{2}}+{{R}_{1}}\to {{R}_{1}}$

$latex \displaystyle \left[ \left. \begin{matrix}
1 & 0 \\
0 & 1 \\
\end{matrix} \right|\begin{matrix}
-\frac{1}{2} & 1 \\
1 & -1 \\
\end{matrix} \right]$

Let’s apply this strategy to finding a few more inverses.

Problem 1 Find the inverse of

$latex \displaystyle \left[ \begin{matrix}
2 & 4 \\
2 & 5 \\
\end{matrix} \right]$

m152_inv_matrix_2

m152_inv_matrix_2b

Problem 2 Find the inverse of

$latex \displaystyle \left[ \begin{matrix}
1 & 3 \\
2 & 7 \\
\end{matrix} \right]$

m152_inv_matrix_3