StudyVisuallyStart studying
Part 08 · Vectors, matrices and linear systems · Card 5 of 9

Matrix multiplication

Each entry of the product is a row of the first matrix dotted with a column of the second. The first matrix's columns must equal the second's rows.

Last updated

Analogy

A school timetable lookup: row of lessons matched against a column of rooms.

Example

[[1,2],[3,4]] times [[0,1],[1,0]]

Row 1 dot col 1: 1(0) + 2(1) = 2.Row 1 dot col 2: 1(1) + 2(0) = 1.Row 2: 3(0) + 4(1) = 4; 3(1) + 4(0) = 3.Result [[2,1],[4,3]].

In practice

Combines transformations, such as rotate then scale, into a single matrix.

Practice

Flashcards

  • What size is the product of a 2 by 3 and a 3 by 4 matrix?2 by 4.
  • Is AB always equal to BA for matrices?No. Matrix multiplication is not commutative.

Questions people ask

Is matrix multiplication commutative?

No. In general AB and BA differ. Using the example, A times B gives [[2,1],[4,3]], while B times A gives [[3,4],[1,2]]. The order matters, and one of the products may not even exist when the sizes do not match. Reversing the order of a product is a mistake that costs marks.

When can I multiply two matrices?

The number of columns in the first matrix must equal the number of rows in the second. A 2 by 3 matrix times a 3 by 4 matrix works and gives a 2 by 4 matrix. A 2 by 3 times a 2 by 3 does not work. Check this size rule first, before doing any arithmetic.