<s>[INST] Solving summation $2n+2^2(n-1)+2^3(n-2)+....+2^n$ Can anyone help me with this summation? I tried to use the geometric series on this, but I can't use that.
$$2n+2^2(n-1)+2^3(n-2)+....+2^n$$
I am trying to do this for studying algorithms. Can we get a closed form for this ?
 [/INST] This does have a nice closed form.
We can write your original sum, $2n+2^2(n-1)+2^3(n-2)+....+2^n$, as
$(2+2^2+2^3+...2^n)+(2+2^2+2^3+...2^{n-1})+2+2^2+2^3+...2^{n-2})+...+2$, because this sum will have $n$ $2$'s, $n-1$ $2^2$'s, and so on. By the geometric series formula, this sum simplifies to $(2^{n+1}-2) + (2^n-2) + (2^{n-1}-2)+...+(2^2-2)$, which itself simplifies (again by the geometric series formula) to $2^{n+2}-4-2n$.
</s>