Educerie

Educerie · AP · Precalculus

Unit 4 Functions Involving Parameters, Vectors, and Matrices · 4.10 Matrices

This unit is not on the AP exam. The exam covers Units 1 to 3 only; Unit 4 is taught here for the course and for what comes after it.

Big ideas: A matrix as a rectangular array that stores a table of numbers; multiplication as rows meeting columns; why the order of a product matters.

Where it is examined: Not on the AP Precalculus exam. The College Board lists Unit 4 as an additional topic available to schools. If your school teaches it, the work is multiplying matrices by hand and with a graphing calculator, and using products in a context.

The question this unit answers: How can we combine two tables of numbers so that the result is another useful table?


AP Precalculus 4.10

Matrices

How can we combine two tables of numbers so that the result is another useful table?

What you will learn

  • Understand a matrix as rows by columns and when a product exists
  • Know that each entry of a product is a row-times-column sum
  • Know that matrix multiplication depends on order

You must be able to

  1. State the size of a matrix and of a product
  2. Multiply two matrices by hand and with a calculator
  3. Show that AB and BA usually differ
  4. Multiply a matrix by a column vector
  5. Use a matrix product to total quantities times prices
  6. Check the inner sizes before multiplying

1What a matrix is

A matrix is an array. Its size is given as rows by columns.

An n×mn \times m matrix has nn rows and mm columns. Rows come first.

Example: this is a 2×32 \times 3 matrix, with 2 rows and 3 columns.

[102−131]\begin{bmatrix} 1 & 0 & 2 \\ -1 & 3 & 1 \end{bmatrix}

Each number is an entry or component. The entry in the iith row and the jjth column is the (i,j)(i, j) entry. Here the (2,1)(2, 1) entry is −1-1.

A vector in the plane can be written as a 2×12 \times 1 matrix, a single column:

[3−2]\begin{bmatrix} 3 \\ -2 \end{bmatrix}

A square matrix has the same number of rows and columns. A 2×22 \times 2 matrix is the most common case in this unit.

2When can two matrices be multiplied?

Two matrices AA and BB can be multiplied, in the order ABAB, only if the number of columns of AA equals the number of rows of BB.

The product has the number of rows of AA and the number of columns of BB.

(n×m) (m×p)=(n×p)(n \times m)\,(m \times p) = (n \times p)

The two middle numbers must match. They disappear. The two outer numbers give the size of the product.

AABBCan you form ABAB?Size of ABAB
2×22 \times 22×22 \times 2yes2×22 \times 2
2×32 \times 33×23 \times 2yes2×22 \times 2
2×32 \times 32×32 \times 3no (3 does not equal 2)none
2×22 \times 22×12 \times 1yes2×12 \times 1

3How to multiply

Each entry of the product is a dot product.

The entry in row ii, column jj of ABAB is the dot product of row ii of AA with column jj of BB.

Worked example 1. Let A=[2103]A = \begin{bmatrix} 2 & 1 \\ 0 & 3 \end{bmatrix} and B=[142−1]B = \begin{bmatrix} 1 & 4 \\ 2 & -1 \end{bmatrix}. Find ABAB.

Work through each entry.

  • Row 1 of AA with column 1 of BB: 2(1)+1(2)=42(1) + 1(2) = 4.
  • Row 1 of AA with column 2 of BB: 2(4)+1(−1)=72(4) + 1(-1) = 7.
  • Row 2 of AA with column 1 of BB: 0(1)+3(2)=60(1) + 3(2) = 6.
  • Row 2 of AA with column 2 of BB: 0(4)+3(−1)=−30(4) + 3(-1) = -3.
AB=[476−3]AB = \begin{bmatrix} 4 & 7 \\ 6 & -3 \end{bmatrix}

Check the size: 2×22 \times 2 times 2×22 \times 2 is 2×22 \times 2.

Worked example 2. A product of different shapes. Let C=[102−131]C = \begin{bmatrix} 1 & 0 & 2 \\ -1 & 3 & 1 \end{bmatrix} (2×32 \times 3) and D=[2104−31]D = \begin{bmatrix} 2 & 1 \\ 0 & 4 \\ -3 & 1 \end{bmatrix} (3×23 \times 2).

