I was working on a combinatorial problem over finite fields, and the following quantity came up:
$$ \sum_{r=0}^k\, r\,\binom{n-k}{r}_q\,\binom{k}{k-r}_q\,q^{r^2},$$
where $k$ and $n$ are integers such that $0<k<\dfrac{n}{2}$, and $\displaystyle\binom{a}{b}_q$ denotes the $q$-binomial. I am trying to understand if there is a closed formula for it.
In the case of the classical binomials I managed to prove that
$$ \sum_{r=0}^k \,r\,\binom{n-k}{r}\,\binom{k}{k-r}=(n-k)\,\binom{n-1}{k-1},$$ readapting the proof of the Vandermonde identity, but I don't know how to do it in the $q$-analog case. Any help or hint would be appreciated.
Alessandro.