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

Exercise 3.2 · Q14: Show that AB≠BAAB \ne BA for two pairs of matrices

Exercise 3.2Matrix multiplication; non-commutativity · Section 3.4.5
The question

Show that

(i)

[5−167][2134]≠[2134][5−167]\begin{bmatrix} 5 & -1 \\ 6 & 7 \end{bmatrix}\begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix} \ne \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix}\begin{bmatrix} 5 & -1 \\ 6 & 7 \end{bmatrix}

(ii)

[123010110][−1100−11234]≠ [−1100−11234][123010110]\begin{aligned} &\begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 0 \\ 1 & 1 & 0 \end{bmatrix}\begin{bmatrix} -1 & 1 & 0 \\ 0 & -1 & 1 \\ 2 & 3 & 4 \end{bmatrix}\\ \ne\ &\begin{bmatrix} -1 & 1 & 0 \\ 0 & -1 & 1 \\ 2 & 3 & 4 \end{bmatrix}\begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 0 \\ 1 & 1 & 0 \end{bmatrix} \end{aligned}
Exam answer

(i) Let

A=[5−167],B=[2134]A = \begin{bmatrix} 5 & -1 \\ 6 & 7 \end{bmatrix},\quad B = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix} AB=[10−35−412+216+28]=[713334]\begin{aligned} AB &= \begin{bmatrix} 10-3 & 5-4 \\ 12+21 & 6+28 \end{bmatrix} \\ &= \begin{bmatrix} 7 & 1 \\ 33 & 34 \end{bmatrix} \end{aligned} BA=[10+6−2+715+24−3+28]=[1653925]\begin{aligned} BA &= \begin{bmatrix} 10+6 & -2+7 \\ 15+24 & -3+28 \end{bmatrix} \\ &= \begin{bmatrix} 16 & 5 \\ 39 & 25 \end{bmatrix} \end{aligned}

∴ AB≠BA\therefore\ AB \ne BA⁠.

(ii) Let

A=[123010110]A = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 0 \\ 1 & 1 & 0 \end{bmatrix} B=[−1100−11234]B = \begin{bmatrix} -1 & 1 & 0 \\ 0 & -1 & 1 \\ 2 & 3 & 4 \end{bmatrix}

Multiplying row by column, the entries cijc_{ij} of ABAB are

c11=1(−1)+2⋅0+3⋅2=5c12=1⋅1+2(−1)+3⋅3=8c13=1⋅0+2⋅1+3⋅4=14c21=0(−1)+1⋅0+0⋅2=0c22=0⋅1+1(−1)+0⋅3=−1c23=0⋅0+1⋅1+0⋅4=1c31=1(−1)+1⋅0+0⋅2=−1c32=1⋅1+1(−1)+0⋅3=0c33=1⋅0+1⋅1+0⋅4=1\begin{aligned} c_{11} &= 1(-1) + 2\cdot0 + 3\cdot2 = 5 \\ c_{12} &= 1\cdot1 + 2(-1) + 3\cdot3 = 8 \\ c_{13} &= 1\cdot0 + 2\cdot1 + 3\cdot4 = 14 \\ c_{21} &= 0(-1) + 1\cdot0 + 0\cdot2 = 0 \\ c_{22} &= 0\cdot1 + 1(-1) + 0\cdot3 = -1 \\ c_{23} &= 0\cdot0 + 1\cdot1 + 0\cdot4 = 1 \\ c_{31} &= 1(-1) + 1\cdot0 + 0\cdot2 = -1 \\ c_{32} &= 1\cdot1 + 1(-1) + 0\cdot3 = 0 \\ c_{33} &= 1\cdot0 + 1\cdot1 + 0\cdot4 = 1 \end{aligned} ∴ AB=[58140−11−101]\therefore\ AB = \begin{bmatrix} 5 & 8 & 14 \\ 0 & -1 & 1 \\ -1 & 0 & 1 \end{bmatrix}

Similarly, the entries dijd_{ij} of BABA are

