TITLE: Find $A$ given $A^2$ and $B$ and $(A^2)^{-1} = A^{-1}B$
QUESTION [5 upvotes]: 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.

REPLY [2 votes]: 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.