girgit.org

Matrices

Why AB is not BA, and other surprises of matrix multiplication

The big ideaMatrix multiplication keeps some rules of ordinary multiplication (brackets, spreading over addition, a "1" that changes nothing) but breaks two big ones: AB is usually not BA, and AB can be O when neither A nor B is O.

In simple words

With plain numbers, 3 times 5 is the same as 5 times 3, and if two numbers multiply to zero then one of them was zero. Matrices do not keep these promises. Swap the two and the answer often changes. Two grids full of non-zero numbers can multiply to a grid of only zeros. Most mistakes in this chapter come from forgetting this.

Guess first: does AB equal BA?

Take \( A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \) and \( B = \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix} \). Both are 2 × 2, so AB and BA both exist and have the same size. Guess: are they equal?

See what happens
\[ AB = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix}, \qquad BA = \begin{bmatrix} 1 & 1 \\ 1 & 2 \end{bmatrix}. \] No. AB uses the rows of A with the columns of B; BA uses the rows of B with the columns of A. Those are different pairings, so in general different numbers come out. Matrix multiplication is not commutative.

There are three ways AB and BA can fail to match:

  1. One is defined and the other is not (A is 2 × 3, B is 3 × 4: AB exists, BA does not).
  2. Both are defined but have different orders (A is 2 × 3, B is 3 × 2: AB is 2 × 2, BA is 3 × 3).
  3. Both are defined, same order, but the entries differ, as above.

This does not mean AB ≠ BA for every pair. Some pairs commute (AB = BA): two diagonal matrices of the same order, any square A with I or with a scalar matrix kI, and A with its own powers \( A^2, A^3, \ldots \).

Try it: a 2 × 2 matrix moves every point of the plane, so you can watch it move a picture. Play both orders of the same two moves side by side.

Guess first: can AB = O with A ≠ O and B ≠ O?

For numbers, if ab = 0 then a = 0 or b = 0. Guess: is it the same for matrices? Try \( A = \begin{bmatrix} 1 & 1 \\ 2 & 2 \end{bmatrix} \) and \( B = \begin{bmatrix} 1 & -1 \\ -1 & 1 \end{bmatrix} \).

See what happens
\[ AB = \begin{bmatrix} 1 - 1 & -1 + 1 \\ 2 - 2 & -2 + 2 \end{bmatrix} = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} = O. \] Neither A nor B is the zero matrix, yet their product is. Each row of A is a multiple of [1 1], and each column of B adds to zero, so every row-column pairing cancels. Even stranger, \( BA = \begin{bmatrix} -1 & -1 \\ 1 & 1 \end{bmatrix} \neq O \). And a single matrix can do it to itself: \( N = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} \) gives \( N^2 = O \).

A consequence: you cannot cancel. From AB = AC you may not conclude B = C. With the A above, \( B = \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} \) and \( C = \begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix} \) are different, yet \( AB = AC = \begin{bmatrix} 2 & 1 \\ 4 & 2 \end{bmatrix} \).

Try it: find your own non-zero B with AB = O by dragging the two columns of B.

The rules that do hold

NCERT states these without proof. Whenever both sides are defined:

  1. Associative law: (AB)C = A(BC). You may multiply in any grouping, as long as you keep the left-to-right order of A, B, C.
  2. Distributive law: A(B + C) = AB + AC and (A + B)C = AC + BC. Keep each matrix on its own side.
  3. Multiplicative identity: for every square matrix A there is an identity matrix I of the same order with IA = AI = A.

Quick check of (AB)C = A(BC) with \( A = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix} \), \( B = \begin{bmatrix} 3 & 0 \\ 1 & 2 \end{bmatrix} \), \( C = \begin{bmatrix} 1 & -1 \\ 2 & 0 \end{bmatrix} \): AB = \( \begin{bmatrix} 5 & 4 \\ 1 & 2 \end{bmatrix} \) and BC = \( \begin{bmatrix} 3 & -3 \\ 5 & -1 \end{bmatrix} \); both routes give \( \begin{bmatrix} 13 & -5 \\ 5 & -1 \end{bmatrix} \).

Algebra with matrices

For a square matrix, \( A^2 = AA \), \( A^3 = AAA \), and so on. Old formulas need care:

\[ (A + B)^2 = A^2 + AB + BA + B^2, \]

which equals \( A^2 + 2AB + B^2 \) only if AB = BA. With the A and B from the first trap, \( (A + B)^2 = \begin{bmatrix} 5 & 4 \\ 4 & 5 \end{bmatrix} \) but \( A^2 + 2AB + B^2 = \begin{bmatrix} 6 & 4 \\ 4 & 4 \end{bmatrix} \).

Worked example: a matrix polynomial

Show that \( A = \begin{bmatrix} 2 & 1 \\ 1 & 3 \end{bmatrix} \) satisfies \( A^2 - 5A + 5I = O \).

  1. \( A^2 = \begin{bmatrix} 4 + 1 & 2 + 3 \\ 2 + 3 & 1 + 9 \end{bmatrix} = \begin{bmatrix} 5 & 5 \\ 5 & 10 \end{bmatrix} \).
  2. \( 5A = \begin{bmatrix} 10 & 5 \\ 5 & 15 \end{bmatrix} \) and \( 5I = \begin{bmatrix} 5 & 0 \\ 0 & 5 \end{bmatrix} \).
  3. \( A^2 - 5A + 5I = \begin{bmatrix} 5 - 10 + 5 & 5 - 5 + 0 \\ 5 - 5 + 0 & 10 - 15 + 5 \end{bmatrix} = O \).

The constant term is written 5I, not 5: you can only add matrices to matrices.

Not in the current textbook, but JEE asks it: a square matrix is idempotent if \( A^2 = A \), involutory if \( A^2 = I \), and nilpotent if \( A^k = O \) for some k (like N above). JEE also likes power patterns: for \( A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \), \( A^n = \begin{bmatrix} 1 & n \\ 0 & 1 \end{bmatrix} \), which you can prove by induction. And trace(AB) = trace(BA) even when AB ≠ BA.

Don't mix these up

  • AB ≠ BA in general; order matters. "Pre-multiply by A" means A on the left, "post-multiply" means A on the right.
  • AB = O does not mean A = O or B = O.
  • AB = AC does not give B = C.
  • \( (A + B)^2 = A^2 + 2AB + B^2 \) only when A and B commute.

Words to know

Commute
A and B commute if AB = BA.
Non-commutative
Order of multiplication can change the answer.
Associative law
(AB)C = A(BC): grouping doesn't matter.
Distributive law
A(B + C) = AB + AC and (A + B)C = AC + BC.
Multiplicative identity
I, since IA = AI = A.
Idempotent / nilpotent
\( A^2 = A \) / some power of A is O.

A and B are non-zero 2 × 2 matrices with AB = O. What must be true?

  1. One of them is really O
  2. BA = O as well
  3. None of these need hold; it can happen with both non-zero

If \( A^2 = A \), what is \( (I + A)^2 \)?

  1. I + A
  2. I + 3A
  3. I + 2A

Which pair is guaranteed to commute?

  1. Any two 2 × 2 matrices
  2. Any two non-zero matrices
  3. Two 3 × 3 diagonal matrices