Class 12 Maths, Worked in Full Past papersGet updates
Chapter 3 · Matrices

Example 16: Find A(BC)A(BC) and (AB)C(AB)C⁠; show they are equal

ExamplesProperties of matrix multiplication: the associative law · Section 3.4.6
The question

If

A=[11−12033−12],A = \begin{bmatrix} 1 & 1 & -1 \\ 2 & 0 & 3 \\ 3 & -1 & 2 \end{bmatrix}, B=[1302−14]B = \begin{bmatrix} 1 & 3 \\ 0 & 2 \\ -1 & 4 \end{bmatrix}

and

C=[123−420−21],C = \begin{bmatrix} 1 & 2 & 3 & -4 \\ 2 & 0 & -2 & 1 \end{bmatrix},

find A(BC), (AB)C and show that (AB)C = A(BC).

Exam answer

AA is 3×33\times3⁠, BB is 3×23\times2 and CC is 2×42\times4⁠. So ABAB is 3×23\times2⁠, BCBC is 3×43\times4⁠, and (AB)C(AB)C⁠, A(BC)A(BC) are both 3×43\times4⁠.

Let AB=[pij]AB = [p_{ij}]⁠.

p11=1⋅1+1⋅0+(−1)⋅(−1)=2p12=1⋅3+1⋅2+(−1)⋅4=1p21=2⋅1+0⋅0+3⋅(−1)=−1p22=2⋅3+0⋅2+3⋅4=18p31=3⋅1+(−1)⋅0+2⋅(−1)=1p32=3⋅3+(−1)⋅2+2⋅4=15\begin{aligned} p_{11} &= 1{\cdot} 1 + 1{\cdot} 0 + (-1){\cdot} (-1) \\ &= 2 \\ p_{12} &= 1{\cdot} 3 + 1{\cdot} 2 + (-1){\cdot} 4 = 1 \\ p_{21} &= 2{\cdot} 1 + 0{\cdot} 0 + 3{\cdot} (-1) = -1 \\ p_{22} &= 2{\cdot} 3 + 0{\cdot} 2 + 3{\cdot} 4 = 18 \\ p_{31} &= 3{\cdot} 1 + (-1){\cdot} 0 + 2{\cdot} (-1) \\ &= 1 \\ p_{32} &= 3{\cdot} 3 + (-1){\cdot} 2 + 2{\cdot} 4 = 15 \end{aligned} ∴ AB=[21−118115]\therefore\ AB = \begin{bmatrix} 2 & 1 \\ -1 & 18 \\ 1 & 15 \end{bmatrix}

Let (AB)C=[qij](AB)C = [q_{ij}]⁠.

q11=2⋅1+1⋅2=4q12=2⋅2+1⋅0=4q13=2⋅3+1⋅(−2)=4q14=2⋅(−4)+1⋅1=−7q21=(−1)⋅1+18⋅2=35q22=(−1)⋅2+18⋅0=−2q23=(−1)⋅3+18⋅(−2)=−39q24=(−1)⋅(−4)+18⋅1=22q31=1⋅1+15⋅2=31q32=1⋅2+15⋅0=2q33=1⋅3+15⋅(−2)=−27q34=1⋅(−4)+15⋅1=11\begin{aligned} q_{11} &= 2{\cdot} 1 + 1{\cdot} 2 = 4 \\ q_{12} &= 2{\cdot} 2 + 1{\cdot} 0 = 4 \\ q_{13} &= 2{\cdot} 3 + 1{\cdot} (-2) = 4 \\ q_{14} &= 2{\cdot} (-4) + 1{\cdot} 1 = -7 \\ q_{21} &= (-1){\cdot} 1 + 18{\cdot} 2 = 35 \\ q_{22} &= (-1){\cdot} 2 + 18{\cdot} 0 = -2 \\ q_{23} &= (-1){\cdot} 3 + 18{\cdot} (-2) \\ &= -39 \\ q_{24} &= (-1){\cdot} (-4) + 18{\cdot} 1 = 22 \\ q_{31} &= 1{\cdot} 1 + 15{\cdot} 2 = 31 \\ q_{32} &= 1{\cdot} 2 + 15{\cdot} 0 = 2 \\ q_{33} &= 1{\cdot} 3 + 15{\cdot} (-2) = -27 \\ q_{34} &= 1{\cdot} (-4) + 15{\cdot} 1 = 11 \end{aligned} ∴ (AB)C=[444−735−2−3922312−2711]\begin{aligned} &\therefore\ (AB)C \\ &= \begin{bmatrix} 4 & 4 & 4 & -7 \\ 35 & -2 & -39 & 22 \\ 31 & 2 & -27 & 11 \end{bmatrix} \end{aligned}

