### Composition and Matrix Multiplication

The following exercises provide more examples that AB = BA is generally not true.

Exercise For each of the following matrix A, find all the matrices X satisfying AX = XA.

1)

 A = [ 1 2 ]

Answer No X will satisfy AX = XA because AX and XA have different sizes. Specifically, in order for AX to be meaningful, X must have two rows. In order for XA to be meaningful X must have one column. Then AX is a 1 by 1 matrix, and XA is a 2 by 2 matrix.

2)

 A = [ 1 1 ] 1 -1

Answer Similar argument as in the first question shows that X must be a 2 by 2 matrix. Let

 X = [ x y ] z w

Then

 AX = [ x + z y + w ], XA = [ x + y x - y ] x - z y - w z + w z - w

so that AX = XA means

x + z = x + y, y + w = x - y, x - z = z + w, y - w = z - w.

The solution is x = w + 2z, y = z, and w, z are arbitrary. In summary, AX = XA if and only if

 X = [ w + 2z z ] = w[ 1 0 ] + z[ 2 1 ] z w 0 1 1 0

3)

 A = [ 1 0 ] 0 2

Answer Again we assume

 X = [ x y ] z w

and find the condition for AX = XA to be x = x, y = 2y, 2z = z, 2w = 2w. The solution is y = z = 0, and x, w arbitrary. In other words, X is a diagonal matrix.

4)

 A = [ 0 0 ] 0 0

Answer For any 2 by 2 matrix X, we have AX = O = XA (O is the 2 by 2 zero matrix). Therefore AX = XA for any X.

5)

 [ 2 0 ] 0 2

Answer For any 2 by 2 matrix X, we have AX = 2X = XA. Therefore AX = XA for any X.

6)

 [ 2 0 0 ] 0 2 0

Answer For AX and XA to be meaningful, X has to be a 3 by 2 matrix. Then AX is a 2 by 2 matrix, XA is a 3 by 3 matrix, and they cannot be equal.

Remark Here are some further problems for you to think about.

1. If A is not a square matrix, then we can never have AX = XA due to the contradiction in size.
2. In the 2nd and the 3rd questions, we have seen that two entries in X can be arbitrary. In the 4th and the 5th questions, all four entries in X can be arbitrary. Can you find examples of 2 by 2 matrix A, so that only one entry can be arbitrary? How about three arbitrary entries, or no arbitrary entries, in X?
3. What matrix commutes with all the other matrices? In other words, what A has the property that AX = XA for all X? First try the 2 by 2 case, and then guess the general case.
4. What matrix commutes with all the diagonal matrices? First try the 2 by 2 diagonal matrices
 X = [ x 0 ] 0 w
and then the general n by n matrices.
5. What matrix commutes with all the matrices of the form
 X = [ w + 2z z ] = w[ 1 0 ] + z[ 2 1 ] z w 0 1 1 0
We know the matrix A in the third problem is one such. The problem is to find all the others.