# Two different results for the summation $\sum_{n=1}^{\infty}n^2 p^{n-1}$?

I'm trying to calculate the the following equation:

$$p(1-p)\frac{d}{dp}(p\frac{d}{dp}\sum_{k=0}^\infty p^k)$$

I've expanded the summation in the following steps:

$$p(1-p) \frac{d}{dp}(p \frac{d}{dp}[1 + p + p^2 +p^3 +....])$$ $$p(1-p) \frac{d}{dp}(p [1 + 2p + 3p^2 + 4p^3 + 5p^4 +...])$$ $$p(1-p)\frac{d}{dp}(p + 2p^2 + 3p^3 + 4p^4 + 5p^5 + ...)$$ $$p(1-p) (1 + 4p + 9p^2 + 16p^3 + 25p^4 + ...)$$

Thus, the pattern $\sum_{n=0}^{\infty}n^2 p^{n-1}$ has been reached, which was answered in this question. The final answer turned out to be: $\color{blue}{\frac{(1+p)}{(1-p)^3}}$

However, when I plug that same formula to wolfram it's not getting the same answer it seems:

https://www.wolframalpha.com/input/?i=(sum+i%3D0,infinity(i%5E2(x%5E(i-1)))

It outputs: $\color{blue}{-\frac{(x+1)}{(x-1)^3}}$

Am I going crazy or is wolfram incorrect?

• There is a whole genre of m.se questions along the lines of "why is this Wolfram Alpha answer crazy or wrong?". But here $-(x+1)/(x-1)^3=(1+x)/(1-x)^3$, so maybe it's right. Of course, with Wolfram Alpha you get what you pay for. – Angina Seng Jun 10 '17 at 7:15

This is so because $$\color{blue}{(x-1)^3}=(x-1)(x-1)(x-1)=\{-(1-x)\}\{-(1-x)\}\{-(1-x)\}=-(1-x)(1-x)(1-x)=\color{blue}{-(1-x)^3}$$
Hence - $$\frac{1+x}{(1-x)^3}=-\frac{1+x}{(x-1)^3}$$