Let BC=[rij]BC = [r_{ij}]⁠.

r11=1⋅1+3⋅2=7r12=1⋅2+3⋅0=2r13=1⋅3+3⋅(−2)=−3r14=1⋅(−4)+3⋅1=−1r21=0⋅1+2⋅2=4r22=0⋅2+2⋅0=0r23=0⋅3+2⋅(−2)=−4r24=0⋅(−4)+2⋅1=2r31=(−1)⋅1+4⋅2=7r32=(−1)⋅2+4⋅0=−2r33=(−1)⋅3+4⋅(−2)=−11r34=(−1)⋅(−4)+4⋅1=8\begin{aligned} r_{11} &= 1{\cdot} 1 + 3{\cdot} 2 = 7 \\ r_{12} &= 1{\cdot} 2 + 3{\cdot} 0 = 2 \\ r_{13} &= 1{\cdot} 3 + 3{\cdot} (-2) = -3 \\ r_{14} &= 1{\cdot} (-4) + 3{\cdot} 1 = -1 \\ r_{21} &= 0{\cdot} 1 + 2{\cdot} 2 = 4 \\ r_{22} &= 0{\cdot} 2 + 2{\cdot} 0 = 0 \\ r_{23} &= 0{\cdot} 3 + 2{\cdot} (-2) = -4 \\ r_{24} &= 0{\cdot} (-4) + 2{\cdot} 1 = 2 \\ r_{31} &= (-1){\cdot} 1 + 4{\cdot} 2 = 7 \\ r_{32} &= (-1){\cdot} 2 + 4{\cdot} 0 = -2 \\ r_{33} &= (-1){\cdot} 3 + 4{\cdot} (-2) = -11 \\ r_{34} &= (-1){\cdot} (-4) + 4{\cdot} 1 = 8 \end{aligned} ∴ BC=[72−3−140−427−2−118]\therefore\ BC = \begin{bmatrix} 7 & 2 & -3 & -1 \\ 4 & 0 & -4 & 2 \\ 7 & -2 & -11 & 8 \end{bmatrix}

Let A(BC)=[sij]A(BC) = [s_{ij}]⁠.

