Say I only consider $2\times 2$ matrix $X$. $X$ has entries from a finite field $\mathbb{F}_p$. When do we have $X^p = I$?
I looked into $\mathbb{Z_2}$ and found the following (excluding $I$ itself)
$$\begin{pmatrix} 1&1\\ 0&1 \end{pmatrix}, $$
What about $\mathbb{F}_p$ in general? I know that $x^p - 1 = (x-1)^p$ but is there a way to relate that to matrix?
updated: forgot to mention, but I would also like to count the number of such $2\times 2$ matrices.
Consider an algebraic extension $E$ of $\mathbb{F}_p$ where the characteristic equation of $A$ has roots.
Since $A$ is $2 \times 2$, then $E$ is an extension of $ \mathbb{F}_p$ of degree $1$ or $2$, therefore has $p$ or $p^2$ elements.
Now, if $A$ would be diagonalisable over $E$, then $\lambda_{1,2}^{p^2-1}=1$ which means that $A^{p^2-1}=I$. But then $A^p=I$ implies that $A=I$.
Therefore, the only diagonalisable matrix which has this property is $A=I$.
Next, let us look at the non-diagonalisable possibilities.
We must have $\lambda_1=\lambda_2$, which means that for $p \neq 2$ we have $$\lambda_1=\lambda_2=2^{-1}\tr(A) \in \mathbb{F}_p$$
Then $A^p=I \Rightarrow \lambda^p=1 \Rightarrow \lambda =1$.
This shows that the only eigenvalues of $A$ must be $1$ and $1$.
Conversely, any matrix which has $1,1$ as eigenvalues satisfies $$(A-I)^2=0$$ and therefore $$(A-I)^{p}=0 \Rightarrow A^p=I$$
So the problem boils down to find for $p \neq 2$ all the $2 \times 2$ matrices with eigenvalues $1$ and $1$.
This can be found either by checking how many $2 \times 2$ matrices have Jordan form $\begin{bmatrix} 1 & 1 \\ 0&1\end{bmatrix}$ or by solving the system $$a+d=2 \\ ad-bc=1$$