I tried with a counter example and it came out that this claim is false.
I took a matrix $$ A= \left[ {\begin{array}{cc} 2 & 1\\ 3 & 2\\ \end{array} } \right] $$
and a matrix
$$ B= \left[ {\begin{array}{cc} 1 & 3\\ 4 & 1\\ \end{array} } \right]. $$
I first calculated $$AB$$
and I got:
$$ AB= \left[ {\begin{array}{cc} 6 & 7\\ 11 & 11\\ \end{array} } \right] $$
and then I calculated $$AB \times AB$$ that is same as $$(AB)^2$$ and I got: $$ (AB)^2= \left[ {\begin{array}{cc} 85 & 119\\ 187 & 198\\ \end{array} } \right] $$
then I calculated $$A \times A$$ that is the same as $$A^2$$ and I got $$ A^2= \left[ {\begin{array}{cc} 7 & 4\\ 12 & 13\\ \end{array} } \right] $$
and after I calculated $$B^2$$
$$ B^2= \left[ {\begin{array}{cc} 13 & 6\\ 8 & 13\\ \end{array} } \right] $$
and at the end I calculated $$A^2B^2$$ and I got:
$$ A^2B^2= \left[ {\begin{array}{cc} 123 & 94\\ 250 & 241\\ \end{array} } \right] $$
so I am deducing that the claim at the beginning is false, so $$(AB)^2 \neq A^2B^2$$
Is this right?
$\endgroup$ 24 Answers
$\begingroup$You have correctly constructed a counterexample to the proposition. Nice job!
$\endgroup$ $\begingroup$In general, $AB \neq BA$, so $(AB)^2 = ABAB = A(BA)B \neq A(AB)B = A^2B^2.$
$\endgroup$ $\begingroup$Assuming , $A$ and $B$ are invertible, we have $$(AB)^2=A^2B^2$$ if and only if $$ABAB=AABB$$ if and only if $$BA=AB$$ which is not true in general.
$\endgroup$ $\begingroup$It is true if the matrices commute: $$ A^2B^2-(AB)^2 = AABB-ABAB = A(AB-BA)B, $$ so this is zero if $AB=BA$. Of course, it could also be true if the whole product is zero while the individual factors are not. But your counterexample does show it is not true in general.
$\endgroup$