(a). Let A be the 2 x 2 matrix with first row a b and second row c d.
Then, AB is the 2 x 2 matrix with first row b a and second row d c.
BA is the 2 x 2 matrix with first row c d and second row a b.
For the equation AB = BA to be true, all corresponding entries of AB and BA must be equal.
So, we see that b = c and a = d.
Therefore, A must be a 2 x 2 matrix where the main diagonal entries are equal and the entries on
the other diagonal are also equal.
An example would be the 2 x 2 matrix with first row 5 -3 and second row -3 5.
(b). Suppose that A and B are both n x n matrices.
If AB = BA, then (A - B)(A + B) = A2 + AB - BA - B2 = A2 - B2.
If (A - B)(A + B) = A2 - B2, then A2 + AB - BA - B2 = A2 - B2.
Subtracting A2 from both sides and adding B2 to both sides gives us AB - BA = n x n zero matrix.
So, adding BA to both sides yields AB = BA.
Therefore, AB = BA iff (A - B)(A + B) = A2 - B2.