Matrices and Divisibility Let $p$ be an odd prime number and $T_p$ be the following set of $2$ x $2$ matrices
$$T_p=\{A=\left(\begin{array}{cc} a & b\\ c & a \end{array}\right); a,b,c \in\{0,1,2,3...,p-1\}\}$$
 Q.1) The no. of $A$ in $T_p$ such that $det(A)$ is not divisible by p.
(A) $2p^2$
(B) $p^3-5p$
(C) $p^3-3p$
(D) $p^3 - p^2$
Q.2) The no. of $A$ in $T_p$ such that the trace of $A$ is not divisible by $p$ but $det(A)$ is divisible by $p$
(A) $(p-1)(p^2-p+1)$
(B) $p^3-(p-1)^2$
(C) $(p-1)^2$
(D) $(p-1)(p^2-2)$
Q.3) The no. of $A$ in $T_p$ such that $A$ is either symmetric or skew-symmetric or both and $det(A)$ is divisible by $p$
(A) $(p-1)^2$
(B) $2(p-1)$
(C) $(p-1)^2 +1$
(D) $2p-1$
I wa able to solve Q.3 only.
Approach:-
Considering the values of $a,b,c,$ $A$ can never be skew-symmetric.
Now $det(A) = a^2-bc$
For symmetric matrix, $b=c$
So, $det(A)=a^2-b^2=(a+b)(a-b)$
Case $I$: $a=b$
There are $p$ ways of selecting $a$ or $b$ (Select any no. in $\{1,2,3...,p-1\}$
Case $II$: $a \neq b$
$a+b$ must be a multiple of $p$ since $a-b$ will always given a no. less than $p$ according to the given set of $a,b,c$ and also $p$ is a prime no.
So there are $p-1$ ways to select $a$ and $b$. 
Possible ordered pairs of $(a,b)$ $(1,p-1), (2,p-2),...(p-1,1)$
Total ways: $2p-1$
Need help for Q.1 and Q.2
 A: The answers are
Q1:  $ \ p^3-p^2$, 
Q2:  $ \ (p-1)^2$.
To obtain these answers, let us solve an auxiliary problem first:
How many combinations of $a,b,c\in[0,p-1]$ result in $\det A$ divisible by $p$?
Example $1$: $ \ p=3. \ $ We have only $p^2=9$ combinations with $\det A$ divisible by $p$, namely:
$$
a=0, \quad b=0, \quad c=0 \\
a=0, \quad b=0, \quad c=1 \\
a=0, \quad b=0, \quad c=2 \\
a=0, \quad b=1, \quad c=0 \\
a=0, \quad b=2, \quad c=0 \\
a=1, \quad b=1, \quad c=1 \\
a=1, \quad b=2, \quad c=2 \\
a=2, \quad b=1, \quad c=1 \\
a=2, \quad b=2, \quad c=2 \\
$$
Of these, $(p-1)^2=4$ combinations have $a\ne0$, 
and $2p-1=5$ combinations have $a=0$. Indeed,
$$
(p-1)^2 + (2p-1) = p^2.
$$
Example $2$:  $ \ p=5. \ $ We have $p^2=25$ combinations with $\det A$ divisible by $p$. Similar to the previous example, $(p-1)^2=16$ combinations have $a\ne0$, 
and $2p-1=9$ combinations have $a=0$. 
Here are all the combinations with $p\,|\,\det A\,$ for $p=5$:
$$
 a=0, \quad b=0, \quad c=0 \\
 a=0, \quad b=0, \quad c=1 \\
 a=0, \quad b=0, \quad c=2 \\
 a=0, \quad b=0, \quad c=3 \\
 a=0, \quad b=0, \quad c=4 \\
 a=0, \quad b=1, \quad c=0 \\
 a=0, \quad b=2, \quad c=0 \\
 a=0, \quad b=3, \quad c=0 \\
 a=0, \quad b=4, \quad c=0 \\
 a=1, \quad b=1, \quad c=1 \\
 a=1, \quad b=2, \quad c=3 \\
 a=1, \quad b=3, \quad c=2 \\
 a=1, \quad b=4, \quad c=4 \\
 a=2, \quad b=1, \quad c=4 \\
 a=2, \quad b=2, \quad c=2 \\
 a=2, \quad b=3, \quad c=3 \\
 a=2, \quad b=4, \quad c=1 \\
 a=3, \quad b=1, \quad c=4 \\
 a=3, \quad b=2, \quad c=2 \\
 a=3, \quad b=3, \quad c=3 \\
 a=3, \quad b=4, \quad c=1 \\
 a=4, \quad b=1, \quad c=1 \\
 a=4, \quad b=2, \quad c=3 \\
 a=4, \quad b=3, \quad c=2 \\
 a=4, \quad b=4, \quad c=4. \\
$$
This pattern holds in the general case; there are $p^2$ combinations with
$p\,|\,\det A$, namely: 


*

*Each $a\in[1,p-1]$ corresponds to 
$(p-1)$ combinations with $\det A$ divisible by $p$. This gives us $(p-1)^2$
combinations with $p\,|\,\det A$ and $a\ne0$. 

*In addition, there are also $2p-1$ different combinations where $p\,|\,\det A$ and $a=0$.
Now it is easy to answer Questions 1 and 2
Question 1: There are $p^3$ combinations altogether. Of these, $p^2$ combinations correspond to $\det A$ divisible by $p$. Hence there are $p^3-p^2$ combinations with $\det A$ not divisible by $p$.
Question 2: We easily see that the trace of $A$ (which is $2a$) is divisible by $p$ if and only if $a=0$. So out of $p^2$ combinations where $p\,|\,\det A$ we need to exclude the $(2p-1)$ combinations where $a=0$. This leaves us with 
$$
p^2 - (2p-1) = (p-1)^2
$$
combinations where $a\ne0$ and $p\not|\,\,{\rm tr}\, A$ while $p\,|\,\det A$.
