• Foundation
  • About 20 min
  • 5 practice questions

Multiplying matrices

Multiply two matrices by the row-by-column rule, check when a product is defined, and use the properties of multiplication, including AB ≠ BA and AB = O with A, B non-zero.

If something looks wrong, please tell us.

By the end of this lesson you can

  • Decide whether AB is defined and find its order.
  • Compute AB by the row-by-column rule and powers such as A².
  • Use the associative and distributive laws, and avoid the traps AB = BA and 'AB = O ⇒ A = O or B = O'.

Matrix multiplication is not entry by entry. It is designed so that one matrix can act on another, as when quantities are multiplied by prices and the results added. This one idea is what lets matrices represent systems of equations and geometric transformations.

How matrices are written in these lessons: entries in a row are separated by spaces and rows by semicolons, so [2 −1; 3 0] is the 2 × 2 matrix with first row 2, −1 and second row 3, 0.

The rule

Let A be m × n and B be n × p (the number of columns of A equals the number of rows of B). Then AB is the m × p matrix C = [cᵢₖ] with cᵢₖ = aᵢ₁b₁ₖ + aᵢ₂b₂ₖ + … + aᵢₙbₙₖ: multiply the i-th row of A by the k-th column of B, entry by entry, and add.

Finding the entry in row i, column k of AB

  1. Take row i of A It has n entries.
  2. Take column k of B It also has n entries.
  3. Multiply in pairs first × first, second × second, …
  4. Add the products The sum is cᵢₖ.

(m × n)(n × p) = (m × p). The inner numbers must match; the outer numbers give the order of the product.

— Order rule

Worked examples

Worked example 1 (made-up prices). Two students buy pens and notebooks: Asha buys 3 pens and 2 notebooks, Bilal buys 1 pen and 4 notebooks. A pen costs ₹10 and a notebook ₹40. Q = [3 2; 1 4] (2 × 2) and P = [10; 40] (2 × 1). QP = [3 × 10 + 2 × 40; 1 × 10 + 4 × 40] = [110; 170]: Asha spends ₹110 and Bilal ₹170.

Worked example 2. A = [1 2; 3 −1], B = [2 0; 1 4]. Working: AB = [1·2 + 2·1, 1·0 + 2·4; 3·2 + (−1)·1, 3·0 + (−1)·4] = [4 8; 5 −4]. BA = [2·1 + 0·3, 2·2 + 0·(−1); 1·1 + 4·3, 1·2 + 4·(−1)] = [2 4; 13 −2]. So AB ≠ BA: matrix multiplication is not commutative.

Worked example 3 (orders). If A is 2 × 3 and B is 3 × 1, then AB is defined and is 2 × 1, but BA would be (3 × 1)(2 × 3), whose inner numbers 1 and 2 differ, so BA is not defined. Even when both products exist, they may have different orders: for A of order 2 × 3 and B of order 3 × 2, AB is 2 × 2 but BA is 3 × 3.

Worked example 4 (zero product). A = [1 1; 2 2], B = [1 −1; −1 1]. Working: AB = [1 − 1, −1 + 1; 2 − 2, −2 + 2] = O, although neither A nor B is the zero matrix. So for matrices, AB = O does not imply A = O or B = O, and we cannot cancel a matrix from both sides of an equation.

Worked example 5 (a matrix polynomial). A = [2 1; 0 3]. Show that A² − 5A + 6I = O. Working: A² = AA = [2·2 + 1·0, 2·1 + 1·3; 0·2 + 3·0, 0·1 + 3·3] = [4 5; 0 9]. 5A = [10 5; 0 15] and 6I = [6 0; 0 6]. A² − 5A + 6I = [4 − 10 + 6, 5 − 5 + 0; 0 − 0 + 0, 9 − 15 + 6] = [0 0; 0 0] ✓.

Properties of multiplication

What carries over from numbers, and what does not
PropertyStatement (whenever the products are defined)
Associative(AB)C = A(BC)
DistributiveA(B + C) = AB + AC and (A + B)C = AC + BC
IdentityIA = AI = A for a square matrix A and I of the same order
Scalarsk(AB) = (kA)B = A(kB)
NOT commutativeAB and BA may differ, or one may be undefined
No zero-product ruleAB = O is possible with A ≠ O and B ≠ O

Because AB ≠ BA in general, identities from algebra must be used carefully: (A + B)² = A² + AB + BA + B², which equals A² + 2AB + B² only when AB = BA. Powers of a square matrix are defined by A² = AA, A³ = A²A, and so on.

Key takeaways: AB needs columns of A = rows of B, and has order (rows of A) × (columns of B). Each entry is a row of A times a column of B. Multiplication is associative and distributive with identity I, but not commutative, and a product can be O with neither factor zero.

Check your understanding

  1. 1. A is of order 3 × 4 and B is of order 4 × 2. What is the order of AB, and is BA defined?

    1. 3 × 2; BA is not defined
    2. 4 × 4; BA is defined
    3. 3 × 2; BA is defined and is 2 × 3
    4. 2 × 3; BA is not defined
    Show answer

    Answer: A. (3 × 4)(4 × 2) = 3 × 2. For BA we need (4 × 2)(3 × 4); the inner numbers 2 and 3 differ, so BA is not defined.

  2. 2. If A = [1 2; 0 1] and B = [3; 4], what is AB?

    1. [3 8; 0 4]
    2. [7; 4]
    3. [11; 4]
    4. [3; 4]
    Show answer

    Answer: C. (2 × 2)(2 × 1) = 2 × 1. First row: 1·3 + 2·4 = 11. Second row: 0·3 + 1·4 = 4. So AB = [11; 4].

  3. 3. For A = [0 1; 0 0], what is A²?

    1. [0 1; 0 0]
    2. [0 0; 1 0]
    3. [1 0; 0 1]
    4. [0 0; 0 0]
    Show answer

    Answer: D. A² = [0·0 + 1·0, 0·1 + 1·0; 0·0 + 0·0, 0·1 + 0·0] = [0 0; 0 0]. A non-zero matrix can have a zero square.

  4. 4. For square matrices A and B of the same order, (A + B)(A − B) equals which expression in general?

    1. A² − B²
    2. A² − AB + BA − B²
    3. A² + AB − BA − B²
    4. A² − 2AB + B²
    Show answer

    Answer: B. Expand keeping the order: (A + B)(A − B) = A·A − A·B + B·A − B·B = A² − AB + BA − B². It equals A² − B² only if AB = BA.

  5. 5. Assertion (A): For the matrices A = [1 1; 2 2] and B = [1 −1; −1 1], AB = O.
    Reason (R): If the product of two matrices is the zero matrix, then one of them must be the zero matrix.

    1. Both A and R are true, and R is the correct explanation of A
    2. Both A and R are true, but R is not the correct explanation of A
    3. A is true but R is false
    4. A is false but R is true
    Show answer

    Answer: C. A is true: AB = [1 − 1, −1 + 1; 2 − 2, −2 + 2] = O. R is false, and A is itself a counterexample, since neither A nor B is O.

Privacy · Terms · Refunds · Delivery