Number of invertible matrices over finite rings Is there an exact formula for the number of invertible matrices over the ring $\mathbb{Z}_n,$ $n=p_1^{k_1} p_2^{k_2} \ldots p_s^{k_s}$?
 A: Yes there is. You can identify $m \times m$ invertible matrices over $\mathbb{Z}/n$ with $Aut_{group}((\mathbb{Z}/n)^m)$.  Page 6 of http://www.msri.org/people/members/chillar/files/autabeliangrps.pdf gives an explicit formula for the number of these.  Using their notation, you'll want to use the fact that $\mathbb{Z}/n \cong \mathbb{Z}/{p_1}^{k_1} \times \mathbb{Z}/{p_2}^{k_2} \cdots \times \mathbb{Z}/{p_s}^{k_s} $ and so $(\mathbb{Z}/n)^m \cong (\mathbb{Z}/{p_1}^{k_1})^m \times (\mathbb{Z}/{p_2}^{k_2})^m \cdots \times (\mathbb{Z}/{p_s}^{k_s})^m \cong H_{p_1} \times H_{p_2} \cdots \times H_{p_s}$.  Then you can simplify their formula for your case, since in each $H_{p_i}$ you will have $e_1=e_2= \cdots =e_m=k_i$, so that $d_k=c_k=m$ for all $k$.
When I simplify in your case I get $|Aut(H_{p_i})|=(p_{i}^{k_i-1})^m\cdot \Pi_{j=1}^{m}(p_i^m-p_{i}^{j-1})$. And then $|Aut((\mathbb{Z}/n)^m)|=|Aut(H_{p_1})|\cdots|Aut(H_{p_s})|$
A: Fix a positive integer $r$.
By Chinese Remainder Theorem we have isomorphsim of rings,$$ \mathbb{Z}/(n)\simeq\bigoplus_{i=1}^s \mathbb{Z}/(p_i^{k_i}). $$
Then we can proof that $$ M_r(\mathbb{Z}/(n))\simeq\bigoplus_{i=1}^r M_r(\mathbb{Z}/(p_i^{k_i})). $$
So we just need to compute the number of invertible matrices in each $M_r(\mathbb{Z}/(p_i^{k_i}))$ and multiply them to get the answer.
Let $p$ be a prime and $e$ a positive integer. Let $G$ be the group composed of all invertible matrices $M_r(\mathbb{Z}/(p^{e}))$, and the group multiplication is the multiplication of matrices (i.e., the unit group of $M_r(\mathbb{Z}/(p^{e}))$). Consider the map $$ \sigma:G \to GL_r(\mathbb{Z}/(p)),\ (a_{ij}+p^e\mathbb{Z})\mapsto(a_{ij}+p\mathbb{Z}),$$
where $(\cdot_{ij})$ denotes a matrix with the element on $i$-th row $j$-th column being $\cdot_{ij}$, and $a_{ij}\in\mathbb{Z}$, $1\le i, j\le r$.
We can check that $\sigma$ is a well defined surjective homomorphism of groups, and the kernel is
$$\ker\sigma = \{(a_{ij}+p^e\mathbb{Z}): a_{ij}\equiv \delta_{ij}\pmod p\},$$ where $$\delta_{ij} = \begin{cases}1, &i = j,\\ 0, &i\neq j.\end{cases}$$
Thus $|\ker\sigma| = (p^{e-1})^{r^2}$, where $|S|$ denotes the cardinal of a set $S$.
Hence by the isomorphic $G/\ker\sigma\simeq GL_r(\mathbb{Z}/(p))$ we can get $|G|$, the number of invertible matrices in $M_r(\mathbb{Z}/(p^e))$.
