Matrix problems over a finite field Assume $F_p$ is a finite field, $|F_p|=p$ and $M_n(F_p)$ is all the $n\times n$ matrices over $F_p$.
A relation is defined over $M_n(F_p)$:$$A,B\in M_n(F_p),A\sim B \Leftrightarrow \exists~~u,v\in \mathbb{Z^+}~~A^u=B^v.$$
It is easy to verify that this is an equivalence relation..
So for any $A\in M_n(F_p)$, we define
$$S_A=\left\{B\in M_n(F_p)|B\sim A\right\}.$$
So we have $$S_0=\left\{ B\in M_n(F_p)|B\sim 0 \right\} $$  and  $$S_I=\left\{ B\in M_n(F_p)|B\sim I \right\},$$ where $0$ is the $0$ matrix and $I$ is the identity matrix.
The question is how to calculate the cardinality of  $S_0$ and  $S_I$.
If we define
$$S=\left\{S_A|A\in M_n(F_p)\right\},$$
the question is how to calculate the cardinality of  $S$.
By reviewing the article, I have known that $S_0$ is the $\mathrm{Fine}-\mathrm{Herstein}$ theorem, so $|S_0|=q^{n^2-n}.$
I would like to ask about the remaining two questions.
I would like to get some articles or links to articles.
Thanks.
 A: For every endomorphism $\phi$ of a finite dimensional $K$-vector space there are uniquely determined complementary subspaces $V,W$ such that the restriction of $\phi$ to $V$ is nilpotent and the restriction of $\phi$ to $W$ is invertible*. In the current situation $A\sim B$ holds if and only if the subspaces $V,W$ and $V',W'$ so associated to the operations of multiplication by $A$ respectively by$~B$ satisfy $V=V'$ and $W=W'$. So the equivalence classes are parametrised by the ordered direct sum decompositions of $F_p^n$ into two complementary subspaces; the number of elements in the class for $(V,W)$ is the product of the number of nilpotent matrices over $F_p$ of size $\dim V$ (which can be derived from the formula given in the question) and the number of invertible  matrices over $F_p$ of size $d=\dim W$, which is well know to be $\prod_{i=0}^{d-1}(p^d-p^i)$. So you can work out the sizes of all the classes; the classes of $0$ and $I$ are the easiest ones.
*The space $V$ is the generalised eigenspace for $\lambda=0$, and if that space is the kernel of $\phi^k$ then $W$ is the image of $\phi^k$.
