I'm wondering, why is it that for $q=(p^2-1)(p^2-p)$, that $A^{q+2}=A^2$ for any $A\in M_2(\mathbb{Z}/p\mathbb{Z})$?
It's not hard to see that $GL_2(\mathbb{Z}/p\mathbb{Z})$ has order $(p^2-1)(p^2-p)$, and so $A^q=1$ if $A\in GL_2(\mathbb{Z}/p\mathbb{Z})$, and so the equation holds in that case. But if $A$ is not invertible, why does the equality still hold?