How to solve the following expression I have the following expression: $2^{n-3}+\sum_{k=1}^{n-3} 2^{k-1}(n-k+1)^2$ and I have no idea how to solve it. I tried plugging it in WolframAlpha to get an idea but it gives me $-n^2 - 4 n + 7 \cdot 2^{n - 1} - 6$ and I have even less of an idea how I would get there.
I don't need the complete solution done. I just would like pointers on how to solve it.
 A: Expand:
$$E=2^{n-3}+\sum_{k=1}^{n-3} 2^{k-1}(n-(k-1))^2=\\
2^{n-3}+\color{red}{n^2\sum_{k=1}^{n-3} 2^{k-1}}-2n\color{green}{\sum_{k=1}^{n-3}(k-1)2^{k-1}}+\color{blue}{\sum_{k=1}^{n-3}(k-1)^22^{k-1}}$$
One:
$$\color{red}{n^2\sum_{k=1}^{n-3} 2^{k-1}}=n^2\cdot \frac{2^{n-3}-1}{2-1}=\color{red}{n^2\cdot 2^{n-3}-n^2}$$
Two:
$$f(x)=\sum_{k=1}^{n-3} x^{k-1}=\frac{x^{n-3}-1}{x-1}\\
f'(x)=\sum_{k=1}^{n-3} (k-1)x^{k-2}=\frac{(n-3)x^{n-4}(x-1)-x^{n-3}+1}{(x-1)^2}\\
xf'(x)=\sum_{k=1}^{n-3} (k-1)x^{k-1}=\frac{(n-4)x^{n-2}-(n-3)x^{n-3}+x}{(x-1)^2}\\
2f'(2)=\color{green}{\sum_{k=1}^{n-3} (k-1)2^{k-1}}=(n-4)2^{n-2}-(n-3)2^{n-3}+2=\\
\color{green}{n\cdot 2^{n-3}-5\cdot 2^{n-3}+2}$$
Three:
$$f(x)=\sum_{k=1}^{n-3} (k-1)x^{k-1}=\frac{(n-4)x^{n-2}-(n-3)x^{n-3}+x}{(x-1)^2}\\
f'(x)=\sum_{k=1}^{n-3} (k-1)^2x^{k-2}=\cdots\\
xf'(x)=\sum_{k=1}^{n-3} (k-1)^2x^{k-1}=\cdots\\
2f'(2)=\color{blue}{\sum_{k=1}^{n-3} (k-1)^22^{k-1}}=\cdots=\\
\color{blue}{n^2\cdot 2^{n-3}-5n\cdot 2^{n-2}+27\cdot 2^{n-3}-6}$$
If all plugged in, it results in the stated answer. 
Wolfram answer.
A: You'll just to simplify the expression
$f(n) = 2^{n-3}+\sum_{k=1}^{n-3} 2^{k-1}*(n-k+1)^2$
Now let's expand 
$f(n) = 2^{n-3}+\sum_{k=1}^{n-3} 2^{k-1}*(n^2-2*k*n+2*n+k^2-2*k+1)$
Let's reduce it
$f(n) = 2^{n-3}+\sum_{k=1}^{n-3} 2^{k-1}*(n^2+2*n+1) +\sum_{k=1}^{n-3} 2^{k-1}*(-2*k*n-2*k) + \sum_{k=1}^{n-3} 2^{k-1}*(k^2)$
Simplify more
$f(n) = 2^{n-3}+ (n^2+2*n+1)*\sum_{k=1}^{n-3} 2^{k-1} -2*(n+1)*\sum_{k=1}^{n-3} k*2^{k-1}+\sum_{k=1}^{n-3} (k^2)*2^{k-1}$
Remember that 
$\sum_{k=1}^{n-3} 2^{k-1} = 1+2+2^2+2^3+...........+2^{n-3-1} = 2^{n-3}-1$
It's becomes difficult here
$\sum_{k=1}^{n-3} k*2^{k-1} = h(x) = k*2^{k-1}+(k-1)*2^{k-2}+(k-2)*2^{k-3}+........+3*2^2+2*2^1+1*2^0$
But It's not so hard to see that 
$h(x)*2-k*2^k = 2*h(x-1)$
You'll need to solve some recurring equation now 
$h(x) = 2^x*(x-1)+1$
$\sum_{k=1}^{n-3} (k^2)*2^{k-1} = g(x) = (k^2)*2^{k-1}+(k-1)^2*2^{k-2}+(k-2)^2*2^{k-3}+........+ 3^2*2^2+2^2*2+1$
Same process involved we can also see that
$g(x)*2 -x^2*2^x = 2*g(x-1)$
So that $g(x) = 2^x*(x^2-2*x+3)-3$
Don't forget that the plugin value is $h(n-3)$ and $g(n-3)$
Therefore
$f(n) = 2^{n-3}+(n^2+2*n+1)*(2^{n-3}-1)-2*(n+1)*(2^{n-3}*(n-3-1)+1)+2^{n-3}*((n-3)^2-2*(n-3)+3)-3$
Expand and simplify this to get our solution
$f(n) = 7*2^{n-1}-n^2-4*n-6$
So you see that the trick is recurring equation, which Wolfram automatically solves
