<s>[INST] How is the partial sum of a geometric sequence calculated? I have been asked to calculate a general formula for $1 + b + 2b^2 + 3b^3 + ... + Nb^N$
I think that a part of this is a geometric sequence, and I have rewritten this as 
$f(x) = 1 + \sum_{i=1}^n i\cdot x^i$
(I couldn't figure out a way to make the first term be 1 with the progression so I just removed it from the series instead)
When I look on Wolfram Alpha it says that the partial sum formula for $ \sum_{i=1}^n i\cdot x^i$ is:
$$\sum_{i=1}^n i\cdot x^i = \frac{(nx-n-1)x^{n+1}+x}{(1-x)^2}$$
On this question, an answer said that the general formula for the sum of a finite geometric series is:
$$\sum_{k=0}^{n-1}x^k = \frac{1-x^n}{1-x}$$
But if I substitute my ($i\cdot x^i$) into the formula mentioned above I don't get the same value as the one Wolfram gives me.
Two questions:


*

*Is it correct to pull the first term out of the series so it becomes a geometric series, or is there another way?

*How did Wolfram Alpha calculate that expression?

 [/INST] Start with $$S=1 + b + 2b^2 + 3b^3 + \cdots + Nb^N$$
Multiply by $b$ and then subtract to give 
$$bS=b + b^2 + 2b^3 + 3b^4 + \cdots +(N-1)b^N + Nb^{N+1}$$
$$(b-1)S = -1 - b^2 - b^3 - b^4 - \cdots -b^N + Nb^{N+1}$$
Do that again
$$b(b-1)S = -b - b^3 - b^4 - b^5 - \cdots -b^N-b^{N+1} - Nb^{N+2}$$
$$(b-1)^2S = 1-b +b^2 -(N+1)b^{N+1} + Nb^{N+2}$$
Finally simplify
$$S = \dfrac{1-b +b^2 -(N+1)b^{N+1} + Nb^{N+2}}{(b-1)^2}.$$
As an example, with $b=2$ and $N=3$ the first line gives $S=1+2+8+24=35$ while the final line gives $S=\frac{1-2+4-64+96}{1^2}= 35$ 
</s>