Total number of elements in $\mathrm{GL}_2(\mathbb{Z}/p^{r+1}\mathbb{Z})$ is $p^{4r}(p^2-1)(p^2-p)$. Let us count the number of matrices with a given trace $s$. It is $\sum_{a\in \mathbb{Z}/p^{r+1}\mathbb{Z}} |(c,d):p\, \text{does not divide}\, a(s-a)-cd|$. Clearly it depends only on the remainder of $s$ modulo $p$. For $s$ divisible by $p$, we have $p^{2r}(p-1)^2$ pairs $(c,d)$ for any $a$ divisible by $p$ and $p^{2r+2}-(p^{r+1}-p^r)$ pairs for $a$ not divisible by $p$. Totally $p^{3r}(p-1)^2+(p^{2r+2}-(p^{r+1}-p^r))(p^{r+1}-p^r)=(p^{r+1}-p^r)(p^{2r}(p-1)+p^{2r+2}-p^{r+1}+p^r)$. So, for any given remainder $a$ modulo $p^{r+1}$, which is divisible by $p$, the probability that a random matrix from $\mathrm{GL}_2(\mathbb{Z}/p^{r+1}\mathbb{Z})$ has a trace equal to $a$, equals $(p^{2r}(p-1)+p^{2r+2}-p^{r+1}+p^r)/p^{3r+1}(p^2-1)$.
Fedor Petrov
- 108.9k
- 9
- 264
- 459