Solution (source code)

= Solution
{c}

The same <matrix similarity> preserves being a <diagonalisable matrix>. If $S^{-1}(AB)S=D$ is a <diagonal matrix>, then
$$
(A^{-1}S)^{-1}(BA)(A^{-1}S)
=S^{-1}A(BA)A^{-1}S
=S^{-1}(AB)S=D.
$$
Therefore $BA$ is a <diagonalisable matrix> whenever $AB$ is, and the converse follows by interchanging $A,B$. Thus they are either both <diagonalisable matrices> or neither is. In fact the previous part shows that one invertible factor suffices.