I have came across this problem while preparing a part of college entrance exam.
$A$ and $B$ are $3\times3$ matrix satisfying $$A^{101}=B\ ,\ B=\begin{bmatrix} -1&-2&-2 \\ 1&2&1 \\-1 & -1 & 0 \end{bmatrix}$$ and $$B^2=I_3$$
The question requires me to compute the sum of all elements of A, which I know is $-3$ but I can't prove it.
Oh, by the way it is $$ x^TAx$$where$$x=[1\ 1\ 1]^T$$
This answer uses the crucial information given in the comments that $A$ has rational entries.
Since $A^{202}=I$, the minimal polynomial of $A$ divides $x^{202}-1=\Phi_{1}(x)\Phi_{2}(x)\Phi_{101}(x)\Phi_{202}(x)$. This is a complete factorization into irreducibles over $\mathbb Q$. This is the key point. Here, $\Phi_n$ is the $n$th cyclotomic polynomial.
Since the minimal polynomial of $A$ has degree at most $3$, it must divide $\Phi_{1}(x)\Phi_{2}(x)=x^2-1$.
Therefore, $A^2=I$ and so $A=A^{101}=B$.