Skip to lesson

Math · Linear Algebra

Chapter 3: Matrix Algebra

Matrix Multiplication

Doing one transformation, then another.

Lesson
2
Time
About 24 minutes
0 of 12 done

Step 1: Let's Learn

Read it, or press Listen and follow the words.

The product AB means: apply B first, then A. Matrix multiplication is the composition of two transformations.

Read right to left

The rightmost matrix acts first. This matches function notation, where f(g(x)) applies g before f.

The mechanical rule

The entry in row i, column j is row i of A dotted with column j of B.

Sizes

An m by n times an n by p gives an m by p. The inner numbers must match and then disappear.

Order matters

AB and BA are usually different matrices. Rotating then stretching is not the same as stretching then rotating.

The identity

The identity matrix has ones on the diagonal and zeros elsewhere. It leaves every vector exactly where it was.

Multiplication composes transformations

AB means apply B first, then A. Matrix multiplication was defined to make that true, which is why its rule looks arbitrary until you know what it is for.

Order matters

AB and BA are generally different and one may not even be defined. Non-commutativity follows from composition: rotating then reflecting differs from reflecting then rotating.

Inner dimensions must agree

An m by n times an n by p gives an m by p. The inner numbers must match and the outer ones survive, which is a quick check before any arithmetic.

Column by column

Each column of AB is A times the corresponding column of B. Computing that way is often clearer than entry by entry, and it keeps the transformation picture in view.

Step 2: Try It Yourself

Tap and try it out.

Set a shear, then a rotation, and note where the arrows land. Swap the order and compare: the results differ.
ijv
  • i-hat lands on(1, 0)
  • j-hat lands on(1, 1)
  • Determinant1
  • v lands on(3, 1)

The shaded parallelogram is the image of the unit square, and its area is 1. That is exactly what the determinant measures.

Step 3: Watch an Example

One step at a time.

Watch Ade Multiply Two Matrices

Ade computes AB where A has rows [1, 2] and [0, 1], and B has rows [3, 0] and [1, 4].

  1. Step 1

    He dots row 1 of A with column 1 of B: 1(3) + 2(1) = 5.

Step 4: Your Turn

Practice makes it stick.

The Shape

Problem 1 of 2

A 2 by 3 matrix times a 3 by 5 matrix. How many columns does the product have?

The Identity

Problem 2 of 2

A times the identity matrix. Is the result A? 1 yes, 0 no.

Compose Them

1 of 8

Row 1 of A is [2, 0] and column 1 of B is ⟨3, 7⟩. What is the entry in row 1, column 1 of AB?

2 of 8

A 3 by 2 times a 2 by 4. How many rows does the product have?

3 of 8

A 3 by 2 times a 4 by 2. Is the product defined? 1 yes, 0 no.

4 of 8

Is AB always equal to BA? 1 yes, 0 no.

5 of 8

In AB, which matrix acts on a vector first? Enter 1 for A, 2 for B.

6 of 8

The 3 by 3 identity matrix. How many ones does it contain?

7 of 8

Order the steps for computing one entry of a matrix product.

  1. 1Take the row of A matching the entry position
  2. 2Take the column of B matching the entry position
  3. 3Dot them together
  4. 4Check the inner dimensions agree

8 of 8

A 4 by 4 matrix times a 4 by 4 matrix. How many entries does the product have?

Step 5: Quick Check

Show what you know.

Question 1 of 2

A 5 by 2 times a 2 by 3. How many columns does the product have?

Question 2 of 2

What does the product AB mean?

What You Learned

  • AB means apply B first, then A, so matrix multiplication is composition.
  • The entry in row i, column j is row i of A dotted with column j of B.
  • AB and BA are usually different, because doing two things in the other order gives another result.