$A^3$ is similar to $B^3$ but $A^2$ is not similar to $B^2$ Find an example of $A,B$ such that $A^3$ is similar to $B^3$, and $A^2$ is not similar to $B^2$, and $A$ is not similar to $B$.
I only have some clues that $p_{A^2}(x) \neq p_{B^2}(x)$ and $p_{A}(x) \neq p_{B}(x)$
I first wanted to start from $A^3 = S^{-1} B^3 S$
Then let $S$ and $B$ to be some arbitrary matrices, where $S$ is invertiable, so that I could obtain $A^3$ which is similar to $B^3$. Thus, $A = \sqrt[\leftroot{-3}\uproot{3}3]{A^3}$
However, I realize I don't know how to find square root or cube root of matrices.
 A: HINT: Can you think of an example where both cubes are the zero matrix but one square is not?
A: Let $\omega:=e^{\frac{2\pi i}{3}}$.
Then
$$
A=\begin{pmatrix}
\omega & 0\\
0 &\omega
\end{pmatrix}
\text{  and  }
B=\begin{pmatrix}
\omega & 0\\
0 &1\\
\end{pmatrix}
$$
will do the trick.
A: I want to argue that, in some sense, the examples already given are the only things that can go wrong.
First, we consider the case when $A$ and $B$ are diagonalizable.  Diagonalizable matrices are determined (up to similarity) by their eigenvalues and multiplicities.  Let us group the eigenvalues together based on the value of $\lambda^3$.  For a given value of $\lambda$, the equation $x^3-\lambda^3=0$ has 3 solutions, $\lambda, \omega \lambda, \omega^2\lambda$, where $\omega$ is a primitive cube root of unity.  e.g., $\omega=e^{2\pi i/3}$.  For example, if $A=\operatorname{diag}(1,\omega, \omega, \omega^2, 2, 2\omega)$, we would break the eigenvalues into two multi-sets, $\{1,\omega, \omega, \omega^2\}$ and $\{2, 2\omega\}$
Each group of eigenvalues can contain up to 3 different eigenvalues in it, and we see that as long as the multiplicities are different for $A$ and $B$, $A$ and $A^2$ will not be similar to $B$ and $B^2$.
For a simple (rational!) example of this type, consider $A=I$, $B=\begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{pmatrix}.$  For a $2\times 2$ real (but not rational) example, again consider $A=I$ and $B$ a rotation of angle $2\pi/3$.
The thinking here actually gives a nice way to take square roots of diagonalizable matrices: diagonalize, then replace  every eigenvalue with one of its possible cube roots.  If $A$ is $n\times n$ and has no repeated eigenvalues, there are $3^n$ ways to do this.  However, repeated eigenvalues mean we can take multiple different eigenbases, which yield different cube roots.  For example, if $A=I_3$, pick any axis and and the rotation about that axis of angle $2\pi/3$ will be a cube root.  This method also does not allow for the possibility of non-diagonalizable square roots.

So one problem is that $A$ and $B$ can have different eigenvalues even though $A^3$ and $B^3$ have the same eigenvalues.  But what if they have identical characteristic polynomials? It isn't too hard to construct examples which are nilpotent, but that is essentially all that can go wrong, at least over $\mathbb C$.  This follows from the following result.
Lemma: If $A=J_n(\lambda)$ is an $n\times n$ Jordan block with eigenvalue $\lambda$, and $\lambda\neq 0$, then $A^{3}$ is similar to $J_n(\lambda^3)$.
Proof. Note that $(A-\lambda I)^n=0$ but $(A-\lambda I)^{n-1}\neq 0$ uniqutely characterizes $A$ up to similarity.  Since $A$ and $I$ commute, we can factor $(A^3-\lambda^3 I)=(A-\lambda I)(A-\omega\lambda I)(A-\omega^2 \lambda I)$, factors of which all commute with each other, and since $\lambda$ is the only eigenvalue of $A$, the latter two factors are invertible.  Then $(A^3-\lambda^3 I)^k=(A-\lambda I)^k(A-\omega\lambda I)^k(A-\omega^2 \lambda I)^k$.  Since the latter two terms are invertible, if $k<n$, the overall expression is not $0$, and if $k=n$, then the first factor is already $0$ so the entire expression is as well.
This shows that if $A$ and $B$ are invertible and $A^3$ and $B^3$ are similar, then we can pair off the Jordan blocks of $A$ and $B$ in such a way that corresponding blocks will have the same size and the ratio of corresponding eigenvalues is a cube root of unity.
This also says how to find all the cube roots of an invertible matrix $A$.  First, write the JNF of $A$ as a sum of Jordan blocks.  Second, replace the eigenvalue for each block with one of its 3 cube roots. Call this matrix $B$  Then $B^3$ is similar to $A$, and for every $P$ such that $PB^3P^{-1}=A$, we get $PBP^{-1}$ is a cube root of $A$.
For non-invertible matrices, we can canonically break them up as the sum of an invertible and nilpotent matrix, and it is a fun (but involved) combinatorial problem to understand what the square or cube roots of a nilpotent matrix are.