d11=(−1)⋅1+1⋅0+0⋅1=−1d12=(−1)⋅2+1⋅1+0⋅1=−1d13=(−1)⋅3+1⋅0+0⋅0=−3d21=0⋅1+(−1)⋅0+1⋅1=1d22=0⋅2+(−1)⋅1+1⋅1=0d23=0⋅3+(−1)⋅0+1⋅0=0d31=2⋅1+3⋅0+4⋅1=6d32=2⋅2+3⋅1+4⋅1=11d33=2⋅3+3⋅0+4⋅0=6\begin{aligned} d_{11} &= (-1)\cdot1 + 1\cdot0 + 0\cdot1 = -1 \\ d_{12} &= (-1)\cdot2 + 1\cdot1 + 0\cdot1 = -1 \\ d_{13} &= (-1)\cdot3 + 1\cdot0 + 0\cdot0 = -3 \\ d_{21} &= 0\cdot1 + (-1)\cdot0 + 1\cdot1 = 1 \\ d_{22} &= 0\cdot2 + (-1)\cdot1 + 1\cdot1 = 0 \\ d_{23} &= 0\cdot3 + (-1)\cdot0 + 1\cdot0 = 0 \\ d_{31} &= 2\cdot1 + 3\cdot0 + 4\cdot1 = 6 \\ d_{32} &= 2\cdot2 + 3\cdot1 + 4\cdot1 = 11 \\ d_{33} &= 2\cdot3 + 3\cdot0 + 4\cdot0 = 6 \end{aligned} ∴ BA=[−1−1−31006116]\therefore\ BA = \begin{bmatrix} -1 & -1 & -3 \\ 1 & 0 & 0 \\ 6 & 11 & 6 \end{bmatrix}

∴ AB≠BA\therefore\ AB \ne BA⁠. Hence proved.

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

The one idea this problem is built on

In ABAB⁠, the rows of AA meet the columns of BB; in BABA the roles swap, so completely different sums are formed. Usually the results differ. To show that two matrices are unequal it is enough to find one position where they differ, but we compute both products in full so that you see every entry.

Given, to find, and the plan
Given
Part (i): two 2×22\times2 matrices. Part (ii): two 3×33\times3 matrices. In each part call the first matrix AA and the second BB⁠.
To show
AB≠BAAB \ne BA in each part.
Plan
For each part: (1) check both products are defined and find their orders; (2) compute every entry of ABAB⁠; (3) compute every entry of BABA⁠; (4) point to a position where they differ.

Basics you need

1Matrix multiplication

If AA is m×nm\times n and BB is n×pn\times p⁠, then ABAB is m×pm\times p and cikc_{ik} = row ii of AA times column kk of BB⁠: multiply matching entries, then add. Basics: pair up, multiply, add

2When are two matrices unequal?

Matrices of the same order are equal only if every pair of corresponding entries is equal. So one position with different entries proves they are unequal. Lesson: equality of matrices

3Order matters in a product

ABAB and BABA are different calculations. Even when both are defined and of the same order, they need not be equal. Lesson: matrix multiplication

Part (i): the 2×22\times2 pair

Here

