how to find $|GL_2(F_p)|$ [duplicate]

I need to find $|GL_2(F_p)|$, I am very very uncomfortable in counting, so please help here I proceed,

$\begin{pmatrix}a&b\\c&d\end{pmatrix}$ be such an invertible matrix, so we need and sufficient that $ad\neq bc$, so if i chose all non zero $a,b,c$ arbitrarily and chose $d\neq a^{-1}bc$ and form matrices then the cardinality will be $(q-1)^3\times (q-2)$, well now if one of $a,b,c,d$ be zero then other three can be anything nonzero so in this case cardinality will be $4(q-1)^3$, so finally if two entries are $0$ then they must be opposite to each other i.e diagonally, but other two must be nonzero, so cardinality in that case $2(q-1)^2$, so total number is just sum of three cases.


Your calculation seems to lead to the right result (except that your $q$s should be $p$s or vice versa), but there's an easier way:

First, let's count the number of possible column vectors. There are $p^2$ of them.

The first column of the matrix must be nonzero, but can otherwise be arbitrary. There are $p^2-1$ ways to choose the first column.

Once we have chosen the first column, how many ways are there to chose a second column that is linearly independent of it? Well, any column vector works here, except for the $p$ different scalar multiples of the first column. So there are $p^2-p$ ways to choose the second column.

All in all, there are $(p^2-1)(p^2-p)$ matrices in $GL_2(\mathbb F_p)$.

This generalizes directly to the size of $GL_n(K)$ for any finite field $K$, namely $ \prod_{i=0}^{n-1} |K|^n-|K|^i $.


Rather consider the following question: In how many ways can you pick two linearly independent vectors in $\mathbb{F}_p^2$.

That is how many choices do you have to pick the first vector. Once you pick a vector, how many vectors among the remaining are linearly dependent on the first vector? So how many of the remaining are linearly independent of the first one?


Counting the elements in $GL_2(F)$ where $F$ is a finite field, say $|F|=q=p^f$, amounts to counting how many ordered basis the $F$-vector field $F^2$ has. You can choose the first vector in $q^2-1$ ways and since the second vector can be anything but a multiple of the first, you have $q^2-q$ choice for it bringing the total to $$ (q^2-1)(q^2-q). $$

Alternatively, you can decide how many first columns you have and then for any given choice of first column, how many ways you have to complete the matrix knowing that $\det\neq0$ amounts to rank $=2$. It is actually the same thing also conceptually.

You should note that this strategy generalizes immediately to $GL_n(F)$ for all $n\geq1$.