# Counting matrices based on determinant and trace

Let $p$ be an odd prime number and $T_p$ is the following set of $2 \times 2$ matrices: $$T_p = \left\{ A = \begin{bmatrix} a & b \\ c & a \end{bmatrix}\ \Biggm|a,b,c \in \{0,1,2,...(p-1)\} \right\}$$

then how to prove that the number $k$ of $A$ in $T_p$ such that the trace of A is not divisible by $p$ but the $det(A)$ is divisible by $p$, is $k=(p-1)^2$ ?

-
@Debanjan: Four months in, must you post in the imperative mode? –  Arturo Magidin Jan 31 '11 at 14:49
@Arturo: I think $(p-1)^2$ is the number of matrices in $T_p$. –  PEV Jan 31 '11 at 14:50
@PEV: Yeah, I got it finally; $(p-1)^2$ is meant to be the number of elements in $T_p$ that satisfy the given condition; I've rephrased to clarify that. –  Arturo Magidin Jan 31 '11 at 14:51
@Arturo Magidin:I don't get your first comment :) –  Quixotic Jan 31 '11 at 14:53
@Debanjan: Your original post was written as if it were an assignment/order, written in the imperative mode ("Show...", "Prove..."). You have been here for four months, by now you should know not to do that, even fleetingly. –  Arturo Magidin Jan 31 '11 at 14:54

There are p-1 choices for $a$ (not $0$). Given $a$, the determinant is $a^2-bc$ and since $\mathbb{Z}_p$ is a field you can solve $a^2-bc=0$ for $c$ unless $b=0$, so $p-1$ choices for $b$. That makes $(p-1)^2$ total.

-
Aren't there $p-1$ choices for $a$? $p/2 \not \in \mathbb{Z}_p$ for $p$ odd. –  PEV Jan 31 '11 at 15:14
You are right. I was thinking (p-1)/2, which is. I'll fix. –  Ross Millikan Jan 31 '11 at 15:23

Here's a different point of view that leads to the same answer as Ross's.

Think of the matrices as being matrices over the field of $p$ elements by reducing the entries modulo $p$. The determinant is divisible by $p$ (that is, $0$ modulo $p$) if and only if the rows of the matrix do not form a basis for $\mathbf{F}_p^2$, if ando nly if the rows are not linearly independent, if and only if one row is a multiple of the other.

To get trace that is not zero, you just need to avoid $a=0$, since $2a\equiv 0\pmod{p}$ if and only if $a\equiv 0 \pmod{p}$ (since $p$ is odd). Having chosen $a$ and an arbitrary $b$, the only way for the determinant to be a multiple of $p$ is if $(c,a) = k(a,b)$ for some $k\in\mathbf{F}_p$ (operation done modulo $p$). If $b=0$, then no choice of $c$ will do, since $a\neq 0$. So $b\neq 0$. If $b\neq 0$, then the only $k$ that can possibly work is $k\equiv ba^{-1}\pmod{p}$, which forces the value of $c$. So you have one and only one such matrix for each nonzero choice of $b$.

In summary: $p-1$ choices for $a$; $p-1$ choices for $b$; once $a$ and $b$ are fixed (both necessarily nonzero), $c$ is forced by the condition that $(c,a)$ must be a scalar multiple of $(a,b)$.

-

This essentially amounts to counting the cardinality of the following set: $T = \{a,b,c \in \mathbb{Z}_p: p \not | 2a \ \text{but} \ p|(a^2-bc) \ \text{for} \ a,b,c \in \mathbb{Z}_p \}$.

-
What does $\mathbb{Z}_p$ means here? I know that $\mathbb{Z}$ is the set of all integers. –  Quixotic Jan 31 '11 at 15:05
$\mathbb{Z}_p$ is $\{0,1, \dots, p-1 \}$. –  PEV Jan 31 '11 at 15:07
@Tretwick: For non-number theorists and non-ring-theorists, it means the (ring of) integers modulo $p$ under the addition and multiplication modulo $p$. Number Theorists dislike that notation, though, since in Algebraic Number Theory, $\mathbb{Z}_p$ is the $p$-adic integers, a completely different animals. Ring theorists and Number theorists prefer $\mathbb{Z}/p\mathbb{Z}$. –  Arturo Magidin Jan 31 '11 at 15:58