TITLE: The cardinality of the group $\mathrm{SL}(k,\mathbb{Z}/n\mathbb{Z})$
QUESTION [8 upvotes]: I want to calculate the cardinality of the group $\mathrm{SL}(k,\mathbb{Z}/n\mathbb{Z})$, $k,n \in \mathbb{N}$. When $n$ is prime, it is easy to calculate, so I want to know the general case.

REPLY [6 votes]: Step 1. For a commutative ring $R$, we have $\mathrm{GL}_{n}(R) / \mathrm{SL}_{n}(R) \cong R^{*}$.
Step 2. $|\mathrm{GL}_{n}(\mathbb{F}_{q})| = (q^{n}-1)(q^{n}-q)\cdots (q^{n}-q^{n-1})$.
Step 3. Let $R$ be a commutative local ring with maximal ideal $\mathfrak{m}$ and residue field $K = R / \mathfrak{m}$ . Then $|\mathrm{GL}_{n}(R)| = |\mathfrak{m}|^{n^{2}} |\mathrm{GL}_{n}(K)|$
Step 4. For a commutative rings $R$, $S$, we have $\mathrm{GL}_{n}(R \times S) \cong \mathrm{GL}_{n}(R) \times \mathrm{GL}_{n}(S)$.
Now, we can calculate the order of $\mathrm{GL}_{k}(\mathbb{Z}/n\mathbb{Z})$. First, if $n = p^{k}$, $\mathbb{Z}/p^{k-1}\mathbb{Z}$ is the unique maximal ideal of $\mathbb{Z}/p^{k}\mathbb{Z}$ with residue field $\mathbb{F}_{p}$. Hence, applying 3. and 2., we get $|\mathrm{GL}_{k}(\mathbb{Z}/p^{k}\mathbb{Z})|$.
Combining this with 4., we get the general order for $n = p_{1}^{k_{1}}\cdots  p_{r}^{k_{r}}$. Since $\mathbb{Z}/n\mathbb{Z} \cong \mathbb{Z}/ p_{1}^{k_{1}}\mathbb{Z}\times \cdots \times \mathbb{Z}/p_{r}^{k_{r}}\mathbb{Z}$ , we have $|\mathrm{GL}_{k}(\mathbb{Z}/n\mathbb{Z})| = |\mathrm{GL}_{k}(\mathbb{Z}/p_{1}^{k_{1}}\mathbb{Z})| \cdots  |\mathrm{GL}_{k}(\mathbb{Z}/p_{r}^{k_{r}}\mathbb{Z})|$.
Finally, step 1. implies $|\mathrm{SL}_{k}(\mathbb{Z}/n\mathbb{Z})| = |\mathrm{GL}_{k}(\mathbb{Z}/n\mathbb{Z})|/\phi(n)$.