# How to count the total # of non-invertible 2x2 matrices

Can anyone explain to me how to count the total # of non-invertible 2x2 matrices?

I have the answer from the book, which is r^3+r^2-r provided r is a prime. But it doesn't explain how to get there, and I couldn't figure it out. I haven't been practicing linear algebra for quite a long time.

I know a 2x2 matrix is non-invertible iff the determinant is zero, and a matrix is non-invertible iff rows (columns) are linearly dependent, one row (column) must be a scalar multiple of the other.
If we have a 2x2 matrix A:
a b
c d
A is non-invertible iff det(A) = ad-bc = 0
If I have a set of number r that is prime to choose from for each entry in the matrix. It's easier to play with the zeros, but then I got very confused when it combines with the numbers.

Can anyone be so graciously helping me out and explain it in detail? Many thanks!

HallsofIvy
Homework Helper
I'm afraid I don't understand your question. Do you mean the number of matrices with entries from $Z_r$?

Last edited by a moderator:
I believe you do mean to count the matrices over the field $$\mathbb{Z}_r$$. The count is done as follows:

group A of matrices are of form [a,b; c,d] with $$a\neq 0$$ and $$d=\dfrac{bc}{a}$$. This is $$(r-1)r^2=r^3-r^2$$ matrices.

Groups B, C are of form [0,b;0,d] and [0,0;c,d] - each has $$r^2$$ members. However, they share the common set of r matrices of form [0,0; 0,d]. Therefore, gorups B,C have $$2r^2-r$$ elements.

Alltogether it is the required number. Convince yourself that the mentioned forms are exactly those an non-invertible matrix can take.

The total number is not only infinite, its not numerable; its isomorphic to the Real Line (or complex plan for that matter). Matrices [[a b][c d]] of the form a*d = b*c are uncountable, because we can always find real number pairs a*d such that there exists a real pairs (or complex ones) b*c such that a*d=b*c. So I think that the size is beth-one; the following article may suggests that its larger (beth-two) because it says the functions from R^m to R^n is that size (let m=n), and that would include a 2-by-2 matrix. However, we are considering a considerably different class of matrices, namely the non-invertible ones (so this is a much smaller set of matrices).
Anyway, to answer a simple question, simply: THERE ARE A LOT of (INFINITE) such matrices.

I believe you do mean to count the matrices over the field $$\mathbb{Z}_r$$. The count is done as follows:

group A of matrices are of form [a,b; c,d] with $$a\neq 0$$ and $$d=\dfrac{bc}{a}$$. This is $$(r-1)r^2=r^3-r^2$$ matrices.

Groups B, C are of form [0,b;0,d] and [0,0;c,d] - each has $$r^2$$ members. However, they share the common set of r matrices of form [0,0; 0,d]. Therefore, gorups B,C have $$2r^2-r$$ elements.

Alltogether it is the required number. Convince yourself that the mentioned forms are exactly those an non-invertible matrix can take.

I'm not sure where you get the equation $$(r-1)r^2=r^3-r^2$$ from, but it seems wrong....

Can anyone explain to me how to count the total # of non-invertible 2x2 matrices?

I have the answer from the book, which is r^3+r^2-r provided r is a prime. But it doesn't explain how to get there, and I couldn't figure it out. I haven't been practicing linear algebra for quite a long time.

I know a 2x2 matrix is non-invertible iff the determinant is zero, and a matrix is non-invertible iff rows (columns) are linearly dependent, one row (column) must be a scalar multiple of the other.
If we have a 2x2 matrix A:
a b
c d
A is non-invertible iff det(A) = ad-bc = 0
If I have a set of number r that is prime to choose from for each entry in the matrix. It's easier to play with the zeros, but then I got very confused when it combines with the numbers.

Can anyone be so graciously helping me out and explain it in detail? Many thanks!

Do you mean, assuming the elements of the matrix are prime.... your question isn't clear enough.... please specify.

brydustin, the question concern matrices over the finite field $$\mathbb{Z}_r$$, which has r elements. Hence the finite count.

HallsofIvy