s11=1⋅7+1⋅4+(−1)⋅7=4s12=1⋅2+1⋅0+(−1)⋅(−2)=4s13=1⋅(−3)+1⋅(−4)+(−1)⋅(−11)=4s14=1⋅(−1)+1⋅2+(−1)⋅8=−7s21=2⋅7+0⋅4+3⋅7=35s22=2⋅2+0⋅0+3⋅(−2)=−2s23=2⋅(−3)+0⋅(−4)+3⋅(−11)=−39s24=2⋅(−1)+0⋅2+3⋅8=22s31=3⋅7+(−1)⋅4+2⋅7=31s32=3⋅2+(−1)⋅0+2⋅(−2)=2s33=3⋅(−3)+(−1)⋅(−4)+2⋅(−11)=−27s34=3⋅(−1)+(−1)⋅2+2⋅8=11\begin{aligned} s_{11} &= 1{\cdot} 7 + 1{\cdot} 4 + (-1){\cdot} 7 = 4 \\ s_{12} &= 1{\cdot} 2 + 1{\cdot} 0 + (-1){\cdot} (-2) \\ &= 4 \\ s_{13} &= 1{\cdot} (-3) + 1{\cdot} (-4) \\ &\quad + (-1){\cdot} (-11) \\ &= 4 \\ s_{14} &= 1{\cdot} (-1) + 1{\cdot} 2 + (-1){\cdot} 8 \\ &= -7 \\ s_{21} &= 2{\cdot} 7 + 0{\cdot} 4 + 3{\cdot} 7 = 35 \\ s_{22} &= 2{\cdot} 2 + 0{\cdot} 0 + 3{\cdot} (-2) = -2 \\ s_{23} &= 2{\cdot} (-3) + 0{\cdot} (-4) \\ &\quad + 3{\cdot} (-11) \\ &= -39 \\ s_{24} &= 2{\cdot} (-1) + 0{\cdot} 2 + 3{\cdot} 8 = 22 \\ s_{31} &= 3{\cdot} 7 + (-1){\cdot} 4 + 2{\cdot} 7 = 31 \\ s_{32} &= 3{\cdot} 2 + (-1){\cdot} 0 + 2{\cdot} (-2) \\ &= 2 \\ s_{33} &= 3{\cdot} (-3) + (-1){\cdot} (-4) \\ &\quad + 2{\cdot} (-11) \\ &= -27 \\ s_{34} &= 3{\cdot} (-1) + (-1){\cdot} 2 + 2{\cdot} 8 \\ &= 11 \end{aligned} ∴ A(BC)=[444−735−2−3922312−2711]\begin{aligned} &\therefore\ A(BC) \\ &= \begin{bmatrix} 4 & 4 & 4 & -7 \\ 35 & -2 & -39 & 22 \\ 31 & 2 & -27 & 11 \end{bmatrix} \end{aligned}

Both are 3×43\times4 with equal corresponding entries, so (AB)C=A(BC)(AB)C = A(BC)⁠.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

The associative law: when we multiply three matrices in a fixed order AA⁠, BB⁠, CC⁠, it does not matter which product we do first. (AB)C(AB)C multiplies AA and BB first; A(BC)A(BC) multiplies BB and CC first. The intermediate matrices are completely different (here ABAB is 3×23\times2 and BCBC is 3×43\times4⁠), yet the final answers agree in every entry. The order of the letters stays A,B,CA,B,C throughout; only the brackets move.

Given, to find, and the plan
Given
AA of order 3×33\times3⁠, BB of order 3×23\times2⁠, CC of order 2×42\times4⁠.
To find / show
(AB)C(AB)C and A(BC)A(BC)⁠, and that they are equal.
Plan
Check every product is defined and track the orders. Compute ABAB⁠, then (AB)C(AB)C⁠. Separately compute BCBC⁠, then A(BC)A(BC)⁠. Compare the two 3×43\times4 results entry by entry.

Basics you need

1Orders in a product

(m×n)(n×p)(m\times n)(n\times p) gives m×pm\times p⁠. The inner sizes must match. Basics: rows, columns and the address

2Row times column

Entry (i,k)(i,k) of a product is row ii of the first factor times column kk of the second: pair, multiply, add. Basics: pair up, multiply, add

3The associative law

(AB)C=A(BC)(AB)C=A(BC) whenever both sides are defined (stated in Section 3.4.6 without proof; this example checks it for particular matrices). Lesson: properties of the operations

4Equal matrices

Same order and all corresponding entries equal. Lesson: equality of matrices

