Counting principles (however easy they may be) are not something I'm all that good with.

I am trying to find all 2 x 2 matrices with elements in $\displaystyle \mathbb{F}_p = \mathbb{Z}/n \mathbb{Z}$ where p is prime. I'm not going to go into the details but I am breaking the matrices down into subsets and counting them. I have two questions about the counting. ($\displaystyle a, b, c,d \in \mathbb{F}_p$ and are distinct.)

To start with I need a check. For matrices of the following form:

$\displaystyle \left ( \begin{matrix} a & a \\ b & b \end{matrix} \right ) $

I am counting that there are (p - 1)(p - 2) matrices of the above example. Is that right?

There seems to be (p - 1)(p - 2) matrices of the form

$\displaystyle \left ( \begin{matrix} a & a \\ a & b \end{matrix} \right ) $

as well. I'm fairly sure I'm right, I just want to check.

My second question is about the matrix:

$\displaystyle \left ( \begin{matrix} a & b \\ c & d \end{matrix} \right ) $

I need to remove matrices where the determinant ad - bc = 0. How do I count these?

Hopefully I've been clear. Let me know if I'm not.

Thanks!

-Dan