<s>[INST] Calculate the sum of series $\sum\limits_{i=0}^{n-1} i2^i$ 
Possible Duplicate:
How to compute the  formula $\sum  \limits_{r=1}^d r \cdot 2^r$? 

How can I calculate precise value of that series: $\sum\limits_{i=0}^{n-1} i2^i$ ?
So far, I tried to differentiate the $ \sum\limits_{i=0}^{n} 2^i = 2^{i-1} - 1 $ series, but by result $2^n(n+2)$ isn't correct according to Wolfram ($2^n (n-2)+2$). 
 [/INST] Here is another way to do this
Consider the polynomial $$\begin{align}&P(x)=\sum^{n-1}_{i=0} \ i\ \cdot \ x^i= 0x^0 +1x^1+2x^2+3x^3+\cdots +(n-1)\ x^{n-1}\\&Q(x)=\cfrac{P(x)}{x}=1x^0+2x^1+3x^2+\cdots+(n-1)\ x^{n-2}, \quad \quad x \ne 0\\ &\int Q(x)\ \text d x = cx^0+x^1+x^2+x^3+\cdots+ x^{n-1}=c+\sum^{n-1}_{i=1}x^i \\ &\text{by geometric series, we have} \int Q(x)\ \text d x =c+\cfrac{x(1-x^{n-1})}{1-x}\\ &\text{we then differentiate back to have } Q(x)= \cfrac{(n-1) x^{n+1}-n x^n+x}{x(x-1)^2 }\\ &\text{and at last } P(x)=x\cdot Q(x) =\cfrac{(n-1) x^{n+1}-n x^n+x}{(x-1)^2 }\\ &\text{we compute $P(2)$ to get the desired result }\\ &P(2)=\cfrac{(n-1) 2^{n+1}-n\cdot 2^n+2}{(2-1)^2 }=(n-1) 2^{n+1}-n\cdot 2^n+2\ \ =\ \ 2^n(2(n-1)-n)+2\\ &\sum\limits_{i=0}^{n-1} i\cdot 2^i=P(2)=2^n(n-2) +2 \end{align}$$ 
</s>