Counting subspaces above the range of a linear map
Let $F$ be a finite field of cardinality $q$ and let $f:P\to Q$ be linear, with $\dim_FP=N$ and $\dim_FQ=N+g$, where $N,g\ge0$. Write $b_d(K)$ for the number of $d$-dimensional subspaces of a finite $F$-vector space $K$. For every $j\ge0$, $$\#\{U\le Q:\operatorname{im}f\subseteq U,\ \dim_FU+j=N+g\} =\sum_{\ell=0}^j q^{(j-\ell)\max(g-\ell,0)}{g\brack\ell}_q\,b_{j-\ell}(\ker f).$$ Here ${g\brack\ell}_q$ is the Gaussian binomial coefficient, taken to be zero for $\ell>g$.