$$\sum_{i=0}^{n-1} ia^i = \frac{a-na^n+(n-1)a^{n+1}}{(1-a)^2}$$
What is the thought process behind obtaining this formula?
$$\sum_{i=0}^{n-1} ia^i = \frac{a-na^n+(n-1)a^{n+1}}{(1-a)^2}$$
What is the thought process behind obtaining this formula?
Well, here is my thought process. I let $S = \sum_{i = 0}^{n-1}ia^i$. Multiplying both sides by $a$, I get $aS = \sum_{i = 0}^{n-1}ia^{i+1}$. I want to express the sum on the right as a linear expression in $S$, for then I'll have a linear equation in $S$ for which I can solve. To this end, I write $$\sum_{i = 0}^{n-1}ia^{i+1} = \sum_{i = 0}^{n-1} [(i + 1)a^{i+1} - a^{i+1}] = \sum_{i = 0}^{n-1} (i + 1)a^{i+1} - \sum_{i = 0}^{n-1} a^{i+1}.$$ I notice that the expression $\sum_{i = 0}^{n-1} (i+1)a^{i+1}$ contains all the terms of $S$ plus one more term, $na^n$. So $\sum_{i = 0}^{n-1} (i + 1)a^{i+1} = S + na^n$. I know that the sum $\sum_{i = 0}^{n-1} a^{i+1}$ is a geometric sum with common ratio $a$ and first term $a$, so I have $$\sum_{i = 0}^{n-1} a^{i+1} = a\frac{a^n-1}{a-1} = \frac{a^{n+1}-a}{a-1}.$$ Collecting my results, I have $$aS = S + na^n - \frac{a^{n+1}-a}{a-1}.$$ That is, $$aS = S + \frac{na^n(a - 1) - a^{n+1} + a}{a - 1}.$$ The numerator on the second term on the right-hand side can be written out
$$na^{n+1} - na^n - a^{n+1} + a = (n-1)a^{n+1} - na^n + a.$$ Therefore,
\begin{align}aS &= S + \frac{(n-1)a^{n+1} - na^n + a}{a - 1}\\ (a - 1)S &= \frac{(n-1)a^{n+1} - na^n + a}{a - 1}\\ S &= \frac{(n-1)a^{n+1} - na^n + a}{(a - 1)^2}\\ S &= \frac{a - na^n + (n-1)a^{n+1}}{(1 - a)^2}. \end{align}