Let $\mathbb{F}_3$ be the field with three elements. Let $n\geq 1$. How many elements do the following groups have?


$\text{GL}_n(\mathbb{F}_3)$
$\text{SL}_n(\mathbb{F}_3)$


Here GL is the general linear group, the group of invertible n×n matrices, and SL is the special linear group, the group of n×n matrices with determinant 1. 

First question: We solve the problem for "the" finite field $F_q$ with $q$ elements.   The first row $u_1$ of the matrix can be anything but the $0$-vector, so there are $q^n-1$ possibilities for the first row.
For any one of these possibilities, the second row $u_2$ can be anything but a multiple of the first row, giving $q^n-q$ possibilities.
For any choice $u_1, u_2$ of the first two rows, the third row can be anything but a linear combination of $u_1$ and $u_2$. The number of linear combinations $a_1u_1+a_2u_2$ is just the number of choices for the pair $(a_1,a_2)$, and there are $q^2$ of these. It follows that for every $u_1$ and $u_2$, there are $q^n-q^2$ possibilities for the third row.
For any allowed choice $u_1$, $u_2$, $u_3$, the fourth row can be anything except a linear combination $a_1u_1+a_2u_2+a_3u_3$ of the first three rows. Thus for every allowed $u_1, u_2, u_3$ there are $q^3$ forbidden fourth rows, and therefore $q^n-q^3$ allowed fourth rows.
Continue. The number of non-singular matrices is
$$(q^n-1)(q^n-q)(q^n-q^2)\cdots (q^n-q^{n-1}).$$
Second question:  We first deal with the case $q=3$ of the question. If we multiply the first row by $2$, any matrix with determinant $1$ is mapped to a matrix with determinant $2$, and any matrix with determinant $2$ is mapped to a matrix with determinant $1$.
Thus we have produced a bijection between matrices with determinant $1$ and matrices with determinant $2$. It follows that $SL_n(F_3)$ has half as many elements as $GL_n(F_3)$.
The same idea works for any finite field $F_q$ with $q$ elements. Multiplying the first row of a matrix with determinant $1$ by the non-zero field element $a$ produces a matrix with determinant $a$, and all matrices with determinant $a$ can be produced in this way. It follows that
$$|SL_n(F_q)|=\frac{1}{q-1}|GL_n(F_q)|.$$
