Given matrix $B$, find all possible matrices $A$ satisfying $ A(A-2B) = -(A-2B)A $ 
Let $A, B \in \Bbb R^{3 \times 3}$ such that $A(A-2B) = -(A-2B)A$. Given $$ B = \begin{pmatrix} 2 & -2 & 1 \\ -1 & 3 & -1 \\ 2 & -4 & 3 \end{pmatrix} $$ find all possible matrices $A$ satisfying the equation above.


I hope there is some way faster than compute directly...
 A: Following the hint of @P.Quinton, we can rewrite the problem as $(A-B)^2=B^2$, and that reduces the problem to finding all $C$ such that $C^2=B^2$.  The difficulty here is that $B$ has a repeated eigenvalue, which means that finding all the square roots of $B^2$ is not quite straight forward.  After all, any reflection will square to the identity, and so on that eigenspace we can take something that restricts to a reflection.
We first note that $B$ is diagonalizable, with $B=PDP^{-1}$, with $D=\operatorname{diag}(1,1,6)$.
Because of this, $B^2$ will satisfy the polynomial $f(x)=(x-1)(x-6^2)$, and hence so will $C$.  But then $C$ will satisfy the polynomial $f(x^2)=(x^2-1)(x^2-6^2)=(x-1)(x+1)(x-6)(x+6)$ which has no repeated roots, so $C$ is also diagonalizable.  If $v$ is an eigenvector of $C$, then it is also an eigenvector of $C^2=B^2$, The problem is that when we square $C$, things that weren't eigenvectors for $C$ can become eigenvectors for $C^2$, for example if $Cu=u$ and $Cv=-v$, then $C^2(u+v)=u+v$, but $C(u+v)=u-v\neq \lambda(u+v)$.  But if we pick any two vectors that span $\ker(C^2-I)$, then we can pick them to be eigenvectors in $C$.  If they both have eigenvalue $1$ or both have eigenvalue $-1$, then the matrix we get for $C$ will not depend on our choice because $C$ restricted to their span will be $\pm I$.  If they have different signs, then the choices matter.
For the sake of computation, it is easier to find square roots of $D^2$ and then conjugate to turn those into square roots of $B^2$.  If we follow the proceedure above, then we will get block diagonal matrices, $\operatorname{diag}(M,\pm 6)$ where the first block is $2\times 2$ and the last block is $1\times 1$.  The first block, $M$ is a matrix satisfying $M^2=I_2$ (the $2\times 2$ identity matrix), which is either $\pm I$ or a matrix with eigenvalues $1$ and $-1$, which can be found easily by specifying a trace of $0$ and a determinant of $-1$.  In particular, if you set the first column of $M$, those two conditions will uniquely determine the second column.
Putting everything together, $C$ is of the form $PNP^{-1}$ where $P$ was the matrix used in the diagonalization of $B$ and
$$N=\begin{pmatrix}
a & b & 0 \\ 
\frac{1-a^2}{b} & -a & 0 \\
0 & 0 & \pm 6 
\end{pmatrix}$$
(except when $b=0$, in which case $a=\pm 1$ and the $(2,1)$ entry can be anything), or where $N$ is one of the other forms already discussed.