The columns of CC (3) equal the rows of DD (3), so CDCD exists and is 2×22 \times 2.

  • Row 1 with column 1: 1(2)+0(0)+2(−3)=−41(2) + 0(0) + 2(-3) = -4.
  • Row 1 with column 2: 1(1)+0(4)+2(1)=31(1) + 0(4) + 2(1) = 3.
  • Row 2 with column 1: −1(2)+3(0)+1(−3)=−5-1(2) + 3(0) + 1(-3) = -5.
  • Row 2 with column 2: −1(1)+3(4)+1(1)=12-1(1) + 3(4) + 1(1) = 12.
CD=[−43−512]CD = \begin{bmatrix} -4 & 3 \\ -5 & 12 \end{bmatrix}

The product DCDC also exists, but it is 3×33 \times 3. So CDCD and DCDC are different sizes.

4Order matters

For numbers, 2×3=3×22 \times 3 = 3 \times 2. For matrices, ABAB and BABA are usually not equal.

Use the AA and BB of Worked example 1 and multiply in the other order:

  • Row 1 of BB with column 1 of AA: 1(2)+4(0)=21(2) + 4(0) = 2.
  • Row 1 of BB with column 2 of AA: 1(1)+4(3)=131(1) + 4(3) = 13.
  • Row 2 of BB with column 1 of AA: 2(2)+(−1)(0)=42(2) + (-1)(0) = 4.
  • Row 2 of BB with column 2 of AA: 2(1)+(−1)(3)=−12(1) + (-1)(3) = -1.
BA=[2134−1]BA = \begin{bmatrix} 2 & 13 \\ 4 & -1 \end{bmatrix}

This is not AB=[476−3]AB = \begin{bmatrix} 4 & 7 \\ 6 & -3 \end{bmatrix}. Two matrices of the same size usually have two different products.

Say "multiply AA by BB" or write ABAB carefully. The first matrix is on the left.

5A matrix times a vector

A vector written as a column is a 2×12 \times 1 matrix, so a 2×22 \times 2 matrix can multiply it. The result is another 2×12 \times 1 column.

[abcd][xy]=[ax+bycx+dy]\begin{bmatrix} a & b \\ c & d \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} ax + by \\ cx + dy \end{bmatrix}

Each entry is a dot product of a row with the vector.

Example: [2103][5−2]=[10−20−6]=[8−6]\begin{bmatrix} 2 & 1 \\ 0 & 3 \end{bmatrix}\begin{bmatrix} 5 \\ -2 \end{bmatrix} = \begin{bmatrix} 10 - 2 \\ 0 - 6 \end{bmatrix} = \begin{bmatrix} 8 \\ -6 \end{bmatrix}.

This is the key step for Topic 4.12, where a matrix turns a vector into a new vector.

6A product in context

Matrices turn a table of quantities and a table of prices into a table of totals.

Example (invented): two shops sell sandwiches and drinks. The first column of the table gives sandwiches sold in a day, and the second gives drinks.

S=[20301525]S = \begin{bmatrix} 20 & 30 \\ 15 & 25 \end{bmatrix}

Row 1 is shop A and row 2 is shop B. A sandwich costs $4.50\$4.50 and a drink costs $2.00\$2.00. The price is a column vector:

P=[4.502.00]P = \begin{bmatrix} 4.50 \\ 2.00 \end{bmatrix}

Then SPSP gives the takings for each shop:

SP=[20(4.50)+30(2.00)15(4.50)+25(2.00)]=[150117.50]SP = \begin{bmatrix} 20(4.50) + 30(2.00) \\ 15(4.50) + 25(2.00) \end{bmatrix} = \begin{bmatrix} 150 \\ 117.50 \end{bmatrix}

Shop A takes $150\$150 and shop B takes $117.50\$117.50. The rows of SS are shops, and the rows of the answer are shops too. The columns of SS are products, and the rows of PP are products, so they match.

That match is what makes the product meaningful. Before you multiply, check that the "inner" quantities are the same kind of thing.

7Using a calculator

A graphing calculator stores matrices and multiplies them.

  • Enter each matrix by giving its size, then its entries, one row at a time.
  • Multiply with the multiplication sign between the two named matrices.
  • A "dimension mismatch" error means the columns of the first do not equal the rows of the second.
  • Check the order. A×BA \times B is not the same as B×AB \times A.

Do one entry by hand to confirm a calculator result.