A=[5−167],B=[2134].A = \begin{bmatrix} 5 & -1 \\ 6 & 7 \end{bmatrix}, \qquad B = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix}.
  1. Both products are defined

    AA and BB are both 2×22\times2⁠. For ABAB⁠: columns of AA (2) = rows of BB (2), so ABAB is defined and is 2×22\times2⁠. For BABA⁠: columns of BB (2) = rows of AA (2), so BABA is defined and is 2×22\times2⁠.

    If one product were undefined, or the two had different orders, they could not be equal and there would be nothing to compute. Here both are 2×22\times2⁠, so we must compare entries.
  2. Compute ABAB⁠, entry by entry

    Rows of AA⁠: (5,−1)(5, -1) and (6,7)(6, 7)⁠. Columns of BB⁠: (2,3)(2, 3) and (1,4)(1, 4)⁠, read top to bottom.

    c11=5⋅2+(−1)⋅3=10−3=7c12=5⋅1+(−1)⋅4=5−4=1c21=6⋅2+7⋅3=12+21=33c22=6⋅1+7⋅4=6+28=34\begin{aligned} c_{11} &= 5\cdot 2 + (-1)\cdot 3 = 10 - 3 = 7\\ c_{12} &= 5\cdot 1 + (-1)\cdot 4 = 5 - 4 = 1\\ c_{21} &= 6\cdot 2 + 7\cdot 3 = 12 + 21 = 33\\ c_{22} &= 6\cdot 1 + 7\cdot 4 = 6 + 28 = 34 \end{aligned} AB=[713334]AB = \begin{bmatrix} 7 & 1 \\ 33 & 34 \end{bmatrix}
    Entry cikc_{ik} uses row ii of the first factor and column kk of the second. The figure below shows c21c_{21}⁠.
    cik=ai1b1k+ai2b2kc_{ik} = a_{i1}b_{1k} + a_{i2}b_{2k}⁠. Basics: pair up, multiply, add
  3. Compute BABA⁠, entry by entry

    Now the rows come from BB⁠: (2,1)(2, 1) and (3,4)(3, 4)⁠; the columns come from AA⁠: (5,6)(5, 6) and (−1,7)(-1, 7)⁠.

    d11=2⋅5+1⋅6=10+6=16d12=2⋅(−1)+1⋅7=−2+7=5d21=3⋅5+4⋅6=15+24=39d22=3⋅(−1)+4⋅7=−3+28=25\begin{aligned} d_{11} &= 2\cdot 5 + 1\cdot 6 = 10 + 6 = 16\\ d_{12} &= 2\cdot(-1) + 1\cdot 7 = -2 + 7 = 5\\ d_{21} &= 3\cdot 5 + 4\cdot 6 = 15 + 24 = 39\\ d_{22} &= 3\cdot(-1) + 4\cdot 7 = -3 + 28 = 25 \end{aligned} BA=[1653925]BA = \begin{bmatrix} 16 & 5 \\ 39 & 25 \end{bmatrix}
    Swapping the factors swaps which matrix supplies the rows, so every entry is a different sum.
  4. Compare

    Both products are 2×22\times2⁠, but in position (1,1)(1,1)⁠, ABAB has 7 and BABA has 16. Since 7≠167 \ne 16⁠, AB≠BAAB \ne BA. (In fact all four positions differ.)

    Equality would need all four entries to agree; one disagreement is enough to rule it out.
5−167 2134 713334 = row 2 of A with column 1 of B: 6·2 + 7·3 = 33 the result goes in row 2, column 1 of AB
How one entry of ABAB is made: c21=6⋅2+7⋅3=33c_{21} = 6\cdot2 + 7\cdot3 = 33⁠. In BABA the row would come from BB and the column from AA⁠, giving d21=3⋅5+4⋅6=39d_{21} = 3\cdot5 + 4\cdot6 = 39 instead.

Part (ii): the 3×33\times3 pair

Here

