Practice Maths

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

When is AB defined? A must be m×n and B must be n×p.
(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

PropertyStatementNote
NOT commutativeAB ≠ BA (in general)Order matters!
Associative(AB)C = A(BC)Always true
DistributiveA(B + C) = AB + ACAlways true
IdentityAI = IA = AI is the identity matrix
Zero productAB = O does NOT imply A = O or B = OMatrices are unusual here

Worked Example 1 — 2×2 by 2×2 Multiplication

Find AB where A =

31
24
and B =
2−1
03

A is 2×2, B is 2×2 → columns of A (2) = rows of B (2) ✓ → result is 2×2.

Calculate each element:

PositionCalculationResult
c11Row 1 of A · Col 1 of B = (3)(2) + (1)(0)6 + 0 = 6
c12Row 1 of A · Col 2 of B = (3)(−1) + (1)(3)−3 + 3 = 0
c21Row 2 of A · Col 1 of B = (2)(2) + (4)(0)4 + 0 = 4
c22Row 2 of A · Col 2 of B = (2)(−1) + (4)(3)−2 + 12 = 10

AB =

60
410

Worked Example 2 — 2×3 by 3×2

Find AB where A =

1 2 0
3 −1 4
and B =
25
1−3
40

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
2118

Hot Tip: Matrix multiplication is NOT commutative — AB ≠ BA in general. Also, even if AB is defined, BA may not be defined (if the dimensions don’t match). Always write matrix products in the specified order.

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
Quick check method: Write the orders side by side: (2×3)(3×4). The middle two numbers must match (3 = 3). The result order is the outer two numbers: 2×4.

Computing Each Element

Element cij in the product AB is found by:

  1. Taking row i from matrix A
  2. Taking column j from matrix B
  3. 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.

Pricing Application: If prices P = [5, 8, 3] (a 1×3 row matrix) and quantities Q is a 3×2 matrix (quantities of each item for two orders), then PQ gives a 1×2 row matrix of total costs for each order.
Lesson Tip: When computing matrix products by hand, write out the row and column as a list, pair them up, multiply each pair, then add. Work systematically through each element — left to right along each row, top to bottom for each column. A common error is mixing up row and column indices.

Mastery Practice

  1. Fluency

    For each matrix product below, state whether it is defined and, if so, give the order of the result.

    1. A is 2×3, B is 3×4. Is AB defined? What is its order?
    2. A is 2×2, B is 3×2. Is AB defined?
    3. A is 4×1, B is 1×3. Is AB defined? What is its order?
    4. A is 3×3, B is 3×1. Is AB defined? What is its order?
  2. Fluency

    Calculate AB where A =

    21
    34
    and B =
    10
    2−1

    Show all intermediate calculations.

  3. Fluency

    Calculate AB where A =

    3−1
    02
    and B =
    −14
    21

  4. Fluency

    Let A =

    52
    −13
    and I =
    10
    01
    .

    Calculate AI and IA and verify both equal A.

  5. Understanding

    Let A =

    12
    34
    and B =
    2−1
    03
    .

    Calculate AB and BA and show that AB ≠ BA.

  6. Understanding

    Let A =

    12
    01
    , B =
    20
    11
    , C =
    13
    20
    .

    Calculate (AB)C and A(BC) and verify that they are equal (associative property).

  7. 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.

    1. State the orders of P and Q. Is PQ defined? What will the order of PQ be?
    2. Calculate PQ.
    3. Interpret each entry in PQ in the context of this problem.
  8. Understanding

    A message is encoded using the matrix E =

    25
    13
    . The original message vector is m =
    3
    1
    .

    1. Calculate the encoded message Em.
    2. The inverse of E is E−1 =
      3−5
      −12
      . Verify that E−1(Em) = m.
  9. Problem Solving

    Let A =

    21
    k3
    .

    1. Calculate A2 = A × A in terms of k.
    2. Recall that det(A2) = (det A)2. Find det(A) in terms of k.
    3. Find the value(s) of k such that det(A2) = 25.
  10. 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 =

    2 1
    3 0
    1 2
    (rows = resource types: machine-hrs, labour-hrs, quality-hrs; columns = Part 1, Part 2)

    The parts required per product are given in matrix P:

    P =

    4 2
    1 3
    (rows = Part 1, Part 2; columns = Product A, Product B)

    1. State the orders of R and P. Is RP defined? What is the order of RP?
    2. Calculate RP.
    3. Interpret the element in row 1, column 2 of RP in context.