How to evaluate $\sum_{i=0}^{k-1} 2^i\cdot 4(k-i-1).$ I'm currently having trouble evaluating the following sum to get a formula in terms of $k$:
$$\sum_{i=0}^{k-1} 2^i\cdot 4(k-i-1)$$
I know that $$\sum_{i=0}^n 2^i = 2^{n+1}-1$$
but since my $2^i$ is multiplied with another term inside my summation, I can't use that formula to evaluate it. Any suggestions?
 A: Hint.
$$
\frac{d}{dx}x^{k-i-1}=(k-i-1)x^{k-i-2}
$$
now making $x=\frac 12$ we have
$$
\left(\frac12\right)^{k}2^i4(k-i-1)
$$
then think on
$$
\frac{d}{dx}\sum x^{k-i-1}
$$
A: Let $ k\in\mathbb{N}^{*} $, we have :\begin{aligned}\sum_{i=0}^{k-1}{\left(k-1-i\right)2^{i}}&=\sum_{i=0}^{k-1}{\left(k-1-i\right)\left(2^{i+1}-2^{i}\right)}\\ &=\sum_{i=0}^{k-1}{\left(k-1-i\right)2^{i+1}}-\sum_{i=0}^{k-1}{\left(k-1-i\right)2^{i}}\\ &=\sum_{i=1}^{k}{\left(k-i\right)2^{i}}-\sum_{i=0}^{k-1}{\left(k-1-i\right)2^{i}}\\ &=\sum_{i=0}^{k-1}{\left(k-i\right)2^{i}}-\sum_{i=0}^{k-1}{\left(k-1-i\right)2^{i}}-k\\ &=\sum_{i=0}^{k-1}{2^{i}}-k\\ \sum_{i=0}^{k-1}{\left(k-1-i\right)2^{i}}&=2^{k}-1-k\end{aligned}
A: I would first let $\ell=k-1$ and rewrite it as
$$\begin{align*}
\sum_{i=0}^\ell 2^i\cdot 4(\ell-i)&=4\sum_{i=0}^\ell 2^i(\ell-i)\\
&=4\sum_{i=0}^\ell i2^{\ell-i}\\
&=4\cdot 2^\ell\sum_{i=1}^\ell\frac{i}{2^i}\\
&=2^{k+1}\sum_{i=1}^\ell\frac{i}{2^i}\,.
\end{align*}$$
That last summation is of a type that comes up quite often enough that it’s worth knowing how to derive a closed form for it. The accepted answer to this question gives a very easy, elementary derivation of the general formula for such summations. Just plug this summation into that general formula and simplify, and you’ll have your answer.