A=[123010110],A = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 0 \\ 1 & 1 & 0 \end{bmatrix}, B=[−1100−11234].B =\begin{bmatrix} -1 & 1 & 0 \\ 0 & -1 & 1 \\ 2 & 3 & 4 \end{bmatrix}.
  1. Both products are defined

    Both matrices are 3×33\times3⁠. Columns of AA (3) = rows of BB (3), so ABAB is defined and 3×33\times3⁠; columns of BB (3) = rows of AA (3), so BABA is defined and 3×33\times3⁠.

    As in Part (i), Step 1: same order, so the comparison must be made entry by entry.
  2. Compute ABAB⁠, row by row

    Columns of BB⁠, top to bottom: (−1,0,2)(-1, 0, 2)⁠, (1,−1,3)(1, -1, 3)⁠, (0,1,4)(0, 1, 4)⁠.

    Row 1 of AA is (1,2,3)(1, 2, 3)⁠:

    c11=1(−1)+2(0)+3(2)=5c12=1(1)+2(−1)+3(3)=8c13=1(0)+2(1)+3(4)=14\begin{aligned} c_{11} &= 1(-1) + 2(0) + 3(2) = 5\\ c_{12} &= 1(1) + 2(-1) + 3(3) = 8\\ c_{13} &= 1(0) + 2(1) + 3(4) = 14 \end{aligned}

    Row 2 of AA is (0,1,0)(0, 1, 0)⁠:

    c21=0(−1)+1(0)+0(2)=0c22=0(1)+1(−1)+0(3)=−1c23=0(0)+1(1)+0(4)=1\begin{aligned} c_{21} &= 0(-1) + 1(0) + 0(2) = 0\\ c_{22} &= 0(1) + 1(-1) + 0(3) = -1\\ c_{23} &= 0(0) + 1(1) + 0(4) = 1 \end{aligned}

    Row 3 of AA is (1,1,0)(1, 1, 0)⁠:

    c31=1(−1)+1(0)+0(2)=−1c32=1(1)+1(−1)+0(3)=0c33=1(0)+1(1)+0(4)=1\begin{aligned} c_{31} &= 1(-1) + 1(0) + 0(2) = -1\\ c_{32} &= 1(1) + 1(-1) + 0(3) = 0\\ c_{33} &= 1(0) + 1(1) + 0(4) = 1 \end{aligned} AB=[58140−11−101]AB = \begin{bmatrix} 5 & 8 & 14 \\ 0 & -1 & 1 \\ -1 & 0 & 1 \end{bmatrix}
    For example c11=−1+0+6=5c_{11} = -1 + 0 + 6 = 5 and c12=1−2+9=8c_{12} = 1 - 2 + 9 = 8⁠. Row 2 of AA is (0,1,0)(0, 1, 0)⁠, so it simply picks out row 2 of BB⁠: (0,−1,1)(0, -1, 1)⁠.
    cik=ai1b1k+ai2b2k+ai3b3kc_{ik} = a_{i1}b_{1k} + a_{i2}b_{2k} + a_{i3}b_{3k}⁠. Basics: pair up, multiply, add
  3. Compute BABA⁠, row by row

    Now the columns come from AA⁠, top to bottom: (1,0,1)(1, 0, 1)⁠, (2,1,1)(2, 1, 1)⁠, (3,0,0)(3, 0, 0)⁠.

    Row 1 of BB is (−1,1,0)(-1, 1, 0)⁠:

    d11=−1(1)+1(0)+0(1)=−1d12=−1(2)+1(1)+0(1)=−1d13=−1(3)+1(0)+0(0)=−3\begin{aligned} d_{11} &= -1(1) + 1(0) + 0(1) = -1\\ d_{12} &= -1(2) + 1(1) + 0(1) = -1\\ d_{13} &= -1(3) + 1(0) + 0(0) = -3 \end{aligned}

    Row 2 of BB is (0,−1,1)(0, -1, 1)⁠:

    d21=0(1)+(−1)(0)+1(1)=1d22=0(2)+(−1)(1)+1(1)=0d23=0(3)+(−1)(0)+1(0)=0\begin{aligned} d_{21} &= 0(1) + (-1)(0) + 1(1) = 1\\ d_{22} &= 0(2) + (-1)(1) + 1(1) = 0\\ d_{23} &= 0(3) + (-1)(0) + 1(0) = 0 \end{aligned}

    Row 3 of BB is (2,3,4)(2, 3, 4)⁠:

    d31=2(1)+3(0)+4(1)=6d32=2(2)+3(1)+4(1)=11d33=2(3)+3(0)+4(0)=6\begin{aligned} d_{31} &= 2(1) + 3(0) + 4(1) = 6\\ d_{32} &= 2(2) + 3(1) + 4(1) = 11\\ d_{33} &= 2(3) + 3(0) + 4(0) = 6 \end{aligned} BA=[−1−1−31006116]BA = \begin{bmatrix} -1 & -1 & -3 \\ 1 & 0 & 0 \\ 6 & 11 & 6 \end{bmatrix}
    For example d32=4+3+4=11d_{32} = 4 + 3 + 4 = 11⁠. Every entry is a different sum from the one in the same position of ABAB⁠, because rows now come from BB⁠.
  4. Compare

    Both are 3×33\times3⁠, but in position (1,1)(1,1)⁠, ABAB has 5 and BABA has −1-1⁠. Since 5≠−15 \ne -1⁠, AB≠BAAB \ne BA.

    A single differing position settles inequality. (Comparing position by position, in fact all nine entries differ: for instance (2,3)(2,3) has 11 in ABAB and 00 in BABA⁠.)
