Why $0$ is a possible trace of such a matrix $A$? Reference: see the question No : 8

Let $A$ be an invertible $3 \times 3$ real matrix such that $A$ and $A^2$ have the same characteristic polynomial. What are the possible traces of such a matrix $A$?

My  answer: I take identity matrix. Then the anwer will be only $3$.
But official answer key says that answer is $0$ and $3$.
I'm confused: why $0$ is a possible trace of such a matrix $A$?
 A: The identity matrix is not the only possible such matrix, and thus its trace isn't (necessarily) the only possible such trace.
For instance, consider
$$
\begin{bmatrix}1&0&0\\0&\cos(120^\circ)&-\sin(120^\circ)\\0&\sin(120^\circ)&\cos(120^\circ)\end{bmatrix}
$$
Its eigenvalues are $1, -\frac12\pm\frac{\sqrt2}2i$. So its square has the same three eigenvalues and therefore the same characteristic polynomial.
As for why these are the only possibilities (and how to systematically search for examples that prove $0$ and $3$ are possible), you want the possible values of the sum $\lambda_1+\lambda_2+\lambda_3$ of the eigenvalues of $A$, given that squaring permutes the triple $(\lambda_1,\lambda_2,\lambda_3)$ and that none of them is $0$.
Either squaring is the trivial permutation, and they are all $1$ (how exactly to tell which permutation has acted on the triple $(1,1,1)$ is a bit vague, I'll admit). Or squaring swaps two of the eigenvalues and leaves the third unchanged (necessarily giving the three eigenvalues of my example above).
Finally, you have to show that squaring can't possibly cyclically permute all three of them. If they were cyclically permuted by squaring, they would all have to be different non-real seventh-roots of $1$. Which can't be done with a real matrix.
A: We are given that $\chi_A(X)=\chi_{A^2}(X)$, so
$$\begin{align} \chi_A(\lambda^2)&=\chi_{A^2}(\lambda^2)\\&=\det(\lambda^2\operatorname {Id}-A^2)\\
&=\det\bigl((\lambda\operatorname {Id}-A)(\lambda\operatorname {Id}+A)\bigr)\\&=\det(\lambda\operatorname {Id}-A)\det(\lambda\operatorname {Id}+A)\\&=-\chi_A(\lambda)\chi_A(-\lambda)\end{align}$$
and in fact the corresponding equality of polynomials $$ \chi_A(X^2)=-\chi_A(X)\chi_A(-X)$$
must hold.
Now if $\chi_A(X)=X^3+aX^2+bx+c$, this gives us
$$X^6+aX^4+bX^2+c= (X^3+aX^2+bX+c)(X^3-aX^2+bX-c).$$
By expanding and comparing coefficients, we arrive at
$$\begin{align}c^2+c&=0\\
2ca-b^2+b&=0\\
a^2+a-2b&=0\end{align}$$
Note that together, these three equations are equivalent to $\chi_A(X)=\chi_{A^2}(X)$.
As $A$ is invertible, we cannot have $c=0$, hence the first equation allows only $c=-1$, turning the second into
$$-2a-b^2+b=0. $$
Using the third to eliminate $b$, we arrive at
$$ a^4+2a^3-a^2+6a=0$$
or:
$$a(a+3)(a^2-a+2)=0. $$
As $a=-\operatorname{Tr}(A)$ and the last factor has no real roots, we conclude that the set of possible traces is  $\subseteq \{0,3\}$.
Recall that you can achieve any desired characteristic polynomial, e.g. by a well-known standard construction amounting to
$$ A=\pmatrix{0&1&0\\0&0&1\\-c&-b&-a}.$$
Not only does this tell us that in fact both $0$ and $3$ are possible traces. You can also find a non-trivial (i.e., non-identity) example with trace $3$!
A: What about the matrix $\left(\begin{array}{ccc}0&1&0\\0&0&1\\1&0&0\end{array}\right)$?
