Let $p$ be an odd prime number and $T_p$ be the following set of $2\times 2$ matrices
$$ T_p= \biggl\{A = \begin{bmatrix}a & b\\c & a\end{bmatrix} \,\Big\vert\: a,b,c \in \{ 0, 1, 2, ... p-1\}\biggr \} $$
The number of $A$ in $T_p$ such that $\det(A)$ is not divisible by $p$ is?
I tried solving this by subtracting the determinants divisible by $p$ from total number of matrices. The total number of matrices in $T_p$ is $p^3$. If $a=0$ then either $b$ or $c$ should also be zero. Hence there are $2p-1$ cases for $a= 0$ and $\det(A)$ is divisible.
Dont know what to do for non zero $a$.