Math 141: Business Mathematics I Fall 2015 §2.5 Multiplication of Matrices Instructor: Yeong-Chyuan Chung Outline • Another matrix operation - multiplication • Representing and interpreting data using matrices Multiplication of Matrices In this section, we will learn how to multiply a matrix by another matrix. Recall from the previous section that addition, subtraction, and scalar multiplication are done entrywise. However, multiplication of matrices is not done entrywise. It turns out that when we are dealing with data matrices, entrywise multiplication often does not give us the information we are looking for. Given two matrices A and B, we write AB for the matrix A × B. To multiply two matrices, the number of columns in the first (or left) matrix must be the same as the number of rows in the second (or right) matrix. The resulting matrix will have the same number of rows as the first matrix, and the same number of columns as the second matrix. In other words, if A is an m × n matrix, and B is an n × p matrix, then AB is an m × p matrix. 7 1 2 3 Example. If A = and B = 8, then the product AB is defined because A has 4 5 6 9 3 columns, and B has 3 rows. The matrix AB will have 2 rows and 1 column. On the other hand, BA is undefined because B has 1 column while A has 2 rows. From the example, we also see that unlike multiplication of numbers, the order is important when we multiply matrices. We will see that in general, AB 6= BA even when both AB and BA are defined. Most of the other multiplication rules for numbers still apply. For example, A(BC) = (AB)C, and A(B + C) = AB + AC. 1 §2.5 Multiplication of Matrices 2 1 2 3 2 4 Example. Let A = ,B= , and let C be some unspecified 3 × 2 matrix. 4 5 6 6 8 Which of the following products are defined? For those that are defined, what are their sizes? 1. AB 2. BA 3. A2 4. B 2 5. CA The entry in the ith row and jth column of AB depends only on the ith row of A and the jth column of B. The schematic diagram looks something like this: 1 2 3 2 1 Example. Let A = and B = . Compute AB. 3 1 6 5 4 §2.5 Multiplication of Matrices 3 Example. Compute the products −1 2 3 1 Observe that we interchanged the two 1 Example. Compute the products 0 2 4 2 4 −1 2 and . 3 1 3 1 3 1 matrices, and we got two different products. 0 2 4 2 4 1 0 and . 1 6 8 6 8 0 1 An n × n matrix with 1’s along the diagonal and 0’s everywhere else (like the one in the example above) is called the identity matrix. We sometimes write In for this matrix (so the one above can be written as I2 ). Recall that in the notes for §2.3, you were told how to enter matrices into your graphing calculator, and how to call them up after that. So you can use your calculator to compute sums/differences/products of matrices. (Sometimes, it is faster to just compute by hand.) §2.5 Multiplication of Matrices 4 Representing and Interpreting Data using Matrices Example (Exercise 50 in the text). Laura is planning to buy two 5-lb bags of sugar, three 5-lb bags of flour, two 1-gal cartons of milk, and three 1-dozen cartons of large eggs. The prices of these items in three neighborhood supermarkets are as follows: Sugar (5-lb bag) Supermarket I $3.15 Supermarket II $2.99 Supermarket III $3.74 Flour (5-lb bag) $3.79 $2.89 $2.98 Milk (1-gal carton) Eggs (1-dozen carton) $2.99 $3.49 $2.79 $3.29 $2.89 $2.99 (a) Write a 3 × 4 matrix A to represent the prices of the items in the three supermarkets. (b) Write a 4 × 1 matrix B to represent the quantities of the items that Laura plans to purchase in the three supermarkets. (c) Find a matrix C, in terms of A and B, that represents Laura’s outlay at each supermarket. At which supermarket should she make her purchase if she wants to minimize her cost? (Assume that she will shop at only one supermarket.) §2.5 Multiplication of Matrices 5 Example (Exercise 63 in the text). A dietician plans a meal around three foods. The number of units of vitamin A, vitamin C, and calcium in each ounce of these foods is represented by the matrix M , where The matrices A and B represent the amount of each food (in ounces) consumed by a girl at two different meals, where Calculate the following matrices, and explain the meaning of the entries in each matrix. (a) M AT (b) M B T (c) M (A + B)T .