Solution

  1. Check that every product is defined and track the orders

    ProductOrdersInner sizesResult
    ABAB(3×3)(3×2)(3\times3)(3\times2)3=33=33×23\times2
    (AB)C(AB)C(3×2)(2×4)(3\times2)(2\times4)2=22=23×43\times4
    BCBC(3×2)(2×4)(3\times2)(2\times4)2=22=23×43\times4
    A(BC)A(BC)(3×3)(3×4)(3\times3)(3\times4)3=33=33×43\times4

    Both sides are defined and both are 3×43\times4⁠, so comparing them makes sense.

    The associative law is stated "whenever both sides of the equality are defined", so checking this first is part of applying it. It also tells us how many entries to expect: 6 in ABAB⁠, 12 in each of the others.
    Order of a product, Section 3.4.5. Lesson: matrix multiplication
  2. Compute ABAB

    Rows of AA⁠: [1  1  −1][1\ \ 1\ \ {-1}]⁠, [2  0  3][2\ \ 0\ \ 3]⁠, [3  −1  2][3\ \ {-1}\ \ 2]⁠. Columns of BB⁠: (1,0,−1)(1,0,-1) and (3,2,4)(3,2,4)⁠. Write AB=[pik]AB=[p_{ik}]⁠:

    p11=1⋅1+1⋅0+(−1)⋅(−1)=1+0+1=2p12=1⋅3+1⋅2+(−1)⋅4=3+2−4=1p21=2⋅1+0⋅0+3⋅(−1)=2+0−3=−1p22=2⋅3+0⋅2+3⋅4=6+0+12=18p31=3⋅1+(−1)⋅0+2⋅(−1)=3+0−2=1p32=3⋅3+(−1)⋅2+2⋅4=9−2+8=15\begin{aligned} p_{11} &= 1\cdot 1 + 1\cdot 0 + (-1)\cdot(-1)\\ &= 1 + 0 + 1 = 2\\ p_{12} &= 1\cdot 3 + 1\cdot 2 + (-1)\cdot 4\\ &= 3 + 2 - 4 = 1\\ p_{21} &= 2\cdot 1 + 0\cdot 0 + 3\cdot(-1)\\ &= 2 + 0 - 3 = -1\\ p_{22} &= 2\cdot 3 + 0\cdot 2 + 3\cdot 4\\ &= 6 + 0 + 12 = 18\\ p_{31} &= 3\cdot 1 + (-1)\cdot 0 + 2\cdot(-1)\\ &= 3 + 0 - 2 = 1\\ p_{32} &= 3\cdot 3 + (-1)\cdot 2 + 2\cdot 4\\ &= 9 - 2 + 8 = 15 \end{aligned} AB=[21−118115]AB = \begin{bmatrix} 2 & 1 \\ -1 & 18 \\ 1 & 15 \end{bmatrix}
    Each entry pairs a row of AA (3 entries) with a column of BB (3 entries), so each is a sum of three products. Writing each product with its sign before adding keeps track of the many negative entries.
    pik=ai1b1k+ai2b2k+ai3b3kp_{ik}=a_{i1}b_{1k}+a_{i2}b_{2k}+a_{i3}b_{3k}⁠. Basics: pair up, multiply, add
  3. Compute (AB)C(AB)C

    Rows of ABAB⁠: [2  1][2\ \ 1]⁠, [−1  18][-1\ \ 18]⁠, [1  15][1\ \ 15]⁠. Columns of CC⁠: (1,2)(1,2)⁠, (2,0)(2,0)⁠, (3,−2)(3,-2)⁠, (−4,1)(-4,1)⁠. Write (AB)C=[qik](AB)C=[q_{ik}]⁠. Row 1:

    q11=2⋅1+1⋅2=2+2=4q12=2⋅2+1⋅0=4+0=4q13=2⋅3+1⋅(−2)=6−2=4q14=2⋅(−4)+1⋅1=−8+1=−7\begin{aligned} q_{11} &= 2\cdot 1 + 1\cdot 2 = 2 + 2 = 4\\ q_{12} &= 2\cdot 2 + 1\cdot 0 = 4 + 0 = 4\\ q_{13} &= 2\cdot 3 + 1\cdot(-2) = 6 - 2 = 4\\ q_{14} &= 2\cdot(-4) + 1\cdot 1 = -8 + 1 = -7 \end{aligned}

    Row 2:

    q21=(−1)⋅1+18⋅2=−1+36=35q22=(−1)⋅2+18⋅0=−2+0=−2q23=(−1)⋅3+18⋅(−2)=−3−36=−39q24=(−1)⋅(−4)+18⋅1=4+18=22\begin{aligned} q_{21} &= (-1)\cdot 1 + 18\cdot 2\\ &= -1 + 36 = 35\\ q_{22} &= (-1)\cdot 2 + 18\cdot 0\\ &= -2 + 0 = -2\\ q_{23} &= (-1)\cdot 3 + 18\cdot(-2)\\ &= -3 - 36 = -39\\ q_{24} &= (-1)\cdot(-4) + 18\cdot 1\\ &= 4 + 18 = 22 \end{aligned}

    Row 3:

    q31=1⋅1+15⋅2=1+30=31q32=1⋅2+15⋅0=2+0=2q33=1⋅3+15⋅(−2)=3−30=−27q34=1⋅(−4)+15⋅1=−4+15=11\begin{aligned} q_{31} &= 1\cdot 1 + 15\cdot 2\\ &= 1 + 30 = 31\\ q_{32} &= 1\cdot 2 + 15\cdot 0\\ &= 2 + 0 = 2\\ q_{33} &= 1\cdot 3 + 15\cdot(-2)\\ &= 3 - 30 = -27\\ q_{34} &= 1\cdot(-4) + 15\cdot 1\\ &= -4 + 15 = 11 \end{aligned} (AB)C=[444−735−2−3922312−2711](AB)C = \begin{bmatrix} 4 & 4 & 4 & -7 \\ 35 & -2 & -39 & 22 \\ 31 & 2 & -27 & 11 \end{bmatrix}
    Now the first factor is the matrix ABAB we just found. Its rows have 2 entries and the columns of CC have 2 entries, so each entry is a sum of two products. The result is 3×43\times4⁠, as predicted in Step 1.
  4. Compute BCBC

    Now the other bracketing. Rows of BB⁠: [1  3][1\ \ 3]⁠, [0  2][0\ \ 2]⁠, [−1  4][-1\ \ 4]⁠. Columns of CC as before. Write BC=[rik]BC=[r_{ik}]⁠. Row 1:

    r11=1⋅1+3⋅2=1+6=7r12=1⋅2+3⋅0=2+0=2r13=1⋅3+3⋅(−2)=3−6=−3r14=1⋅(−4)+3⋅1=−4+3=−1\begin{aligned} r_{11} &= 1\cdot 1 + 3\cdot 2 = 1 + 6 = 7\\ r_{12} &= 1\cdot 2 + 3\cdot 0 = 2 + 0 = 2\\ r_{13} &= 1\cdot 3 + 3\cdot(-2) = 3 - 6 = -3\\ r_{14} &= 1\cdot(-4) + 3\cdot 1 = -4 + 3 = -1 \end{aligned}

    Row 2:

    r21=0⋅1+2⋅2=0+4=4r22=0⋅2+2⋅0=0+0=0r23=0⋅3+2⋅(−2)=0−4=−4r24=0⋅(−4)+2⋅1=0+2=2\begin{aligned} r_{21} &= 0\cdot 1 + 2\cdot 2 = 0 + 4 = 4\\ r_{22} &= 0\cdot 2 + 2\cdot 0 = 0 + 0 = 0\\ r_{23} &= 0\cdot 3 + 2\cdot(-2) = 0 - 4 = -4\\ r_{24} &= 0\cdot(-4) + 2\cdot 1 = 0 + 2 = 2 \end{aligned}

    Row 3:

    r31=(−1)⋅1+4⋅2=−1+8=7r32=(−1)⋅2+4⋅0=−2+0=−2r33=(−1)⋅3+4⋅(−2)=−3−8=−11r34=(−1)⋅(−4)+4⋅1=4+4=8\begin{aligned} r_{31} &= (-1)\cdot 1 + 4\cdot 2 = -1 + 8 = 7\\ r_{32} &= (-1)\cdot 2 + 4\cdot 0 = -2 + 0 = -2\\ r_{33} &= (-1)\cdot 3 + 4\cdot(-2)\\ &= -3 - 8 = -11\\ r_{34} &= (-1)\cdot(-4) + 4\cdot 1 = 4 + 4 = 8 \end{aligned} BC=[72−3−140−427−2−118]BC = \begin{bmatrix} 7 & 2 & -3 & -1 \\ 4 & 0 & -4 & 2 \\ 7 & -2 & -11 & 8 \end{bmatrix}
    BCBC is 3×43\times4⁠, a completely different matrix from ABAB (which is 3×23\times2⁠). The associative law says that, even so, multiplying AA onto it will land on the same final matrix.
  5. Compute A(BC)A(BC)

    Rows of AA as in Step 2. Columns of BCBC⁠: (7,4,7)(7,4,7)⁠, (2,0,−2)(2,0,-2)⁠, (−3,−4,−11)(-3,-4,-11)⁠, (−1,2,8)(-1,2,8)⁠. Write A(BC)=[sik]A(BC)=[s_{ik}]⁠. Row 1, from [1  1  −1][1\ \ 1\ \ {-1}]⁠:

    s11=1⋅7+1⋅4+(−1)⋅7=7+4−7=4s12=1⋅2+1⋅0+(−1)⋅(−2)=2+0+2=4s13=1⋅(−3)+1⋅(−4)+(−1)⋅(−11)=−3−4+11=4s14=1⋅(−1)+1⋅2+(−1)⋅8=−1+2−8=−7\begin{aligned} s_{11} &= 1{\cdot} 7 + 1{\cdot} 4 + (-1){\cdot} 7\\ &= 7 + 4 - 7 = 4\\ s_{12} &= 1{\cdot} 2 + 1{\cdot} 0 + (-1){\cdot}(-2)\\ &= 2 + 0 + 2 = 4\\ s_{13} &= 1{\cdot}(-3) + 1{\cdot}(-4) + (-1){\cdot}(-11)\\ &= -3 - 4 + 11 = 4\\ s_{14} &= 1{\cdot}(-1) + 1{\cdot} 2 + (-1){\cdot} 8\\ &= -1 + 2 - 8 = -7 \end{aligned}

    Row 2, from [2  0  3][2\ \ 0\ \ 3]⁠:

    s21=2⋅7+0⋅4+3⋅7=14+0+21=35s22=2⋅2+0⋅0+3⋅(−2)=4+0−6=−2s23=2⋅(−3)+0⋅(−4)+3⋅(−11)=−6+0−33=−39s24=2⋅(−1)+0⋅2+3⋅8=−2+0+24=22\begin{aligned} s_{21} &= 2{\cdot} 7 + 0{\cdot} 4 + 3{\cdot} 7\\ &= 14 + 0 + 21 = 35\\ s_{22} &= 2{\cdot} 2 + 0{\cdot} 0 + 3{\cdot}(-2)\\ &= 4 + 0 - 6 = -2\\ s_{23} &= 2{\cdot}(-3) + 0{\cdot}(-4) + 3{\cdot}(-11)\\ &= -6 + 0 - 33 = -39\\ s_{24} &= 2{\cdot}(-1) + 0{\cdot} 2 + 3{\cdot} 8\\ &= -2 + 0 + 24 = 22 \end{aligned}

    Row 3, from [3  −1  2][3\ \ {-1}\ \ 2]⁠:

    s31=3⋅7+(−1)⋅4+2⋅7=21−4+14=31s32=3⋅2+(−1)⋅0+2⋅(−2)=6+0−4=2s33=3⋅(−3)+(−1)⋅(−4)+2⋅(−11)=−9+4−22=−27s34=3⋅(−1)+(−1)⋅2+2⋅8=−3−2+16=11\begin{aligned} s_{31} &= 3{\cdot} 7 + (-1){\cdot} 4 + 2{\cdot} 7\\ &= 21 - 4 + 14 = 31\\ s_{32} &= 3{\cdot} 2 + (-1){\cdot} 0 + 2{\cdot}(-2)\\ &= 6 + 0 - 4 = 2\\ s_{33} &= 3{\cdot}(-3) + (-1){\cdot}(-4) + 2{\cdot}(-11)\\ &= -9 + 4 - 22 = -27\\ s_{34} &= 3{\cdot}(-1) + (-1){\cdot} 2 + 2{\cdot} 8\\ &= -3 - 2 + 16 = 11 \end{aligned} A(BC)=[444−735−2−3922312−2711]A(BC) = \begin{bmatrix} 4 & 4 & 4 & -7 \\ 35 & -2 & -39 & 22 \\ 31 & 2 & -27 & 11 \end{bmatrix}
    Each entry is now a sum of three products, because rows of AA and columns of BCBC have 3 entries. The arithmetic is entirely different from Step 3 (for example q23=−3−36q_{23}=-3-36 but s23=−6+0−33s_{23}=-6+0-33⁠), yet the totals agree.
  6. Compare the two results

    Both matrices are 3×43\times4⁠, and comparing the twelve entries of Step 3 with those of Step 5:

    row 1: 4, 4, 4, −7  in bothrow 2: 35, −2, −39, 22  in bothrow 3: 31, 2, −27, 11  in both\begin{aligned} &\text{row 1: } 4,\ 4,\ 4,\ -7 \ \text{ in both}\\ &\text{row 2: } 35,\ -2,\ -39,\ 22 \ \text{ in both}\\ &\text{row 3: } 31,\ 2,\ -27,\ 11 \ \text{ in both} \end{aligned}

    Same order and all corresponding entries equal, so (AB)C=A(BC)(AB)C=A(BC).

    This is what the definition of equal matrices requires: equal orders and qik=sikq_{ik}=s_{ik} for every i,ki,k⁠. Checking all twelve, not just a few, is what makes the conclusion valid for these matrices.
    Associative law, Section 3.4.6, property 1. Lesson: properties of the operations
  7. Why the two groupings always agree

    The textbook states the associative law without proof, but the reason is short. Entry (i,l)(i,l) of (AB)C(AB)C is

    ∑k(∑jaijbjk)ckl=∑j∑kaijbjkckl,\sum_{k}\Big(\sum_{j} a_{ij}b_{jk}\Big)c_{kl} = \sum_{j}\sum_{k} a_{ij}b_{jk}c_{kl},

    and entry (i,l)(i,l) of A(BC)A(BC) is

    ∑jaij(∑kbjkckl)=∑j∑kaijbjkckl.\sum_{j} a_{ij}\Big(\sum_{k} b_{jk}c_{kl}\Big) = \sum_{j}\sum_{k} a_{ij}b_{jk}c_{kl}.

    Both are the sum of aijbjkckla_{ij}b_{jk}c_{kl} over every pair (j,k)(j,k)⁠, just added up in a different order.

    Real-number multiplication is associative and distributes over addition, and a finite sum can be added in any order. So the two double sums are equal for any matrices of compatible orders. Here jj runs over 3 values and kk over 2, so each entry is a sum of 6 triple products. For entry (2,3)(2,3)⁠, the four terms with j=1j=1 or j=3j=3 are 2⋅1⋅3+2⋅3⋅(−2)+3⋅(−1)⋅3+3⋅4⋅(−2)=6−12−9−24=−39,\begin{aligned} &2\cdot 1\cdot 3 + 2\cdot 3\cdot(-2)\\ &+ 3\cdot(-1)\cdot 3 + 3\cdot 4\cdot(-2)\\ &= 6 - 12 - 9 - 24 = -39, \end{aligned} and the two terms with j=2j=2 are 0 because a22=0a_{22}=0⁠.
