TITLE: Number of elements of a matrix subset with field $\mathbb{Z}_p$
QUESTION [6 upvotes]: Can anybody please help me this problem?
Let $K = \mathbb{F}_p$ be the field of integers module an odd prime $p$, and $G = \mathcal{M}^*_n(\mathbb{F}_p)$ the set of $n\times n$ invertible matrices with components in $\mathbb{F}_p$. Based on the linear (in)dependence of the columns of a matrix $M\in G$, get the number of matrices in $G$.
Thanx in advance.

REPLY [3 votes]: Hint: you are working with a pool of $p^n$ column vectors from $\Bbb F^n$. Of course, $n$ could be 1 or 2, but to get you going, what I say will venture up to 3.
When picking the first column, you'll have $p^n-1$ choices. (Anything except the zero vector.)
When you pick the second column, you'll have to avoid picking something in the span of the first column. There are $p$ things in that span since you can choose the coefficient freely from the field, so you now have $p^n-p$ choices for the second column.
For the third column, you'd have to pick a vector not in the span of the first two columns. There are $p^2$ such vectors, since you can choose two coefficents for the vectors freely. So now you are down to $p^n-p^2$ vectors... 
Can you see how to count the total possibilities from these data?

REPLY [2 votes]: The process for creating an arbitrary invertible matrix is as follows:

The first column of an invertible matrix can be selected to be any nonzero vector.
Second column can be picked to be any vector not in the span of the first.
Third column can be picked to be any vector not in the span of the first two.
$\cdots\cdots\cdots$

Convince yourself that this will always create a matrix whose columns are independent (hence is invertible), and any invertible matrix can be obtained in this way.
At each step, figure out how many vectors can be picked. (For this, you'll need to find out how many vectors are in a subspace of a given dimension.) Then multiply all of these counts together.