Matrix Multiplication — Solutions
-
Fluency
For each part, check whether AB is defined by matching inner dimensions, then state the order of the result.
(a) A is 2×3, B is 3×4. Inner dimensions: 3 = 3 ✓. AB is defined and has order 2×4.
(b) A is 2×2, B is 3×2. Inner dimensions: 2 ≠ 3. AB is not defined.
(c) A is 4×1, B is 1×3. Inner dimensions: 1 = 1 ✓. AB is defined and has order 4×3.
(d) A is 3×3, B is 3×1. Inner dimensions: 3 = 3 ✓. AB is defined and has order 3×1.
-
Fluency
A is 2×2, B is 2×2 → AB is defined and will be 2×2.
c11 = (2)(1) + (1)(2) = 2 + 2 = 4
c12 = (2)(0) + (1)(−1) = 0 − 1 = −1
c21 = (3)(1) + (4)(2) = 3 + 8 = 11
c22 = (3)(0) + (4)(−1) = 0 − 4 = −4
AB =
4 −1 11 −4 -
Fluency
A is 2×3, B is 3×1 → AB is defined and will be 2×1.
c11 = (1)(2) + (2)(1) + (3)(3) = 2 + 2 + 9 = 13
c21 = (0)(2) + (1)(1) + (2)(3) = 0 + 1 + 6 = 7
AB =
13 7 -
Fluency
A =
, I =5 −2 1 3 1 0 0 1 AI:
c11 = (5)(1) + (−2)(0) = 5, c12 = (5)(0) + (−2)(1) = −2
c21 = (1)(1) + (3)(0) = 1, c22 = (1)(0) + (3)(1) = 3
AI =
= A ✓5 −2 1 3 IA:
c11 = (1)(5) + (0)(1) = 5, c12 = (1)(−2) + (0)(3) = −2
c21 = (0)(5) + (1)(1) = 1, c22 = (0)(−2) + (1)(3) = 3
IA =
= A ✓5 −2 1 3 Both AI and IA equal A, confirming the identity matrix property.
-
Understanding
Calculate AB:
c11 = (1)(2) + (2)(0) = 2, c12 = (1)(−1) + (2)(3) = −1 + 6 = 5
c21 = (3)(2) + (4)(0) = 6, c22 = (3)(−1) + (4)(3) = −3 + 12 = 9
AB =
2 5 6 9 Calculate BA:
c11 = (2)(1) + (0)(3) = 2, c12 = (2)(2) + (0)(4) = 4
c21 = (1)(1) + (3)(3) = 1 + 9 = 10, c22 = (1)(2) + (3)(4) = 2 + 12 = 14
BA =
2 4 10 14 Comparing: AB has entries (2, 5, 6, 9) while BA has entries (2, 4, 10, 14). Since the (1,2) elements differ (5 ≠ 4), AB ≠ BA. This confirms that matrix multiplication is not commutative.
-
Understanding
Use Q (3×3) and P (3×1, price column matrix). The product QP will be a 3×1 column matrix of daily revenues.
Q =
, P =12 8 15 20 14 18 5 9 11 25 40 15 Row 1 (Product A revenue): 12×25 + 8×40 + 15×15 = 300 + 320 + 225 = $845
Row 2 (Product B revenue): 20×25 + 14×40 + 18×15 = 500 + 560 + 270 = $1330
Row 3 (Product C revenue): 5×25 + 9×40 + 11×15 = 125 + 360 + 165 = $650
QP =
845 1330 650 Interpretation: Product A generated $845 total revenue across Mon–Wed; Product B generated $1330; Product C generated $650.
-
Understanding
A is 3×2, B is 2×2 → AB is defined and will be 3×2.
Row 1 of A = [2, −1], Row 2 = [0, 3], Row 3 = [1, 2]
Col 1 of B = [1, 2], Col 2 = [4, −1]
c11 = (2)(1) + (−1)(2) = 2 − 2 = 0
c12 = (2)(4) + (−1)(−1) = 8 + 1 = 9
c21 = (0)(1) + (3)(2) = 0 + 6 = 6
c22 = (0)(4) + (3)(−1) = 0 − 3 = −3
c31 = (1)(1) + (2)(2) = 1 + 4 = 5
c32 = (1)(4) + (2)(−1) = 4 − 2 = 2
AB =
0 9 6 −3 5 2 -
Understanding
A =
, B =2 1 0 3
is actually a column vector B =x y
, AB =x y 7 11 This gives the system:
Row 1: 2x + y = 7 (1)
Row 2: 0×x + 3y = 11 → 3y = 11 → y = 11/3
Wait — let’s use the clean version of this problem: A =
, B =2 1 3 2
, AB =x y 7 11 Setting up the equations:
Equation 1 (row 1 of AB): 2x + y = 7
Equation 2 (row 2 of AB): 3x + 2y = 11
Solving by substitution:
From (1): y = 7 − 2x
Substitute into (2): 3x + 2(7 − 2x) = 11 → 3x + 14 − 4x = 11 → −x = −3 → x = 3
Back-substitute: y = 7 − 2(3) = 7 − 6 = y = 1
Verify: 2(3) + 1 = 7 ✓ and 3(3) + 2(1) = 9 + 2 = 11 ✓
-
Problem Solving
Let P (2×2) = production rates matrix (rows = factories, columns = products) and C (2×2) = cost matrix (rows = products, columns = material/labour costs).
What PC represents:
The element (PC)ij = ∑k Pik Ckj.
In context: (PC)ij = (units of product k made by factory i) × (cost j per unit of product k), summed over all products k.
Therefore, row i of PC gives the total material cost and total labour cost incurred by factory i across all products.
PC is a 2×2 matrix where:
- Rows represent the two factories
- Columns represent material costs and labour costs
- Entry (i, j) = total cost of type j for factory i
This is a powerful application of matrix multiplication: it efficiently combines production volumes with per-unit costs to yield total costs by factory and cost category.
-
Problem Solving
Encoding matrix E =
, M =2 1 1 1
(first two elements of the message vector)8 5 Encoding calculation EM:
Row 1: (2)(8) + (1)(5) = 16 + 5 = 21
Row 2: (1)(8) + (1)(5) = 8 + 5 = 13
EM =
21 13 Why this is a cryptographic operation:
The original message [8, 5] (which could represent letters H, E by A=1 coding) is transformed into [21, 13] through matrix multiplication. An interceptor who receives [21, 13] cannot easily recover [8, 5] without knowing the encoding matrix E. Only someone who knows E (and can compute E−1) can decode the message. This is the foundation of Hill cipher encryption — matrix multiplication scrambles numerical representations of text in a reversible but non-obvious way.
Verification: The third element of M (12) is not encoded here, demonstrating that the process encodes message blocks of size equal to the matrix order.