Result

Both (AB)C(AB)C and A(BC)A(BC) equal the same 3×43\times4 matrix:

[444−735−2−3922312−2711]\begin{bmatrix} 4 & 4 & 4 & -7 \\ 35 & -2 & -39 & 22 \\ 31 & 2 & -27 & 11 \end{bmatrix}

with the intermediate products

AB=[21−118115]AB = \begin{bmatrix} 2 & 1 \\ -1 & 18 \\ 1 & 15 \end{bmatrix} BC=[72−3−140−427−2−118].BC = \begin{bmatrix} 7 & 2 & -3 & -1 \\ 4 & 0 & -4 & 2 \\ 7 & -2 & -11 & 8 \end{bmatrix}.

All of these agree with the textbook's solution.

Check it with numbers

Multiply both sides by the column (1,1,1,1)(1,1,1,1)⁠, which simply adds up each row. Row sums of (AB)C(AB)C⁠: 4+4+4−7=54+4+4-7=5⁠, 35−2−39+22=1635-2-39+22=16⁠, 31+2−27+11=1731+2-27+11=17⁠. Independently, CC times (1,1,1,1)(1,1,1,1) is (1+2+3−4, 2+0−2+1)=(2,1)(1+2+3-4,\ 2+0-2+1)=(2,1)⁠; then BB times (2,1)(2,1) is (2+3, 0+2, −2+4)=(5,2,2)(2+3,\ 0+2,\ -2+4)=(5,2,2)⁠; then AA times (5,2,2)(5,2,2) has entries 5+2−2=55+2-2=5⁠, 10+0+6=1610+0+6=16 and 15−2+4=1715-2+4=17⁠. The row sums match.

