Solution (source code)

= Solution

All calculations here take place in the <finite field> $F=\mathbb F_3$. For the given <matrix> $S$, its <characteristic polynomial> is
$$
\chi_S(x)=\det(xI-S)=x^3+2x^2+2x=xq(x),\qquad q(x)=x^2+2x+2.
$$
The values $q(0),q(1),q(2)$ are $2,2,1$, so this <quadratic polynomial> has no <polynomial root> in $F$ and is an <irreducible polynomial>. Direct calculation gives
$$
q(S)=S^2+2S+2I=
\begin{pmatrix}1&1&0\\1&1&0\\1&1&0\end{pmatrix},
\qquad S q(S)=0.
$$
Neither $S$ nor $q(S)$ is zero. The <Cayley-Hamilton theorem> says that the <minimal polynomial> divides $xq(x)$; its proper <monic polynomial> divisors cannot annihilate $S$, so $m_S=xq$.

The two <kernels> give the required <primary decomposition theorem for linear maps> explicitly:
$$
\boxed{\begin{aligned}
W_1&=\ker S=\operatorname{span}_F\{(1,1,1)^T\},\\
W_2&=\ker q(S)=\{(a,-a,b)^T:a,b\in F\}
=\operatorname{span}_F\{(1,2,0)^T,(0,0,1)^T\}.
\end{aligned}}
$$
The determinant of the <matrix> with these three <basis vectors> as columns is $1$ in $F$, proving $W=W_1\oplus W_2$. To check these are <invariant subspaces>, writing $u=(1,2,0)^T$ and $z=(0,0,1)^T$ gives $Su=u+2z$ and $Sz=2u$. Hence the <matrix> of the <restriction> to $W_2$ in the <basis> $(u,z)$ is
$$
\begin{pmatrix}1&2\\2&0\end{pmatrix},
$$
with <minimal polynomial> $q$; the nonzero <vector space> $W_1$ has zero <restriction> and <minimal polynomial> $x$.