Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Matrix multiplication is a way to combine two arrays of numbers so that rows from the first matrix interact with columns from the second matrix. It is essential in algebra, computer graphics, data science, physics, engineering, and systems of equations. Unlike ordinary number multiplication, the order of matrix multiplication usually matters.

Learning the row-by-column rule helps you see exactly where each entry in the product comes from.

If A is an m by n matrix and B is an n by p matrix, then AB is defined and has size m by p. Each entry in AB is found by multiplying matching entries from one row of A and one column of B, then adding the products. This process is a dot product, so every output entry summarizes how one row matches one column.

Matrix multiplication is not commutative because AB and BA may have different sizes or different entries.

Key Facts

  • If A is m by n and B is n by p, then AB is defined and AB is m by p.
  • The entry in row i and column j of AB is (AB)ij = ai1b1j + ai2b2j + ... + ainbnj.
  • Row-by-column rule: use row i of A and column j of B to find entry (i, j) of AB.
  • Matrix multiplication is generally not commutative: AB is not usually equal to BA.
  • A 2 by 3 matrix times a 3 by 2 matrix produces a 2 by 2 matrix.
  • The identity matrix acts like 1 for matrices: AI = A and IA = A when the sizes match.

Vocabulary

Matrix
A matrix is a rectangular array of numbers arranged in rows and columns.
Entry
An entry is a single number in a matrix, identified by its row and column position.
Dimension
The dimension of a matrix is its number of rows by its number of columns.
Dot product
A dot product multiplies matching components of two lists and adds the results.
Identity matrix
An identity matrix is a square matrix with 1s on the main diagonal and 0s elsewhere.

Common Mistakes to Avoid

  • Multiplying entries in the same positions, because matrix multiplication is not entry-by-entry multiplication. Each product entry must come from a full row times a full column.
  • Ignoring matrix dimensions, because AB is only defined when the number of columns of A equals the number of rows of B. Always check the inner dimensions before multiplying.
  • Assuming AB = BA, because matrix multiplication is usually not commutative. Even when both products are defined, they can have different values.
  • Writing the product with the wrong size, because the outer dimensions determine the size of AB. If A is m by n and B is n by p, the result must be m by p.

Practice Questions

  1. 1 Let A = [[2, 1], [0, 3]] and B = [[4, 5], [6, 7]]. Compute AB.
  2. 2 Let A be a 2 by 3 matrix and B be a 3 by 4 matrix. What is the size of AB, and how many entries does it have?
  3. 3 Explain why matrix multiplication is not generally commutative, using either dimensions or a small example to support your reasoning.