# Number of idempotent $n\times n$ matrices over $\mathbb{Z}_m$ ?

Is there any known formula for the number of idempotent $n\times n$ matrices over $\mathbb{Z}_m$ ?

The number of idempotent matrices over a finite field is well-known and since we can decompose $m$ into product of prime numbers it is enough to assume that $m$ is a power of a prime number which is equivalent to assume $\mathbb{Z}_m$ is a local ring.

-
I recommend making the title more specific, such as "Counting idempotent matrices over Z_p^n".Gerhard "Ask Me About Good Asking" Paseman, 2013.02.13^ –  Gerhard Paseman Feb 13 '13 at 19:17
To avoid a confusion, I should perhaps say that I agree with Gerhard Paseman and simply went ahead in this direction (just taking a phrasing directly from the question in order to stay as close as possible to OP's intent). –  quid Feb 13 '13 at 21:42

I think it can be found the following way. If R is a commutative local ring then every idempotent matrix is equivalent conjugate to a diagonal idempotent $\begin{pmatrix} I_r & 0\cr 0 &0\end{pmatrix}$ . The point is projective is free for local rings. This lets you write $R^n$ as a direct sum of the image and the kernel, both of which are free.
So now one has to just compute the size of the stabilizer of the standard rank r diagonal idempotent under the conjugation action of GL(R) for $R=Z_{p^{k}}$.
Added. I believe the stabilizer of the rank r idempotent for a local ring is GL(R,r)xGL(R,n-r)$like in the field case and so a formula is easily found. Added. I compute the answer for nxn matrices over$Z_{p^k}$to be $$\sum_{r=0}^n \frac{p^{2r(n-r)(k-1)}|Gl(n,p)|}{|Gl(r,p)|Gl(n-r,p)|}.$$ Here I use a matrix is invertible over a local ring iff it is over the residue field. The orders of the Gl(m,p) are of course well known. - The method looks good but something must be slightly wrong with the answer; it gets smaller, not larger, when$k$increases. Maybe the power of$p\$ should be in the numerator? –  David Speyer Feb 14 '13 at 13:45