# 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}$?

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})|$
• Why can we identify $\mathrm{Mat}_{m\times m}(\mathbb{Z}/n)$ with $\mathrm{Aut}_{\mathrm{group}}((\mathbb{Z}/n)^m)$? – byk7 Oct 10 '18 at 13:57