# Number of $2\times 2$ unimodular matrices in $Z_p$

Number of $2\times 2$ invertible matrices are $(p^2-1)(p^2-p)$. I was wondering how will the answer change if matrices are constrained to be unimodular. My estimate is $(p^2-1)*2p$.

If $\phi: G \rightarrow H$ is a surjective homomorphism of finite groups, then the number of elements in $G$ which map to a given $h \in H$ is constant, and equal to $\frac{|G|}{|H|}$.

Let $G = \textrm{GL}_2(F)$, where $F = \mathbb{Z}/p\mathbb{Z}$. The determinant homomorphism $G \rightarrow F^{\ast}$ is surjective. You are looking for the number of matrices in $G$ whose determinant is $1$ or $-1$. This is then

$$2 \frac{|G|}{(p-1)} = 2(p+1)(p^2-p)$$

Edit: Alternative explanation: for each $0 \neq x \in \mathbb{Z}/p\mathbb{Z}$, let $S(x)$ be the subset of $G$ consisting of all elements with determinant $x$. Check two things:

(i): All the subsets $S(x)$ have the same number of elements.

(ii): $G$ is the disjoint union of the subsets $S(1), ... , S(p-1)$. That is, $G = S(1) \cup S(2) \cup \cdots \cup S(p-1)$, and $S(x) \cap S(y) = \emptyset$ for $x \neq y$.

It follows from here that the number of elements in $G$, that is, $(p^2-1)(p^2 - p)$, is equal to $p-1$ times the number of elements of $S(1)$. Thus the number of elements of $G$ with determinant one is $$\frac{(p^2-1)(p^2 - p)}{p-1} = (p+1)(p^2-p)$$

and so the number of elements of $G$ with determinant $1$ or $-1$ is twice that number.

• Whoa, that was too much for me. Is it possible to solve this using just elementary number theory concepts? – stillanoob Feb 24 '17 at 5:38
• See my edit. If you still don't understand, ask me specifically about which sentence you get stuck on. – D_S Feb 24 '17 at 5:47