# Sum of infinite series with an unknown

How do I calculate the infinite sum of this series?

$$\sum_{n=1}^{\infty}n^2q^n = -\frac{q(q+1)}{(q-1)^3}\ \text{when}\ |q| < 1.$$

How does wolfram alpha get this result?

• Which one of the above results do you mean? – mrs Jan 8 '14 at 12:16
• Apparently, there was some unfortunate editing here. wolframalpha.com/share/… – user3071205 Jan 8 '14 at 12:19
• Did you mean this? – Michael Albanese Jan 8 '14 at 12:20
• @user3071205: But this link is not the same as you added in the body. :-) – mrs Jan 8 '14 at 12:21
• I rolled back the edit because it is better to have the formula here than to have a link to another site which displays it. – Michael Albanese Jan 8 '14 at 12:35

$$\sum_{n=1}^\infty n^2q^n=q\sum_{n=1}^\infty n^2q^{n-1}=q\cdot\frac{\text d}{\text dq}\left(\sum_{n=1}^\infty nq^n\right)$$ It is well-known that $\frac{1}{(1-x)^2}=\sum_{n=1}^\infty nx^{n-1}$ (given $|x|<1$), so we have \begin{align} \sum_{n=1}^\infty n^2q^n&=q\cdot\frac{\text d}{\text dq}\left(\frac q{(1-q)^2}\right)\\ &=q\cdot\frac{(1-q)^2+2q(1-q)}{(1-q)^4}\\ &=\frac{q(1+q)}{(1-q)^3} \end{align}
$$\sum_{k=1}^{\infty} q^k = \frac{q}{1-q}$$
Now, apply the operator $(qD)^2 = (qD)(qD)$ where $D= \frac{d}{dq}$ to both sides of the above equation.