Result

(i) ABAB has rows (7,1)(7, 1)⁠, (33,34)(33, 34)⁠, while BABA has rows (16,5)(16, 5)⁠, (39,25)(39, 25)⁠, so AB≠BAAB \ne BA⁠.

(ii) ABAB has rows (5,8,14)(5, 8, 14)⁠, (0,−1,1)(0, -1, 1)⁠, (−1,0,1)(-1, 0, 1)⁠, while BABA has rows (−1,−1,−3)(-1, -1, -3)⁠, (1,0,0)(1, 0, 0)⁠, (6,11,6)(6, 11, 6)⁠, so AB≠BAAB \ne BA⁠.

In both parts matrix multiplication is not commutative. (This is a "show that" question, so the key gives no separate answer.)

Check it with numbers

A quick independent check: the total of all entries of ABAB equals (column sums of AA⁠) times (row sums of BB⁠), paired up and added, because every product aijbjka_{ij}b_{jk} appears exactly once.

Part (i): column sums of AA are 11,611, 6⁠; row sums of BB are 3,73, 7⁠; so the total for ABAB is 11⋅3+6⋅7=7511\cdot3 + 6\cdot7 = 75⁠, and indeed 7+1+33+34=757+1+33+34 = 75 ✓. For BABA⁠: column sums of BB are 5,55, 5⁠, row sums of AA are 4,134, 13⁠, giving 5⋅4+5⋅13=855\cdot4 + 5\cdot13 = 85⁠, and 16+5+39+25=8516+5+39+25 = 85 ✓. The totals differ (75 and 85), which on its own shows AB≠BAAB \ne BA⁠.

Part (ii): column sums of AA are 2,4,32, 4, 3⁠; row sums of BB are 0,0,90, 0, 9⁠; total for ABAB is 2⋅0+4⋅0+3⋅9=272\cdot0 + 4\cdot0 + 3\cdot9 = 27⁠, and the entries of ABAB do add up to 27 ✓. Column sums of BB are 1,3,51, 3, 5⁠; row sums of AA are 6,1,26, 1, 2⁠; total for BABA is 6+3+10=196 + 3 + 10 = 19⁠, and the entries of BABA add up to 19 ✓.

Common mistakes
  1. Assuming AB=BAAB = BA as with numbers. For numbers ab=baab = ba always; for matrices this usually fails, as here.
  2. Taking rows from the second factor. In ABAB the rows always come from AA⁠, the factor on the left.
  3. Sign slips with −1-1⁠. For example d12=(−1)(2)+1⋅1=−1d_{12} = (-1)(2) + 1\cdot 1 = -1⁠, not 3.
What to take away
  1. ABAB uses rows of AA with columns of BB⁠; BABA uses rows of BB with columns of AA⁠. These are different calculations.
  2. To show two matrices are unequal, one differing position is enough; to show they are equal, every position must be checked.
  3. AB=BAAB = BA can happen for special pairs (Question 13's rotation matrices, diagonal matrices), but it is not a rule.

Every fact used, and where it comes from

FactUsed inSource
ABAB defined when columns of AA = rows of BB⁠; order m×pm\times pPart (i), Step 1; Part (ii), Step 1Section 3.4.5 (Lesson: multiplication)
Entry of ABAB⁠: row ii of AA times column kk of BBPart (i), Steps 2, 3; Part (ii), Steps 2, 3Section 3.4.5
Equal matrices: equal corresponding entriesPart (i), Step 4; Part (ii), Step 4Definition 2, Section 3.3.1
Matrix multiplication is not commutativeResultSection 3.4.5, Examples 13 and 14
Diagonal matrices of the same order commuteTake-away 3Section 3.4.5, note after Example 14
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 →