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

Example 14: AB≠BAAB\ne BA for two 2×22\times2 matrices

ExamplesNon-commutativity of matrix multiplication · Section 3.4.5
The question

If

A=[100−1] and B=[0110],A = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\ \text{and}\ B = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix},

then

AB=[01−10]AB = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix}

and

BA=[0−110].BA = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}.

Clearly AB ≠\ne BA.

Exam answer AB=[1⋅0+0⋅11⋅1+0⋅00⋅0+(−1)⋅10⋅1+(−1)⋅0]=[01−10]\begin{aligned} &AB \\ &= \begin{bmatrix} 1{\cdot}0 + 0{\cdot}1 & 1{\cdot}1 + 0{\cdot}0 \\ 0{\cdot}0 + (-1){\cdot}1 & 0{\cdot}1 + (-1){\cdot}0 \end{bmatrix} \\ &= \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} \end{aligned} BA=[0⋅1+1⋅00⋅0+1⋅(−1)1⋅1+0⋅01⋅0+0⋅(−1)]=[0−110]\begin{aligned} &BA \\ &= \begin{bmatrix} 0{\cdot}1 + 1{\cdot}0 & 0{\cdot}0 + 1{\cdot}(-1) \\ 1{\cdot}1 + 0{\cdot}0 & 1{\cdot}0 + 0{\cdot}(-1) \end{bmatrix} \\ &= \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} \end{aligned}

The (1,2)(1, 2) entries differ (1≠−11 \ne -1⁠), so AB≠BAAB \ne BA⁠.

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

The one idea this problem is built on

In Example 13, AB≠BAAB\ne BA because the two products had different sizes. Here both AA and BB are 2×22\times2⁠, so ABAB and BABA are both 2×22\times2⁠, and still they differ. So non-commutativity is not just a matter of sizes: the order of the factors changes the answer itself. To show two same-size matrices are unequal, one entry that differs is enough.

Given, to show, and the plan
Given
The 2×22\times2 matrices AA and BB⁠.
To show
ABAB and BABA are as stated, and AB≠BAAB\ne BA⁠.
Plan
Compute all four entries of each product, compare them entry by entry, and then look at the picture behind the numbers: AA and BB are two reflections, and doing two reflections in a different order gives a different result.

Basics you need

1Row times column

The (i,k)(i,k) entry of ABAB is row ii of AA times column kk of BB⁠. For 2×22\times2 matrices: cik=ai1b1k+ai2b2kc_{ik}=a_{i1}b_{1k}+a_{i2}b_{2k}⁠. Basics: pair up, multiply, add

2Equal matrices

Same order and every corresponding entry equal. So one unequal entry proves two matrices of the same order are different. Lesson: equality of matrices

3Square matrices and diagonal matrices

A square matrix has as many rows as columns. A diagonal matrix is a square matrix whose entries off the main diagonal are all 0; AA here is diagonal. Lesson: types of matrices

