<s>[INST] Finding char polynomial in $Z_3$ $ K=Z_3 $
$ A \in   K_{(4 \times 4)} $
$$A=
\begin{bmatrix}
a  & -1  & -2 & -2 \\
0  & a-1 & -2 & 0 \\
-2 & 0 & a & 0 \\
-2 & -1 & 0 & a-2 \\
\end{bmatrix}
$$
I need to find $\det(A)$.
I came up with $\det(A)= (a)(a-1)(a)(a-2) - (a-2)(-2)(a-1)(-2)$ 
If I rewrite this I get:
 $a^4 - 2a^3 - a^3 + 2a^2 - 4a^2 + 4a + 8a - 8 =
 a^4 -2a^2 - 2$
My answer sheet gives me $\det(A)= x^4+1 =(x^2+x+2)(x^2+2x+2)$
What am I overlooking or maybe there is something wrong with my calculation?
 [/INST] Keeping in mind the patterns $\left|\begin{array}{cccc}+&-&+&-\\-&+&-&+\\+&-&+&-\\-&+&-&+\end{array}\right|$ and $\left|\begin{array}{cccc}+&-&+\\-&+&-\\+&-&+\end{array}\right|$, expanding along the last column we get:
$$-(-2)\left|\begin{array}{cccc}0&a-1&-2\\-2&0&a\\-2&-1&0\end{array}\right|
+(a-2)\left|\begin{array}{cccc}a&-1&-2\\0&a-1&-2\\-2&0&a\end{array}\right|$$
At this point (or even earlier), it helps to work modulo $3$:
$$-1\left|\begin{array}{cccc}0&a-1&1\\1&0&a\\1&-1&0\end{array}\right|
+(a+1)\left|\begin{array}{cccc}a&-1&1\\0&a-1&1\\1&0&a\end{array}\right|\\
\begin{array}{l}=\underbrace{-\left[-1\underbrace{\left|\begin{array}{cccc}a-1&1\\-1&0\end{array}\right|}_{1}+1\underbrace{\left|\begin{array}{cccc}a-1&1\\0&a\end{array}\right|}_{a^2-a}~\right]}_{1-a^2+a}
+(a+1)\underbrace{\left[a\underbrace{\left|\begin{array}{cccc}a-1&1\\0&a\end{array}\right|}_{a^2-a}+1\underbrace{\left|\begin{array}{cccc}-1&1\\a-1&1\end{array}\right|}_{-1-a+1=-a}~\right]}_{a^3-a^2+a}\\
=1-a^2+a+(a+1)(a^3-a^2-a)\\
=1-a^2+a+a^4-a^3-a^2+a^3-a^2-a\\
=a^4-3a^2+1\\
=a^4+1\end{array}$$
</s>