# Simplifying $\sum _{k=-n}^n k^2 q^k$

How can we simplify $\sum _{k=-n}^n k^2 q^k$? Is there any nice expression?

-

If $q=1,\sum_{-n\le k\le n}k^2q^k=\sum_{-n\le k\le n}k^2=2\sum_{0\le k\le n}k^2$ as $(-t)^2=t^2$

So, $\sum_{-n\le k\le n}k^2q^k=2\frac{n(n+1)(2n+1)}6=\frac{n(n+1)(2n+1)}3$

If $q\ne 1,$ $$\sum _{k=-n}^n q^k=q^{-n} \frac{q^{2n+1}-1}{q-1}$$

Apply derivative wrt $q,$ $$\sum _{k=-n}^n kq^{k-1}=\frac{d\left(\frac{q^{n+1}-q^{-n}}{q-1}\right)}{dq}$$

Now multiply with $q,$ $$\sum _{k=-n}^n kq^{k}=q\frac{d\left(\frac{q^{n+1}-q^{-n}}{q-1}\right)}{dq}$$

Apply derivative wrt $q$ and multiply with $q$

-