Let $\mathbb{F}_p$ be a field with $p$ elements and $\mathbb{M}_n(\mathbb{F}_p)$ is the set of all $n \times n$ matrices over the field $\mathbb{F}_p$.
Now, we know that $|\mathbb{M}_n(\mathbb{F}_p)| = p^{n^2}$. The number of matrix with rank $0$ is $1$, namely the null matrix of order $n$. Number of matrices with rank $n$ is $$\prod_{i=0}^{n-1} (p^n-p^i),$$ namley $GL(n, \mathbb{F}_p)$.
How many elements with rank $r~ (0 \leq r \leq n)$ in $\mathbb{M}_n(\mathbb{F}_p)$?
Note: If we denote the number of elements with rank $i~ (0 \leq i \leq n)$ is $R_i$ in $\mathbb{M}_n(\mathbb{F}_p)$ then $$\sum_{i=0}^{n} R_i= p^{n^2}.$$