It works fine, because

actually is a field.

Here's another way which generalises to any finite field

and any dimension

.

A square matrix is invertible if and only if its rows are linearly independent. Take each row in turn. The first row must be non-zero so there are

possibilities. The second row must not the in the subspace generated by the first row, which has dimension one, so there are

possiblities. The

-th row must not be in the subspace generated by the previous

rows, linearly independent by induction, so of dimension

giving

possibilities. The overal number of possiblities is thus

In the case

this is

.