# how many 2x2 matrices are invertible in mod p

I am trying to solve this problem for homework but unable to get anything. The question is to find the number of invertible 2x2 matrices in mod p? Each entery can bee from the set {0,1,2....(p-1)} where p is prime.

-
How many choices do you have for your first column? Then what about the second column once you've chosen a first? –  Derek Allums Nov 19 '12 at 16:32
Sorry, in a hurry I left some information –  Aman Deep Gautam Nov 19 '12 at 16:36
Right, I was asking those as hints to you mainly. It's just a counting problem once you interpret invertibility the right way. The answer below is precisely was I was getting at. –  Derek Allums Nov 19 '12 at 16:47

The answer is $(p^2-1)(p^2-p)$, since there are $(p^2-1)$ ways to choose the first column such that it is non-zero, then the second column can be chosen in any way out of the $p$ multiples of the first column.