JentooACT®

ACT® · Math: Number and Quantity

Matrix Multiplication

Matrix multiplication pairs each row of the first matrix with each column of the second, multiplying matching entries and adding them into one number. The product only exists when the first matrix's column count matches the second matrix's row count.

Matrix multiplication is not entry-by-entry like matrix addition. It pairs a whole row against a whole column because each entry in the answer is meant to represent a combined total, like a total cost or a total distance, built from several matching parts added together. Row 2 of A sweeps across column 1 of B: multiply the first entries, multiply the second entries, and add those products into a single number. That number lands in row 2, column 1 of the product. Every entry in the product gets built the same way, from some row of A and some column of B.

This row-column pairing is also why dimensions matter so much. For a row of A to pair fully against a column of B, they need the same number of entries, which means A's number of columns must equal B's number of rows. If A is m by n and B is n by p, the product AB exists and comes out m by p: the outer dimensions survive, the matching inner dimensions disappear. Swap the order and B's columns may no longer match A's rows at all, so BA can fail to exist even when AB works fine. Even when both products exist, they are built from different row-column pairings, so AB and BA are generally different matrices entirely.

This topic sits next to vectors and complex numbers in the same cluster: all three ask you to treat a structured object, not just a single number, as one unit of arithmetic. Matrix multiplication shows up again quickly as a way to represent real totals, like multiplying a row of quantities by a column of prices.

Key terms

Matrix product
The matrix formed by pairing each row of the first matrix with each column of the second.
Dot product pairing
Multiplying matching entries from a row and a column, then adding those products into one number.
Dimensions
The number of rows by the number of columns describing a matrix's shape, written rows by columns.
Inner and outer dimensions
In an m by n times n by p product, the inner n's must match to exist, and the outer m, p give the product's shape.

Watch it explained

  1. How it worksHow does one row sweeping across one column collapse into a single number in the product?
  2. How it worksHow do the dimensions of two matrices decide whether their product exists at all?
  3. Worked exampleWalk me through multiplying [[1, 2], [3, 0]] by [[4, -1], [2, 5]] one cell at a time.
  4. Worked exampleFind the total cost when a 1 by 3 quantity matrix multiplies a 3 by 1 price matrix.
  5. Common mistakeWhy isn't AB the same as BA once you are multiplying matrices instead of numbers?

Check yourself

Your turnmedium1 of 3
A = [[7, 2], [9, 3]] and B = [[2, -3], [5, 2]]. What is the entry in row 2, column 1 of AB?

End of topic.