# Calculate $\sum_{n=1}^{\infty}n^2q^{n-1}$

Please show me how to calculate the sum of this infinite series:

$$\sum_{n=1}^{\infty}n^2 q^{n-1}$$

I should have included the condition $\mid q\mid$<1

And I was able to solve the infinite series of $$S_n=\sum_{n=1}^{\infty}n q^{n-1}=1+2q+3 q^2+4q^3...$$ The trick is to calculate $$q S_{n}=\sum_{n=1}^{\infty}n q^{n}=q+2q^2+3q^3+...$$ And find out that $$S_{n}-q S_{n}=\sum_{n=1}^{\infty}=1+q+q^2+q^3+...=\sum_{n=1}^{\infty}q^n=\frac{1}{1-q}$$ And thus $$S_{n}=\frac{\frac{1}{1-q}}{1-q}=\frac{1}{(1-q)^2}$$

But I was not able to use same trick on the series I want to solve.

P.S. @user17762 has provided a genius way to handle this kind of series and his approach could simplify the calculation of $\sum_{n=1}^{\infty}n q^{n-1}$ too. Just watch the first two steps he used.

-
Welcome to Math.SE! Please, consider updating your question to include what you have tried / where you are getting stuck. You will find that people on this site will be significantly faster to help you if you do that; that way, we know exactly what help you need. – Did Sep 14 '13 at 16:13
Do you mean $n^2(q^n-1)$ or $(n^2q^n) - 1$? Notationally, the latter is more usual, but I suspect you meant the former. Also, notice that when $q = 10$ the sum is obviously infinite, so make sure you aren't missing out any important details. – Ben Millwood Sep 14 '13 at 16:14

Your series converges only when $\vert q \vert <1$. Here is one possible way to derive the sum of the infinite series, for $\vert q \vert <1$. We have $$\sum_{n=1}^{\infty} q^n = \dfrac{q}{1-q} = -1 - \dfrac1{q-1}$$ Differentiate this once to get $$\sum_{n=1}^{\infty} n q^{n-1} = \dfrac{d}{dq} \left(\dfrac{q}{1-q} \right) = \dfrac1{(q-1)^2}$$ Multiplying by $q$, we get that $$\sum_{n=1}^{\infty} n q^{n} = \dfrac{q}{(q-1)^2} = \dfrac1{q-1} + \dfrac1{(q-1)^2}$$ Differentiate this again, to get $$\boxed{\displaystyle \sum_{n=1}^{\infty} n^2 q^{n-1}=-\dfrac1{(q-1)^2} - \dfrac2{(q-1)^3} = \color{blue}{\dfrac{(1+q)}{(1-q)^3}}}$$
Thanks a lot, your approach is quite genius. I was having trouble to solve this sum the whole morning, I should have mentioned that $\mid q\mid<1$. Your solution is also illuminating, I never thought of that way. P.S. Can I ask how you made the last formula blue? I am new here. – Kenneth Chen Sep 14 '13 at 18:39
@RencoHuangyuChen To get the text in blue color, you need to do as follows: $\color{blue}{\text{This text is blue in color}}$ gives $\color{blue}{\text{This text is blue in color}}$ – user17762 Sep 14 '13 at 19:07
${\large\tt\mbox{\color{#0000ff}{blue}}}$ yields $\color{#0000ff}{blue}$. – Felix Marin Sep 14 '13 at 19:08