Matrix Multiplication
Key Terms
- Matrix product AB
- Defined only when the number of columns of A equals the number of rows of B.
- Dimensions
- An (m × n) matrix times an (n × p) matrix gives an (m × p) result.
- Entry (i, j) of AB
- The dot product of row i of A with column j of B.
- Non-commutativity
- In general AB ≠ BA; order of multiplication matters.
- Identity
- AI = IA = A for any matrix A compatible with the identity matrix I.
- Associativity
- (AB)C = A(BC) always holds; distributivity: A(B + C) = AB + AC.
Matrix Multiplication
(The number of columns in A must equal the number of rows in B.)
The result AB has order m×p.
Element formula: cij = (row i of A) · (column j of B) = ∑ aik bkj
Key Properties
| Property | Statement | Note |
|---|---|---|
| NOT commutative | AB ≠ BA (in general) | Order matters! |
| Associative | (AB)C = A(BC) | Always true |
| Distributive | A(B + C) = AB + AC | Always true |
| Identity | AI = IA = A | I is the identity matrix |
| Zero product | AB = O does NOT imply A = O or B = O | Matrices are unusual here |
Worked Example 1 — 2×2 by 2×2 Multiplication
Find AB where A =
| 3 | 1 |
| 2 | 4 |
| 2 | −1 |
| 0 | 3 |
A is 2×2, B is 2×2 → columns of A (2) = rows of B (2) ✓ → result is 2×2.
Calculate each element:
| Position | Calculation | Result |
|---|---|---|
| c11 | Row 1 of A · Col 1 of B = (3)(2) + (1)(0) | 6 + 0 = 6 |
| c12 | Row 1 of A · Col 2 of B = (3)(−1) + (1)(3) | −3 + 3 = 0 |
| c21 | Row 2 of A · Col 1 of B = (2)(2) + (4)(0) | 4 + 0 = 4 |
| c22 | Row 2 of A · Col 2 of B = (2)(−1) + (4)(3) | −2 + 12 = 10 |
AB =
| 6 | 0 |
| 4 | 10 |
Worked Example 2 — 2×3 by 3×2
Find AB where A =
| 1 | 2 | 0 |
| 3 | −1 | 4 |
| 2 | 5 |
| 1 | −3 |
| 4 | 0 |
A is 2×3, B is 3×2 → columns of A (3) = rows of B (3) ✓ → result AB is 2×2.
c11 = (1)(2) + (2)(1) + (0)(4) = 2 + 2 + 0 = 4
c12 = (1)(5) + (2)(−3) + (0)(0) = 5 − 6 + 0 = −1
c21 = (3)(2) + (−1)(1) + (4)(4) = 6 − 1 + 16 = 21
c22 = (3)(5) + (−1)(−3) + (4)(0) = 15 + 3 + 0 = 18
AB =
| 4 | −1 |
| 21 | 18 |
Full Lesson: Matrix Multiplication
Why Multiply Matrices This Way?
Matrix multiplication is designed to combine transformations. When you multiply a price row matrix by a quantity matrix, you get total costs. When you multiply transformation matrices in geometry, you combine multiple transformations into one. The row-by-column method is precisely what makes this work.
The Compatibility Rule
Before computing AB, check:
- Write out the orders: A is (m × n), B is (n × p)
- The inner dimensions must match (both must be n)
- The outer dimensions give the result order: m × p
Computing Each Element
Element cij in the product AB is found by:
- Taking row i from matrix A
- Taking column j from matrix B
- Multiplying corresponding entries and summing the results
This is called the dot product of a row and a column.
Why AB ≠ BA?
In ordinary numbers, 3 × 5 = 5 × 3. But for matrices, the row-column pairing changes completely when you swap the order. Even when both products are defined (e.g., two 2×2 matrices), the results are usually different. This is one of the most important differences between matrix algebra and ordinary algebra.
The Identity Matrix
The identity matrix I behaves like the number 1: AI = IA = A for any matrix A (provided dimensions are compatible). This is why I is called the “multiplicative identity” for matrices.
Mastery Practice
-
Fluency
For each matrix product below, state whether it is defined and, if so, give the order of the result.
- A is 2×3, B is 3×4. Is AB defined? What is its order?
- A is 2×2, B is 3×2. Is AB defined?
- A is 4×1, B is 1×3. Is AB defined? What is its order?
- A is 3×3, B is 3×1. Is AB defined? What is its order?
-
Fluency
Calculate AB where A =
and B =2 1 3 4 1 0 2 −1 Show all intermediate calculations.
-
Fluency
Calculate AB where A =
and B =3 −1 0 2 −1 4 2 1 -
Fluency
Let A =
and I =5 2 −1 3
.1 0 0 1 Calculate AI and IA and verify both equal A.
-
Understanding
Let A =
and B =1 2 3 4
.2 −1 0 3 Calculate AB and BA and show that AB ≠ BA.
-
Understanding
Let A =
, B =1 2 0 1
, C =2 0 1 1
.1 3 2 0 Calculate (AB)C and A(BC) and verify that they are equal (associative property).
-
Understanding
A shop sells three products. The unit prices (in dollars) are given by row matrix P = [4.50, 3.00, 6.00]. The quantity matrix for two orders is:
Q =
20 15 30 25 10 20 Rows = products 1, 2, 3. Columns = Orders A and B.
- State the orders of P and Q. Is PQ defined? What will the order of PQ be?
- Calculate PQ.
- Interpret each entry in PQ in the context of this problem.
-
Understanding
A message is encoded using the matrix E =
. The original message vector is m =2 5 1 3
.3 1 - Calculate the encoded message Em.
- The inverse of E is E−1 =
. Verify that E−1(Em) = m.3 −5 −1 2
-
Problem Solving
Let A =
.2 1 k 3 - Calculate A2 = A × A in terms of k.
- Recall that det(A2) = (det A)2. Find det(A) in terms of k.
- Find the value(s) of k such that det(A2) = 25.
-
Problem Solving
A manufacturer uses two types of parts to make two products. The resources (machine-hours and labour-hours) needed per part are given in matrix R:
R =
(rows = resource types: machine-hrs, labour-hrs, quality-hrs; columns = Part 1, Part 2)2 1 3 0 1 2 The parts required per product are given in matrix P:
P =
(rows = Part 1, Part 2; columns = Product A, Product B)4 2 1 3 - State the orders of R and P. Is RP defined? What is the order of RP?
- Calculate RP.
- Interpret the element in row 1, column 2 of RP in context.