Solution

  1. Both products are defined and both are 2×22\times2

    AA and BB are square of the same order 2. For ABAB⁠: (2×2)(2×2)(2\times2)(2\times2)⁠, inner sizes equal, result 2×22\times2⁠. For BABA⁠: the same. So ABAB and BABA exist and have the same order.

    This is the case the textbook raises after Example 13: "perhaps AB and BA could be the same if they were of the same order". We now test that guess.
    If AA and BB are square matrices of the same order, both ABAB and BABA are defined (Remark after Example 12). Basics: rows, columns and the address
  2. Compute ABAB

    Rows of AA⁠: [1  0][1\ \ 0] and [0  −1][0\ \ {-1}]⁠. Columns of BB⁠: (0,1)(0,1) and (1,0)(1,0)⁠.

    c11=1⋅0+0⋅1=0c12=1⋅1+0⋅0=1c21=0⋅0+(−1)⋅1=−1c22=0⋅1+(−1)⋅0=0\begin{aligned} c_{11} &= 1\cdot 0 + 0\cdot 1 = 0\\ c_{12} &= 1\cdot 1 + 0\cdot 0 = 1\\ c_{21} &= 0\cdot 0 + (-1)\cdot 1 = -1\\ c_{22} &= 0\cdot 1 + (-1)\cdot 0 = 0 \end{aligned} AB=[01−10]AB = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix}
    Multiplying BB on the left by AA keeps row 1 of BB and changes the sign of row 2: AA multiplies the first row by 1 and the second row by −1-1⁠. Row 2 of BB is [1  0][1\ \ 0]⁠, so it becomes [−1  0][-1\ \ 0]⁠.
  3. Compute BABA

    Rows of BB⁠: [0  1][0\ \ 1] and [1  0][1\ \ 0]⁠. Columns of AA⁠: (1,0)(1,0) and (0,−1)(0,-1)⁠. Write BA=[dik]BA=[d_{ik}]⁠:

    d11=0⋅1+1⋅0=0d12=0⋅0+1⋅(−1)=−1d21=1⋅1+0⋅0=1d22=1⋅0+0⋅(−1)=0\begin{aligned} d_{11} &= 0\cdot 1 + 1\cdot 0 = 0\\ d_{12} &= 0\cdot 0 + 1\cdot(-1) = -1\\ d_{21} &= 1\cdot 1 + 0\cdot 0 = 1\\ d_{22} &= 1\cdot 0 + 0\cdot(-1) = 0 \end{aligned} BA=[0−110]BA = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}
    Multiplying by AA on the right acts on columns instead: it keeps column 1 of BB and changes the sign of column 2. Column 2 of BB is (1,0)(1,0)⁠, which becomes (−1,0)(-1,0)⁠. Acting on rows and acting on columns are different operations, which is the root of AB≠BAAB\ne BA⁠.
  4. Compare entry by entry

    Both are 2×22\times2⁠, so we compare corresponding entries. The (1,2)(1,2) entries are 11 in ABAB and −1-1 in BABA⁠. They are different, so AB≠BAAB\ne BA.

    In fact the (2,1)(2,1) entries differ too (−1-1 against 11⁠), and every entry of BABA is the negative of the matching entry of ABAB⁠: BA=−ABBA=-AB⁠.

    Equality needs all corresponding entries equal, so a single mismatch is a complete proof of inequality. Matching orders did not rescue commutativity: matrix multiplication is not commutative, even for square matrices of the same order.
    Definition 2, Section 3.3.1: equal matrices have the same order and equal corresponding entries. Lesson: equality of matrices
  5. The picture behind the numbers (beyond the textbook)

    This step is not in the textbook's solution and is not needed for the answer; it shows what the two matrices do. Multiply each matrix by a column (x,y)(x,y)⁠:

    A[xy]=[x−y],B[xy]=[yx].A\begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} x \\ -y \end{bmatrix}, \qquad B\begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} y \\ x \end{bmatrix}.

    So AA reflects a point in the xx-axis and BB reflects it in the line y=xy=x⁠. ABP=A(BP)ABP=A(BP) means "apply BB first, then AA", and BAP=B(AP)BAP=B(AP) means "apply AA first, then BB". For P=(2,1)P=(2,1)⁠:

    BB first, then AA⁠:

    (2,1)→(1,2)→(1,−2)(2,1)\to(1,2)\to(1,-2)

    AA first, then BB⁠:

    (2,1)→(2,−1)→(−1,2)(2,1)\to(2,-1)\to(-1,2)
    y = x x y P (2, 1) BP (1, 2) ABP (1, −2) AP (2, −1) BAP (−1, 2) blue: B first, then A rose: A first, then B
    Beyond the textbook: AA reflects in the xx-axis and BB reflects in the line y=xy=x⁠. Starting from P(2,1)P(2,1)⁠, doing BB then AA (that is, ABAB⁠) ends at (1,−2)(1,-2)⁠, but doing AA then BB (that is, BABA⁠) ends at (−1,2)(-1,2)⁠.
    The two routes end at different points, so the two products cannot be the same matrix. Check with the matrices of Steps 2 and 3: ABAB sends (2,1)(2,1) to (0⋅2+1⋅1, −1⋅2+0⋅1)=(1,−2)(0\cdot2+1\cdot1,\ -1\cdot2+0\cdot1)=(1,-2)⁠, and BABA sends it to (0⋅2−1⋅1, 1⋅2+0⋅1)=(−1,2)(0\cdot2-1\cdot1,\ 1\cdot2+0\cdot1)=(-1,2)⁠. The grouping A(BP)=(AB)PA(BP)=(AB)P is the associative law of Section 3.4.6.
    Writing ABAB means BB acts first: the factor nearest the column acts on it first. Lesson: properties of the operations
  6. Not every pair fails: the textbook's note

    Non-commutativity means AB=BAAB=BA is not guaranteed, not that it always fails. The textbook's Note gives diagonal matrices:

    [1002][3004]=[3008],[3004][1002]=[3008].\begin{aligned} &\begin{bmatrix} 1 & 0 \\ 0 & 2 \end{bmatrix}\begin{bmatrix} 3 & 0 \\ 0 & 4 \end{bmatrix} = \begin{bmatrix} 3 & 0 \\ 0 & 8 \end{bmatrix},\\ &\begin{bmatrix} 3 & 0 \\ 0 & 4 \end{bmatrix}\begin{bmatrix} 1 & 0 \\ 0 & 2 \end{bmatrix} = \begin{bmatrix} 3 & 0 \\ 0 & 8 \end{bmatrix}. \end{aligned}

    Entry by entry, the first product is 1⋅3+0⋅0=31\cdot3+0\cdot0=3⁠, 1⋅0+0⋅4=01\cdot0+0\cdot4=0⁠, 0⋅3+2⋅0=00\cdot3+2\cdot0=0⁠, 0⋅0+2⋅4=80\cdot0+2\cdot4=8⁠; the second is 3⋅1+0⋅0=33\cdot1+0\cdot0=3⁠, 3⋅0+0⋅2=03\cdot0+0\cdot2=0⁠, 0⋅1+4⋅0=00\cdot1+4\cdot0=0⁠, 0⋅0+4⋅2=80\cdot0+4\cdot2=8⁠.

    For diagonal matrices of the same order, each product just multiplies the diagonal entries in matching places: 1⋅31\cdot3 and 2⋅42\cdot4⁠. Multiplication of numbers is commutative, so the products agree. Our BB is not diagonal, so the Note does not apply to the pair AA⁠, BB of this example. (Being non-diagonal does not by itself force AB≠BAAB\ne BA⁠: for instance every square matrix commutes with itself. For our pair, Step 4 is what proves it.)
