How can I calculate this sum $\sum_{x=1}^{\infty} x^2\cdot q^{x-1} \cdot p$?

How can I calculate this sum (while $0 < q,\ p < 1$)?

$$\sum_{x=1}^{\infty} x^2\cdot q^{x-1} \cdot p$$

I thought to calculate it with the derivative of something that gives $x^2\cdot q^{x-1} \cdot p$, but I don't know how to do it.

• Take derivative of $\frac{p}{1-q}=\sum_{x=0}^{\infty} q^x\cdot p$ with respect to $q$. Then multiply by $q$, and finally take another derivative with respect to $q$
– user551819
Commented May 2, 2018 at 10:01
• @totoro It's not so clear, can you explain more? Commented May 2, 2018 at 10:11
• Commented May 2, 2018 at 10:13
• Take responsibility for your own shortcomings. It is very clear, while it is you who doesn't understand.
– user551819
Commented May 2, 2018 at 10:14

Let $D$ be the differential operator ($Df = f'$). Then, $$\sum_{k = 1}^\infty k^2 q^{k - 1} = \frac{1}{q} \sum_{k = 1}^\infty (qD)^2 q^k = \frac{1}{q} (qD)^2 \sum_{k = 1}^\infty q^k.$$ This last sum is geometric. Carrying out the (somewhat tedious) calculations yields: \begin{equation*} \frac{1}{q} (qD)^2 \frac{q}{1 - q} = -\frac{q + 1}{(q - 1)^3}. \end{equation*} Multiplying by an arbitrary constant $p$ will not change the result.