# How to compute this finite series

I am struggling a bit to work out the elegant solution that Wolfram Alpha has for this finite series:

$$S = \sum_{k=1}^ nk\left(1 - \frac{1}{n}\right)^{k-1}\frac{1}{n}$$

My idea is to do differential trick Let $\cfrac{1}{n}T = \cfrac{1}{n}\sum_{k=1}^n \left(1 - \frac{1}{n}\right)^k \Rightarrow S = \frac{1}{n}\frac{\partial T}{\partial n} = \frac{1}{n} \frac{\partial{}}{\partial{n}} \cfrac{1 - (1 - \frac{1}{n})^{n+1}}{1 - (1 - \frac{1}{n})}$, but computations are really messy.

When I use WolframALpha, it gives a clean solution: $n - 2\left(\frac{n - 1}{n}\right)^nn$

https://www.wolframalpha.com/input/?i=sum+k+(1+-+1%2Fn)%5E%7Bk-1%7D++1%2Fn,+k%3D1+to+n

Anyone knows how they got it ?

• Let $p=1-\frac1n$ and then take derivatives with respect to $p$ in the expression for $T$. (not $\frac1n T$). – Math-fun Oct 5 '17 at 7:39

First we simplify your sum a bit:

$S = \sum_{k=1}^n k(1-\frac{1}{n})^{k-1}\frac{1}{n}=\frac{1}{n(1-\frac{1}{n})} \sum_{k=1}^n k(1-\frac{1}{n})^{k}$

This last sum is basically $\sum_{k=1}^nkp^k$. This is kind of a geometric sum. We can just ask again wolfram alpha what this sum is and be finished.

In case you want to compute this by yourself aswell:

$(1-p)\cdot\sum_{k=1}^n kp^k=\sum_{k=1}^nkp^k-\sum_{k=1}^nkp^{k+1}\\ =\sum_{k=1}^n kp^k-\sum_{k=1}^{n+1}(k-1)p^k=\sum_{k=1}^np^k-np^{n+1}\\ =\frac{p-p^{n+1}}{1-p}-np^{n+1}=\frac{p-(n+1)p^(n+1)+np^{n+2}}{(1-p)}$

• Thanks for the input. Anyway to do it without Wolfram ? – t-student Oct 5 '17 at 7:20

Since $n$ is fixed $$\sum_{k=1}^n \left(1 - \frac{1}{n}\right)^k =\sum_{k=1}^n a^k$$ is just a geometric sum.

• Sure. But we need to get S, not T. – t-student Oct 5 '17 at 7:20
• @t-student. What is the derivative of the lhs with respect to $n$ ? What is the rhs ? – Claude Leibovici Oct 5 '17 at 7:25