If $A$ and $B$ are matrices such that $AB^2=BA$ and $A^4=I$ then find $B^{16}$.
$A^4=I$ implies that $A$ is invertible. Hence $B^2=A^{-1}BA$ . Repeatedly squaring and using the previous step we get $B^{16}=A^{-4}BA^{4}$ which gives $B^{16}=B$.
$$B^2=A^4B^2=A^3BA.$$ Thus, $$B^4=A^3BAA^3BA=A^3B^2A=A^2BA^2.$$ Hence, $$B^8=A^2BA^2A^2BA^2=A^2B^2A^2=ABA^3$$ and from here $$B^{16}=ABA^3ABA^3=AB^2A^3=BA^4=B$$
The relation $AB^2 = BA$ allows to reduce the number of $B$s by one. Using this idea, we can show that for every even power $2n$, we have that $$AB^{2n} = B^nA.$$
Applying this and using $A^4 = I$, we can simplify $$B^{16} = A^4B^{16} = A^3B^8A = \ldots = B.$$
When we pull the first $A$ through, we half the power of $B$. Now it should be easy to see how to continue and why we will be left with $B$ in the end.
Note that you used basically the same idea, you just hid it behind multiple steps.