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

Example 13: Find ABAB and BABA⁠; show AB≠BAAB\ne BA

ExamplesNon-commutativity of matrix multiplication · Section 3.4.5
The question

If

A=[1−23−425]A = \begin{bmatrix} 1 & -2 & 3 \\ -4 & 2 & 5 \end{bmatrix}

and

B=[234521],B = \begin{bmatrix} 2 & 3 \\ 4 & 5 \\ 2 & 1 \end{bmatrix},

then find AB, BA. Show that AB ≠\ne BA.

Exam answer

AA is 2×32\times3 and BB is 3×23\times2⁠, so ABAB is 2×22\times2 and BABA is 3×33\times3⁠.

Let AB=[cij]AB = [c_{ij}]⁠.

c11=1⋅2+(−2)⋅4+3⋅2=0c12=1⋅3+(−2)⋅5+3⋅1=−4c21=(−4)⋅2+2⋅4+5⋅2=10c22=(−4)⋅3+2⋅5+5⋅1=3\begin{aligned} c_{11} &= 1{\cdot} 2 + (-2){\cdot} 4 + 3{\cdot} 2 = 0 \\ c_{12} &= 1{\cdot} 3 + (-2){\cdot} 5 + 3{\cdot} 1 = -4 \\ c_{21} &= (-4){\cdot} 2 + 2{\cdot} 4 + 5{\cdot} 2 = 10 \\ c_{22} &= (-4){\cdot} 3 + 2{\cdot} 5 + 5{\cdot} 1 = 3 \end{aligned} ∴ AB=[0−4103]\therefore\ AB = \begin{bmatrix} 0 & -4 \\ 10 & 3 \end{bmatrix}

Let BA=[dij]BA = [d_{ij}]⁠.

d11=2⋅1+3⋅(−4)=−10d12=2⋅(−2)+3⋅2=2d13=2⋅3+3⋅5=21d21=4⋅1+5⋅(−4)=−16d22=4⋅(−2)+5⋅2=2d23=4⋅3+5⋅5=37d31=2⋅1+1⋅(−4)=−2d32=2⋅(−2)+1⋅2=−2d33=2⋅3+1⋅5=11\begin{aligned} d_{11} &= 2{\cdot} 1 + 3{\cdot} (-4) = -10 \\ d_{12} &= 2{\cdot} (-2) + 3{\cdot} 2 = 2 \\ d_{13} &= 2{\cdot} 3 + 3{\cdot} 5 = 21 \\ d_{21} &= 4{\cdot} 1 + 5{\cdot} (-4) = -16 \\ d_{22} &= 4{\cdot} (-2) + 5{\cdot} 2 = 2 \\ d_{23} &= 4{\cdot} 3 + 5{\cdot} 5 = 37 \\ d_{31} &= 2{\cdot} 1 + 1{\cdot} (-4) = -2 \\ d_{32} &= 2{\cdot} (-2) + 1{\cdot} 2 = -2 \\ d_{33} &= 2{\cdot} 3 + 1{\cdot} 5 = 11 \end{aligned} ∴ BA=[−10221−16237−2−211]\therefore\ BA = \begin{bmatrix} -10 & 2 & 21 \\ -16 & 2 & 37 \\ -2 & -2 & 11 \end{bmatrix}

ABAB is 2×22\times2 and BABA is 3×33\times3⁠, so AB≠BAAB \ne BA⁠.

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

The one idea this problem is built on

Swapping the order of the factors changes which rows meet which columns, and it can even change the size of the answer. Here AA is 2×32\times3 and BB is 3×23\times2⁠, so ABAB is 2×22\times2 while BABA is 3×33\times3⁠. Two matrices of different orders can never be equal, so AB≠BAAB\ne BA follows the moment we know the orders. We still compute both products in full, as the question asks.

Given, to find, and the plan
Given
AA of order 2×32\times3 and BB of order 3×23\times2⁠.
To find / show
ABAB and BABA⁠, and that AB≠BAAB\ne BA⁠.
Plan
Check both products are defined and find their orders. Compute the 4 entries of ABAB and the 9 entries of BABA as row-times-column sums. Conclude using the definition of equal matrices.

Basics you need

1When a product is defined, and its order

If AA is m×nm\times n and BB is n×pn\times p⁠, then ABAB is defined and is m×pm\times p⁠. Basics: rows, columns and the address

2Row times column

The (i,k)(i,k) entry of ABAB is row ii of AA times column kk of BB⁠: pair the entries in order, multiply, add. Basics: pair up, multiply, add

3Equal matrices

Two matrices are equal only if they have the same order and every pair of corresponding entries is equal. Lesson: equality of matrices

4Signs in products

(−2)⋅4=−8(-2)\cdot 4=-8⁠, (−4)⋅(−2)=8(-4)\cdot(-2)=8⁠, (−4)⋅3=−12(-4)\cdot 3=-12⁠: a product of two numbers of opposite sign is negative, of the same sign positive.

Solution

  1. Check both products and find their orders

    ABAB⁠: AA is 2×32\times\mathbf{3}⁠, BB is 3×2\mathbf{3}\times2⁠. Inner sizes 3=33=3⁠, so ABAB is defined, of order 2×22\times2⁠.

    BABA⁠: BB is 3×23\times\mathbf{2}⁠, AA is 2×3\mathbf{2}\times3⁠. Inner sizes 2=22=2⁠, so BABA is defined, of order 3×33\times3⁠.

    AB: inner sizes 3 and 3 match A: 2 × 3 × B: 3 × 2 = AB: 2 × 2 BA: inner sizes 2 and 2 match B: 3 × 2 × A: 2 × 3 = BA: 3 × 3 outer sizes give 2 × 2 outer sizes give 3 × 3
    Write the orders side by side. The inner sizes must match for the product to exist; the outer sizes give the order of the answer. Swapping the factors changes the outer sizes, so ABAB and BABA have different orders.
    This is the textbook's condition for both products to exist: with AA of order m×nm\times n and BB of order k×lk\times l⁠, we need n=kn=k and l=ml=m⁠. Here m=2m=2⁠, n=3n=3⁠, k=3k=3⁠, l=2l=2⁠, so both hold.
    Order of a product, Section 3.4.5. Lesson: matrix multiplication
  2. Compute the four entries of ABAB

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

    c11=1⋅2+(−2)⋅4+3⋅2=2−8+6=0c12=1⋅3+(−2)⋅5+3⋅1=3−10+3=−4c21=(−4)⋅2+2⋅4+5⋅2=−8+8+10=10c22=(−4)⋅3+2⋅5+5⋅1=−12+10+5=3\begin{aligned} c_{11} &= 1\cdot 2 + (-2)\cdot 4 + 3\cdot 2\\ &= 2 - 8 + 6 = 0\\ c_{12} &= 1\cdot 3 + (-2)\cdot 5 + 3\cdot 1\\ &= 3 - 10 + 3 = -4\\ c_{21} &= (-4)\cdot 2 + 2\cdot 4 + 5\cdot 2\\ &= -8 + 8 + 10 = 10\\ c_{22} &= (-4)\cdot 3 + 2\cdot 5 + 5\cdot 1\\ &= -12 + 10 + 5 = 3 \end{aligned} AB=[0−4103]AB = \begin{bmatrix} 0 & -4 \\ 10 & 3 \end{bmatrix}
    Each row of AA has three entries and each column of BB has three, so every entry of ABAB is a sum of three products. Writing the products with their signs in brackets, such as (−2)⋅4(-2)\cdot4⁠, before adding is the surest way to keep the signs right.
    cik=ai1b1k+ai2b2k+ai3b3kc_{ik}=a_{i1}b_{1k}+a_{i2}b_{2k}+a_{i3}b_{3k}⁠. Basics: pair up, multiply, add
  3. Compute the nine entries of BABA

    Now the rows come from BB⁠: [2  3][2\ \ 3]⁠, [4  5][4\ \ 5]⁠, [2  1][2\ \ 1]⁠. The columns come from AA⁠: (1,−4)(1,-4)⁠, (−2,2)(-2,2)⁠, (3,5)(3,5)⁠. Each entry is a sum of two products. Write BA=[dik]BA=[d_{ik}]⁠:

    d11=2⋅1+3⋅(−4)=2−12=−10d12=2⋅(−2)+3⋅2=−4+6=2d13=2⋅3+3⋅5=6+15=21d21=4⋅1+5⋅(−4)=4−20=−16d22=4⋅(−2)+5⋅2=−8+10=2d23=4⋅3+5⋅5=12+25=37d31=2⋅1+1⋅(−4)=2−4=−2d32=2⋅(−2)+1⋅2=−4+2=−2d33=2⋅3+1⋅5=6+5=11\begin{aligned} d_{11} &= 2\cdot 1 + 3\cdot(-4) = 2 - 12 = -10\\ d_{12} &= 2\cdot(-2) + 3\cdot 2 = -4 + 6 = 2\\ d_{13} &= 2\cdot 3 + 3\cdot 5 = 6 + 15 = 21\\ d_{21} &= 4\cdot 1 + 5\cdot(-4) = 4 - 20 = -16\\ d_{22} &= 4\cdot(-2) + 5\cdot 2 = -8 + 10 = 2\\ d_{23} &= 4\cdot 3 + 5\cdot 5 = 12 + 25 = 37\\ d_{31} &= 2\cdot 1 + 1\cdot(-4) = 2 - 4 = -2\\ d_{32} &= 2\cdot(-2) + 1\cdot 2 = -4 + 2 = -2\\ d_{33} &= 2\cdot 3 + 1\cdot 5 = 6 + 5 = 11 \end{aligned} BA=[−10221−16237−2−211]BA = \begin{bmatrix} -10 & 2 & 21 \\ -16 & 2 & 37 \\ -2 & -2 & 11 \end{bmatrix}
    In BABA the roles swap: rows of BB (length 2) meet columns of AA (length 2). That is why these sums have two terms, while those for ABAB had three. The two products are built from entirely different pairings, so there is no reason to expect them to agree.
  4. Conclude that AB≠BAAB\ne BA

    ABAB has order 2×22\times2 and BABA has order 3×33\times3⁠. Equal matrices must have the same order, so AB≠BAAB\ne BA.

    We do not need to compare entries at all: there is no entry (3,3)(3,3) in ABAB to compare with the 11 in BABA⁠. Equality fails at the first requirement, the order.
    Definition 2, Section 3.3.1: A=[aij]A=[a_{ij}] and B=[bij]B=[b_{ij}] are equal if they are of the same order and aij=bija_{ij}=b_{ij} for all i,ji,j⁠. Lesson: equality of matrices
  5. What this shows about matrix multiplication

    Even when both ABAB and BABA exist, they need not be equal. The textbook goes on (Example 14) to show that this can happen even when ABAB and BABA have the same order, so the failure is not only about sizes. Matrix multiplication is not commutative.

    For numbers ab=baab=ba always. For matrices, the order of the factors decides which rows meet which columns, so in general you must keep the order exactly as written. See Example 14 for two 2×22\times2 matrices with AB≠BAAB\ne BA⁠.
Result AB=[0−4103]AB = \begin{bmatrix} 0 & -4 \\ 10 & 3 \end{bmatrix} BA=[−10221−16237−2−211]BA = \begin{bmatrix} -10 & 2 & 21 \\ -16 & 2 & 37 \\ -2 & -2 & 11 \end{bmatrix}

ABAB is 2×22\times2 and BABA is 3×33\times3⁠, so AB≠BAAB\ne BA⁠. This matches the textbook's solution.

Check it with numbers

A fact that is not in the textbook (a property of the trace) gives a neat test: the sum of the diagonal entries of ABAB always equals that of BABA⁠, whenever both products exist. Here 0+3=30+3=3 and −10+2+11=3-10+2+11=3⁠. They agree, which is good evidence that no diagonal entry was miscalculated.

A second spot check: entry (2,3)(2,3) of BABA is row 2 of BB⁠, [4  5][4\ \ 5]⁠, times column 3 of AA⁠, (3,5)(3,5)⁠, giving 12+25=3712+25=37⁠, as in Step 3.

Common mistakes
  1. Thinking BABA is "ABAB turned round". It is a different matrix, here not even the same size.
  2. Sign slips. (−4)⋅3=−12(-4)\cdot 3=-12 and 3⋅(−4)=−123\cdot(-4)=-12⁠; write the sign of every product before adding.
  3. Mixing up which matrix gives the rows. In BABA the rows come from BB⁠, the first factor, and the columns from AA⁠.
  4. Comparing entries before orders. Different orders already settle AB≠BAAB\ne BA⁠.
What to take away
  1. For AA of order m×nm\times n and BB of order n×mn\times m⁠, ABAB is m×mm\times m and BABA is n×nn\times n⁠. If m≠nm\ne n they cannot be equal.
  2. In a product the first factor supplies the rows and the second supplies the columns.
  3. Matrix multiplication is not commutative: never swap factors unless you have a reason.

Every fact used, and where it comes from

FactUsed inSource
ABAB defined iff columns of AA = rows of BB⁠; order m×pm\times pStep 1Section 3.4.5 and the Remark after Example 12 (Lesson: matrix multiplication)
cik=∑jaijbjkc_{ik}=\sum_j a_{ij}b_{jk}Steps 2 and 3Section 3.4.5, definition of the product
Equal matrices have the same order and equal entriesStep 4Definition 2, Section 3.3.1 (Lesson: equality)
Matrix multiplication is not commutativeStep 5Section 3.4.5, "Non-commutativity of multiplication of matrices"
Diagonal sums of ABAB and BABA are equalCheck box onlyBeyond the syllabus (a property of the trace); not needed for the solution
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 →