Find |X| such that |X| is not 0, and is not divisible by a prime p in N

Hi, the problem I don't know is this one below... I have also solved a similar one below. Thanks a lot for any help you can give me! I am so lost... I don't have a clue how to do this (Headbang)

Suppose that X is the set of all 2*2 matrices

(a | b)

(c | d)

(sorry, I don't know how to do matrices)

such that a, b, c, d belong to {0, 1, 2, ..., p-1} and p does not divide (ad-bc) and ad-bc is not equal to zero either, where p is a prime in the set of natural numbers N.

Find |X|.

Well, I have a similar problem (I needed to find the number of possible matrices) solved when a, b, c, d belong to Q (set of irrational numbers) and where ad-bc=0, but how do I get it for the case above (with very different conditions)?

When they belong to Q, I got:

Set Q as finite and countable, q=|Q|

Let q=Q

Consider to matrices:

(0 | 0)

(c | d), so we have q^2 matrices

Also consider

(a | b)

(c | d), where (a | b) is not equal to (0 | 0)

If a \= 0, then (c | d) = (c/a)*(a | b)

If b \= 0, then (c | d) = (d/a)*(a | b)

(c | d) = n*(a | b), where n belongs to Q.

So we have q*(q^2-1) matrices.

Adding them gives: q(q^2-1)+q^2=q^3+q^2-q.