Find $A$ given $A^2$ and $B$ and $(A^2)^{-1} = A^{-1}B$ This excersice took place in class I had today. The exercise was the following:

Let the regular matrix $A$,$B$:
$$A^2 = \left[ \begin{matrix} 2 &-2 & 2\\ -2 & 2 & 2 \\ 4&4&-4 \end{matrix} \right]  \hspace{2cm}  B = \left[ \begin{matrix} 0 &-1 & 2\\ 0 & 2 & 0 \\ 1&3&-1 \end{matrix} \right]$$
Knowing that $(A^2)^{-1} = A^{-1}B$, find A.

My Attempt
During the exam I tried the following:
$(A^2)^{-1} = A^{-1}B \Leftrightarrow A^2(A^2)^{-1} = A^2A^{-1}B \Leftrightarrow I_n = AB \Leftrightarrow A = B^{-1}$
And procedeed to find the inverse of B, which is:
$A = B^{-1} = \left[ \begin{matrix} \frac{1}{2} &\frac{-5}{4} &  1\\ 0 & \frac{1}{2} & 0 \\ \frac{1}{2}& \frac{1}{4}&0 \end{matrix} \right]$
But, as I tend to make silly mistakes, I figured out that it would be a better way to do find $A$ just by using matrix products. We had $I_n = AB \Leftrightarrow A = A^2B$. Using this method I got that
$A = A^2B = \left[ \begin{matrix} 2 & 0 &  2\\ 2 & 12 & -6 \\ -4& -8&12 \end{matrix} \right]$
But as you can see the $2$ matrix are different. Where is the mistake in my logic?
Another thing I noticed is that $I_n = AB \Leftrightarrow A*I_n*B = A*(AB)*B \Leftrightarrow I_n = AB = A^2B^2$, but $A^2B^2$ isn't the identity matrix, so maybe the exercise is wrong, but I rather not rush into that thinking.
 A: Use the properties of determinant to show that the given relationship does not hold.
$$\det ((A^2)^{-1})=-\frac1{64}=\det (A^{-1})\cdot(-4)$$
from the given relationship and properties of determinant. So $\det (A)=64\cdot 4$ and this cannot be true.
A: The problem is broken, here is a precise statement showing how it is broken.
Let $B=\left[ \begin{matrix} 0 &-1 & 2\\ 0 & 2 & 0 \\ 1&3&-1 \end{matrix} \right].$
For every invertible matrix $A$, at least one of the following are false:


*

*$A^2 = \left[ \begin{matrix} 2 &-2 & 2\\ -2 & 2 & 2 \\ 4&4&-4 \end{matrix} \right]$

*$(A^2)^{-1}=A^{-1}B$
Proof. 
If 2. holds, then
$$
\det \bigl((A^2)^{-1}\bigl)=\det (A^{-1}B).
$$
By direct computation, $\det B=-4$. On the other hand,
$$
\det\ \left[ \begin{matrix} 2 &-2 & 2\\ -2 & 2 & 2 \\ 4&4&-4 \end{matrix} \right]=-64.
$$
Consequently if 1. and 2. both hold, then $(-64)^{-1}=(\det A)^{-1}\cdot (-4),\text{ or equivalently, } \det A=256.$ But this contradicts 1. Thus, it there does not exist any invertible matrix satisfying both 1. and 2. simultaneously.
A: Long story short, matrix multiplication is not commutative.

Te equation $A=A^2B$ is not correct. From the equation $$(A^2)^{-1} = A^{-1}B$$
you have to multiply it by $A$ from the left to get
$$A(A^2)^{-1} = B$$
and the multiply it by $A^2$ from the right and you get
$$A=B\cdot A^2$$
which is not the same as $A=A^2B$.

However, even using $A=BA^2$ results in two different calculations of what $A$ is, and this seems to me like a mistake in the exercise. Indeed, from $(A^2)^{-1} = A^{-1}B$, it should follow that $I=A^2A^{-1}B=AB$, and from that, it should follow that $A=B^{-1}$. However, it is not true that $(B^{-1})^2=A^2$ which means that $A=B^{-1}$ cannot hold, which is a contradiction.
