TITLE: Is there a $q$-L'Hospital's Rule?
QUESTION [13 upvotes]: Let $\binom{n}{j}_q$ be a $q$-binomial coefficient and $(x;q)_n = (1-x)(1-qx)\cdots(1-q^{n-1}x).$ 
Consider the sum $$f(n,m,r,k)= \sum\limits_{j =  0}^{2n} {( - 1)}^{ j}q^{mj^2+rj}
\binom{2n}{j}_{q^k}$$ for integers $m,r$ and positive integers $k$.
Note that a famous result of Gauss says that $f(n,0,0,1)=(q;q^2)_n$.
For $n=1$ we get $f(1,m,r,k)=1-q^{m+r}-q^{k+m+r}+q^{4m+2r}$ 
and therefore
$$\frac{f(1,m,r,k)
}
{1-q}
={\frac{1-q^{k+m+r}}{1-q}}-q^{m+r}{\frac{1-q^{3m+r}}{1-q}}$$
which for ${q\to1}$ converges to ${(k+m+r)-(3m+r)}={k-2m}.$  
Computer experiments suggest that for each positive integer $n$ 
$$\lim_ {q\to1}\frac{f(n,m,r,k)
}
{{(q;q^2)_n}
}=(k-2m)^n.$$
Till now I did not find a method which leads to a proof of this result.
I asked the special case $ \lim_ {q\to1}\frac{f(n,m,m,1)}{f(n,1,1,1)}$
of this Problem already in Mathematics Stack Exchange 1359886.

REPLY [9 votes]: I think you can achieve this using the actual $q$-L'Hospital's Rule. Consider
$$\frac{ \partial^i f(n,m,r,k)}{\partial q^i} (1)= \sum_{i=0}^a \binom{a}{i} \sum\limits_{j =  0}^{2n} {( - 1)}^{ j}\frac{\partial^a q^{(m-k/2)j^2+rj}}{ \partial q^a}(1) 
\frac{ \partial ^{i-a} q ^{ (k/2) j^2} \binom{2n}{j}_{q^k}}{ \partial q^{i-a}}(1)$$
Now $\frac{\partial^a q^{(m-k/2) j^2+rj}}{ \partial q^a}(1)$ is a polynomial of degree $2a$ in $j$. So we can write this in terms of
$$ F(b,c) = \sum\limits_{j =  0}^{2n} {( - 1)}^{ j}j^b
\frac{ \partial ^{c} q^{(k/2) j^2} \binom{2n}{j}_{q^k}}{ \partial q^{c}}(1)$$ 
where $b+2c \leq 2i$.
We want to show that this vanishes for $i < n$ and evaluate it for $i=n$. For the first, it suffices to show that for all $b$ and $c$ with $b+2c < 2n$ we have:
$$F(b,c)=0$$ 
But these terms all show up in computing the partial derivatives for the sum 
$$\sum\limits_{j =  0}^{2n} {( - 1)}^{ j}
 q^{(k/2) j^2 + rj} \binom{2n}{j}_{q^k}$$
$$  \frac{ \partial ^i \sum\limits_{j =  0}^{2n} {( - 1)}^{ j}
 q^{(k/2) j^2 + rj} \binom{2n}{j}_{q^k}}{ \partial q^i} (1) =  \sum_{i=0}^a \binom{a}{i} \sum\limits_{j =  0}^{2n} {( - 1)}^{ j}\frac{\partial^a q^{rj}}{ \partial q^a}(1) 
\frac{ \partial ^{i-a} q ^{ (k/2) j^2} \binom{2n}{j}_{q^k}}{ \partial q^{i-a}}(1)  
$$ 
$$ = \sum_{i=0}^a \binom{a}{i} \sum\limits_{j =  0}^{2n} {( - 1)}^{ j} (rj)(rj-1) \dots (rj+1-a)
\frac{ \partial ^{i-a} q ^{ (k/2) j^2} \binom{2n}{j}_{q^k}}{ \partial q^{i-a}}(1)$$
$$ = \sum_{i=0}^a \binom{a}{i} \sum_{b=0}^a[j^b] (rj)(rj-1) \dots (rj+1-a) F(b,i-a) $$
Now suppose by induction that $F(b,c)=0$ for $b+c < i $ for some fixed $i \leq 2n$. Then this sum simplifies to only include the terms where $b=a$. Here
$$[j^a] (rj)(rj-1) \dots (rj+1-a) = r^a$$
so we obtain
$$= \sum_{i=0}^a \binom{a}{i} r^a F(a,i-a) $$
If $i<2n$ then this polynomial is identically $0$ by Max's computation, so all the coefficients vanish, so $F(a,i-a)=0$. This verifies the induction step.
Hence $F(b,c)=0$ for $b+c<2n$, which includes $b+2c<2n$, so the first $n-1$ partial derivatives vanish.
What about the $n$th partial derivative? Well the only $F(b,c)$ with $b + 2c \leq 2n$ that we don't know is $0$ is $F(2n,0)$. So dropping all the other terms we get
$$\frac{ \partial^n f(n,m,r,k)}{\partial q^n} (1)=   F(2n,0) [ j^{2n}]\frac{\partial^n q^{(m-k/2)j^2+rj}}{ \partial q^n}(1) $$
Clearly
$$ [ j^{2n}]\frac{\partial^n q^{(m-k/2)j^2+rj}}{ \partial q^n}(1) = [j^{2n}] ( (m-k/2)j^2+rj) ((m-k/2)j^2+rj-1) \dots ((m-k/2)j^2+rj+1-n) = (m-k/2)^{n}$$
So we get a constant depending only on $n$ times $(2k-m)^n$. To get the correct constant, you can compute it directly, or just note that it is sufficient to handle one special case for each $n$ and note that you did the $f(n,0,1,2)$ case in the comments to Max's answer.