Common mistakes
  1. Moving the letters instead of the brackets. Associativity allows (AB)C=A(BC)(AB)C=A(BC)⁠, not (AB)C=(BA)C(AB)C=(BA)C or A(CB)A(CB)⁠. The order A,B,CA,B,C never changes.
  2. Expecting ABAB and BCBC to be alike. They have different orders here; only the final products agree.
  3. Sign slips with three negatives. In s13s_{13}⁠, (−1)⋅(−11)=+11(-1)\cdot(-11)=+11⁠.
  4. Checking a few entries only. Equality needs every entry; one unchecked entry could hide an error.
What to take away
  1. For a product of three matrices, you may choose which pair to multiply first, as long as the left-to-right order stays the same.
  2. Choosing well can save work. Counting single multiplications: (AB)C(AB)C took 6×3=186\times3=18 for ABAB and 12×2=2412\times2=24 for the product with CC⁠, 42 in all; A(BC)A(BC) took 12×2=2412\times2=24 for BCBC and 12×3=3612\times3=36 for the product with AA⁠, 60 in all.
  3. Because of associativity, a product like ABCABC or a power A3A^3 has one meaning without brackets.

Every fact used, and where it comes from

FactUsed inSource
(m×n)(n×p)(m\times n)(n\times p) is m×pm\times pStep 1Section 3.4.5 (Lesson: matrix multiplication)
cik=∑jaijbjkc_{ik}=\sum_j a_{ij}b_{jk}Steps 2 to 5Section 3.4.5, definition of the product
Equality of matricesStep 6Definition 2, Section 3.3.1 (Lesson: equality)
(AB)C=A(BC)(AB)C=A(BC) when both sides are definedSteps 6 and 7Section 3.4.6, property 1 (Lesson: properties)
Real numbers: associative, distributive; finite sums in any orderStep 7Arithmetic of real numbers
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →