Euler Hall — free maths guides

Show that AB and BA can differ

Decide which of AB and BA exist for a rectangular pair. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.

Plain words first

Three separate statements, in increasing order of what they cost you:

1. *BABA may not exist.ABAB exists when the columns ofAA match the rows ofBB.BABA needs the columns ofBB to match the rows ofAA. For a rectangular pair, usually exactly one of those holds. 2. When both exist, they usually differ. Even for two square matrices of the same size,AB≠BAAB\ne BA in general. 3. Some pairs do commute.** Two diagonal matrices, anything with the identity, a matrix with its own powers. Commuting is a special property of the pair.

What is always true is associativity:(AB)C=A(BC)(AB)C=A(BC). The grouping never matters. The order does.

Why order matters, mechanically and conceptually

Mechanically. Entry(i,j)(i,j) ofABAB is rowii ofAA dotted with columnjj ofBB. ForBABA it is rowii ofBB dotted with columnjj ofAA. Those pair up different numbers — there is no reason for them to agree, and usually they do not. Write out both for a2×22\times2:ABAB hasa11b12+a12b22a_{11}b_{12}+a_{12}b_{22} in its top-right corner, whileBABA hasb11a12+b12a22b_{11}a_{12}+b_{12}a_{22}. Different terms.

Conceptually. Matrices act on vectors, and acting twice is a composition of two operations. "Turn left, then walk forward" is not the same as "walk forward, then turn left", even though both are two moves. Composition of functions is not commutative in general, and matrix multiplication is exactly composition.

This is why associativity survives while commutativity does not. Grouping three actions is free — do them in a different parenthesisation and it is still the same three actions in the same order. Reordering changes which action comes first.

Worked example, with a rectangle

AA is2×32\times3 andBB is3×23\times2. ThenABAB is2×22\times2. What aboutBABA? It needsBB's columns (that is22) to matchAA's rows (that is22) — soBABA is3×33\times3.

which is2×22\times2, while

BA=[102011113]BA=\begin{bmatrix}1&0&2\\0&1&1\\1&1&3\end{bmatrix}

is3×33\times3. Both products exist here, they have different sizes, and no entry of one can be compared with an entry of the other. "Are they equal?" is not even a well-formed question.

By the end you can
  • Decide which of AB and BA exist for a rectangular pair
  • Compute both products and compare them entry by entry
  • Construct a pair with AB not equal to BA and explain the difference
Check yourself

Give a2×22\times2 matrixBB that commutes with every2×22\times2 matrix, and one that does not, and justify both in one sentence each.

Answer

Commutes with everything:B=2I=[2002]B=2I=\begin{bmatrix}2&0\\0&2\end{bmatrix}. For anyAA,A(2I)=2A=(2I)AA(2I)=2A=(2I)A, because scalars pass through a product.

Does not commute:B=[0100]B=\begin{bmatrix}0&1\\0&0\end{bmatrix}. TakeA=[0010]A=\begin{bmatrix}0&0\\1&0\end{bmatrix}: thenAB=[0001]AB=\begin{bmatrix}0&0\\0&1\end{bmatrix} (trace11, kills the first coordinate) butBA=[1000]BA=\begin{bmatrix}1&0\\0&0\end{bmatrix} (trace11, kills the second). Two different projections onto two different axes — the operations genuinely differ.

The general fact: the matrices that commute with everything are exactly the scalar multiples of the identity.

Work out where to start — free, no accountAnswer six real questions — free, no account