Mathematics Topic

Multiplying Matrices

  1. Read notes
  2. Flashcards
  3. Quiz
  4. Confident

Study focus - 3 things

  1. Two matrices can be multiplied only when the number of columns in the first equals the number of rows in the second
  2. Each entry of the product is a row of the first matrix multiplied, entry by entry, with a column of the second, and the products added
  3. Order matters: AB and BA are usually different, and one of them may not exist at all

Section 1When can two matrices be multiplied?

To multiply A by B (written AB), the number of columns of A must equal the number of rows of B. Matrices that pass this test, in this order, are called conformable. A 2 by 3 matrix can be multiplied by a 3 by 4 matrix, but not by a 2 by 3 matrix. Orders up to 4 by 4 can appear in the syllabus; for a pair such as 4 by 3 and 3 by 4 this topic only asks whether the product exists and what its order is, and all the hand calculations here use 2 by 2, 2 by 3, 3 by 2 and 3 by 3 matrices.

Section 2The order of the product

If A is m by n and B is n by p, then AB is m by p: it keeps the number of rows of A and the number of columns of B, and the two matching n's disappear. A 2 by 3 matrix times a 3 by 4 matrix gives a 2 by 4 matrix. A 3 by 2 matrix times a 2 by 3 matrix gives a 3 by 3 matrix. Work out the order before you start, so you know how many entries to find.

Section 3Row times column

To find the entry in row i, column j of AB, take row i of A and column j of B. Multiply the first entry of the row by the first entry of the column, the second by the second, and so on, then add all the products. For [[1, 2]] times [[3], [4]] the single entry is 1 x 3 + 2 x 4 = 11, so the product is [[11]]. This is not the same as multiplying matching entries and keeping them separate.

Section 4A 2 by 2 pattern

For two 2 by 2 matrices, [[a, b], [c, d]] times [[e, f], [g, h]] equals [[ae + bg, af + bh], [ce + dg, cf + dh]]. The top row of the answer uses the top row of the first matrix, and the left column of the answer uses the left column of the second matrix. For larger orders the idea is the same: every entry is one row times one column, with as many products as the row has entries.

Section 5Order matters

Multiplication of matrices is not commutative: even when both AB and BA exist, they are usually different. For A = [[1, 2], [3, 4]] and B = [[0, 1], [1, 0]], AB = [[2, 1], [4, 3]] but BA = [[3, 4], [1, 2]]. Sometimes only one product exists: a 2 by 3 matrix times a 3 by 1 matrix works, but the 3 by 1 matrix times the 2 by 3 matrix does not, since 1 is not 2. Even when both exist they can have different orders: a 2 by 3 times a 3 by 2 is 2 by 2, but the other way round is 3 by 3.

Section 6The identity matrix and A squared

Multiplying by an identity matrix of the right order changes nothing: IA = A and AI = A. For a 2 by 3 matrix A, use the 2 by 2 identity on the left and the 3 by 3 identity on the right. A squared means A x A, and it exists only when A is square (so that columns equal rows). To find A squared, multiply A by itself row times column, which is not the same as squaring each entry.

Examples

A = [[3, 1], [2, 4]] and B = [[1, 5], [0, 2]]. Find AB and BA, and say whether AB = BA.

Both matrices are 2 by 2, so both products exist and are 2 by 2. For AB use rows of A with columns of B. Row 1 of A is (3, 1): with column 1 of B, (1, 0), the entry is 3 x 1 + 1 x 0 = 3; with column 2 of B, (5, 2), it is 3 x 5 + 1 x 2 = 17. Row 2 of A is (2, 4): 2 x 1 + 4 x 0 = 2 and 2 x 5 + 4 x 2 = 18. So AB = [[3, 17], [2, 18]]. For BA use rows of B with columns of A. Row 1 of B is (1, 5): 1 x 3 + 5 x 2 = 13 and 1 x 1 + 5 x 4 = 21. Row 2 of B is (0, 2): 0 x 3 + 2 x 2 = 4 and 0 x 1 + 2 x 4 = 8. So BA = [[13, 21], [4, 8]]. Since [[3, 17], [2, 18]] is not equal to [[13, 21], [4, 8]], AB is not equal to BA.

C = [[2, -1, 0], [1, 3, 4]] and D = [[1, 2], [0, -3], [5, 1]]. (a) State the order of C and D and whether CD and DC exist. (b) Find CD. (c) Find DC. (d) Compare the orders of CD and DC.

(a) C is 2 by 3 and D is 3 by 2. For CD the columns of C (3) equal the rows of D (3), so CD exists and has order 2 by 2. For DC the columns of D (2) equal the rows of C (2), so DC exists and has order 3 by 3. (b) Row 1 of C is (2, -1, 0) and row 2 is (1, 3, 4); column 1 of D is (1, 0, 5) and column 2 is (2, -3, 1). Then 2 x 1 + (-1) x 0 + 0 x 5 = 2, 2 x 2 + (-1) x (-3) + 0 x 1 = 7, 1 x 1 + 3 x 0 + 4 x 5 = 21, and 1 x 2 + 3 x (-3) + 4 x 1 = -3. So CD = [[2, 7], [21, -3]]. (c) Rows of D are (1, 2), (0, -3), (5, 1); columns of C are (2, 1), (-1, 3), (0, 4). Row 1: 1 x 2 + 2 x 1 = 4, 1 x (-1) + 2 x 3 = 5, 1 x 0 + 2 x 4 = 8. Row 2: 0 x 2 + (-3) x 1 = -3, 0 x (-1) + (-3) x 3 = -9, 0 x 0 + (-3) x 4 = -12. Row 3: 5 x 2 + 1 x 1 = 11, 5 x (-1) + 1 x 3 = -2, 5 x 0 + 1 x 4 = 4. So DC = [[4, 5, 8], [-3, -9, -12], [11, -2, 4]]. (d) CD is 2 by 2 and DC is 3 by 3, so even though both exist they cannot be equal, because matrices of different orders are never equal.

Now let's water it

Session runs notes to flashcards to quiz back-to-back.

Where this comes from