## 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

## 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

Convert this system into a 3 x 4 augmented matrix:

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

on the command line in WolframAlpha.

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

This indicates that the solution to the system is

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

## How Does Elimination Compare to Matrix Elimination?

You probably noticed that the process we used to solve linear systems in Section 2.2 is almost identical to the process we used to solve linear systems in Section 2.4.

To make this concrete, let’s compare the steps for the system

In the table below, the steps for solving the system using elimination are shown on the left side in blue. The steps for matrix elimination are shown on the right in green. You can click on the table to make it larger.

Notice that each step for elimination corresponds to an almost identical step in matrix elimination. The main difference is the absence of the variable in matrix elimination.