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$). 

$$\begin{array}{rll}
S  &=1\cdot2^1+&2\cdot2^2+3\cdot2^3+\cdots+(n-2)\cdot2^{n-2}+(n-1)\cdot2^{n-1} \\
2S &=          &1\cdot2^2+2\cdot2^3+\cdots+(n-3)\cdot2^{n-2}+(n-2)\cdot2^{n-1}+(n-1)\cdot2^{n}
\end{array}$$
Subtracting,
$$S-2S=1\cdot2^1+(2-1)\cdot2^2+\cdots+\{(n-2)-(n-3)\}\cdot2^{n-2}+\{(n-1)-(n-2)\}\cdot2^{n-1}-(n-1)2^n=(2^1+2^2+\cdots+2^{n-1})-(n-1)2^n=2\left(\frac{2^{n-1}-1}{2-1}\right)-(n-1)2^n=2^n\{1-(n-1)\}-2$$
So, $S=2+2^n(n-2)$
Refernce: Arithmetico-geometric series
