TITLE: Prove that two matrices commute iff the square of the matrices commute
QUESTION [7 upvotes]: In my textbook there is a task in which I have to prove the relation
\begin{equation}
AB=BA\Leftrightarrow A^2B^2=B^2A^2.
\end{equation}
For ($\Rightarrow$) it is easy
\begin{equation}
AB=BA\Rightarrow (AB)^2=(BA)^2\Rightarrow ABAB=BABA\Rightarrow BBAA=AABB.
\end{equation}
But how do I prove ($\Leftarrow$)?

REPLY [2 votes]: The implication '$\Leftarrow$' is so obviously false it surprises me that one should even ask this question. Though commutation of matrices can arise in many ways, one of the most simple ways is when one of the matrices is a scalar matrix (multiple of the identity). So if '$\Leftarrow$' were true, it would mean at least that whenever $A^2$ is a scalar matrix then $A$ commutes with every other matrix $B$; this clearly cannot be true.
There is a multitude of kinds of matrices whose square is scalar without any reason for the matrix itself to commute with all other matrices: the matrix of any reflection operation ($A^2=I$), that of a rotation by a quarter turn $(A^2=-I$), or a nilpotent matrix of index$~2$ (i.e., $A\neq0$ but $A^2=0$). These give many choices for a counterexample. (In fact the only way $A$ can commute with all other matrices is for $A$ to be scalar itself, but you don't need to know this fact to find counterexamples to '$\Leftarrow$'.)