Result AB=[01−10]AB = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} BA=[0−110]BA = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}

Both are 2×22\times2 but their (1,2)(1,2) entries differ (1≠−11\ne-1⁠), so AB≠BAAB\ne BA⁠, as the textbook states. Matrix multiplication is not commutative.

Check it with numbers

Apply both products to the column (3,5)(3,5)⁠. ABAB gives (0⋅3+1⋅5, −1⋅3+0⋅5)=(5,−3)(0\cdot3+1\cdot5,\ -1\cdot3+0\cdot5)=(5,-3)⁠. BABA gives (0⋅3−1⋅5, 1⋅3+0⋅5)=(−5,3)(0\cdot3-1\cdot5,\ 1\cdot3+0\cdot5)=(-5,3)⁠. Different outputs for the same input, so the matrices differ; and (−5,3)=−(5,−3)(-5,3)=-(5,-3)⁠, confirming BA=−ABBA=-AB⁠.

Common mistakes
  1. Believing same order means AB=BAAB=BA⁠. This example is the counterexample.
  2. Overcorrecting. AB≠BAAB\ne BA in general does not mean AB≠BAAB\ne BA for every pair; diagonal matrices of the same order commute.
  3. Reading ABAB as "A first". Acting on a column, ABP=A(BP)ABP=A(BP)⁠: BB acts first.
  4. Sign slips with −1-1⁠. 0⋅0+(−1)⋅1=−10\cdot0+(-1)\cdot1=-1⁠, not 11⁠.
What to take away
  1. To show two matrices of the same order are unequal, exhibit one position where the entries differ.
  2. Left multiplication by a diagonal matrix scales rows; right multiplication scales columns. These are different, which is one way to see why order matters.
  3. Geometrically, ABAB means "do BB⁠, then AA". Two reflections done in different orders usually end in different places.

Every fact used, and where it comes from

FactUsed inSource
Square matrices of the same order: ABAB and BABA both definedStep 1Remark after Example 12, Section 3.4.5
cik=ai1b1k+ai2b2kc_{ik}=a_{i1}b_{1k}+a_{i2}b_{2k}Steps 2, 3 and 6Section 3.4.5, definition of the product (Lesson: matrix multiplication)
Equality of matricesStep 4Definition 2, Section 3.3.1
AA and BB as reflections of the planeStep 5Beyond the textbook (not needed for the solution)
(AB)P=A(BP)(AB)P=A(BP)Step 5Associative law, Section 3.4.6 (Lesson: properties)
Diagonal matrices of the same order commuteStep 6Note after Example 14, Section 3.4.5; diagonal matrix, Section 3.3 (Lesson: types)
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 →