Matrix multiplication is the first matrix operation that feels different from the basic arithmetic in the previous note. Addition, subtraction, and scalar multiplication all work entry by entry. Matrix multiplication does not.
Instead, each output entry is built by pairing:
- one row from the left matrix, and
- one column from the right matrix.
That is why the size rule is stricter here.
Intuition first: the middle size has to agree
Suppose is and is . Then the product AB is defined,
and the result has size .
The inner number n appears twice because the n entries in a row of must
have exactly n partners in a column of . If those counts do not agree,
there is no row-by-column pairing to carry out.
So the beginner's size rule is:
The inside sizes must match.
Definition
Definition
Matrix multiplication
Suppose is an matrix and is an matrix. The product
AB is the matrix whose (i, j) entry is
In words: take row i of , take column j of , multiply matching
entries, then add the results.
What one entry really means
It is easy to get lost in the notation, so slow the rule down.
To compute :
- Go to row 2 of .
- Go to column 3 of .
- Multiply entry by entry.
- Add the products.
That means one output entry is a compact summary of several multiplications and one final addition.
Embedded interactive moment
Use the visualizer below to keep one output cell fixed while you change the input entries. This is the quickest way to build the row-by-column habit.
Read and try
Follow one matrix product entry
The live widget updates each entry of AB as you change the entries of A and B.
Result
| 8 | 9 |
| 3 | 4 |
8 = 1×2 + 2×3
Worked example
Worked example
Compute a product by the row-by-column rule
Let
Then AB is . Compute each entry:
So
Why this connects to linear systems
You have already seen systems written as .
That formula is not just shorter notation. It tells you that matrix
multiplication packages several linear equations into one object. Each row of
creates one equation by pairing that row with the column vector x.
If
then
So really means a full system of linear equations, one row at a time.
Theorem
The product order matters
Even when both AB and BA are defined, they usually are not equal.
This is a major change from ordinary number multiplication. With matrices, order carries meaning.
Common mistakes
Common mistake
Checking the wrong dimensions
For AB, compare the number of columns of with the number of rows of .
Do not compare the outside numbers first.
Common mistake
Multiplying rows by rows
The rule is row of against column of , not row against row.
Common mistake
Matrix multiplication is generally not commutative. Two products with the same letters can represent different computations or even have different sizes.
Quick checks
Quick check
If is and is , what is the size of AB?
Use the inside-match, outside-survive rule.
Solution
Answer
Quick check
Why does represent several equations at once?
Use the word "rows" in your answer.
Solution
Answer
Exercises
Quick check
Suppose is and is . Is BA defined? If so, what size would it have?
Do not guess from the fact that AB is defined.
Solution
Guided solution
Quick check
Write the first entry of Ax when the first row of is and .
Use the row-by-column rule.
Solution
Guided solution
Related notes
Review 2.2 Augmented matrices and row operations if you want to reconnect with the matrix form of a linear system.
Continue to 3.3 Transposes, symmetric matrices, and skew-symmetric matrices for the next important matrix operation.