Let A and B are $2 \times 2$ matrices, where AB = BA, show that $\text{A B}^2 = \text{B}^2 \text{A}$ 
Let A and B are $2\times 2$ matrices, where $$\text{AB} = \text{BA}$$show that :
  $$\text{A B}^2 = \text{B}^2 \text{A}$$


Well, I assumed A and B are symmetric matrices, so $$ AB^2 = A^T B pow(2T) = (B^ 2A)^T = B^2T = A^T = B^2 A $$ I thought for long time but I didn't get the right solution, any expert can help please!
 A: I think the answer is a bit simpler than you expect.
Suppose that $A,B$ are commuting matrices, that is, $AB = BA$. Then let's compute
\begin{equation}
AB^{2} = ABB = BAB = BBA = B^{2}A
\end{equation}
as desired.
A: Let's do it with making every step and used law explicit:
\begin{align}
AB^2 &= A(BB) && \text{definition of $B^2$}\\
&= (AB)B && \text{associativity}\\
&= (BA)B && \text{by assumption}\\
&= B(AB) && \text{associativity}\\
&= B(BA) && \text{by assumption}\\
&= (BB)A && \text{associativity}\\
&= B^2A && \text{definition of $B^2$}
\end{align}
Note that I didn't use anything specific to matrices; the same calculation works with any semigroup.
A: No need for symmetry.
Note that $AB = BA$ implies that
$$
AB^{2} = BAB
$$
by right-multiplying $AB$ and $BA$ by $B$
and that
$$
BAB = B^{2}A
$$
by left-multiplying $AB$ and $BA$ by $B$.
A: Take your equation $AB=BA$ and multiply both sides on the right by $B$. The left hand side becomes:
$$(AB)B = A(BB) = AB^2$$
and the right hand side becomes:
$$(BA)B = B(AB) = B(BA) = (BB)A = B^2A.$$
Thus,
$$AB^2 = B^2A.$$
