I want to evaluate this sum $$\sum_{k=0}^{n}k^{2}2^{k}$$ by summation by parts (two times) and I need to know, if my approach was right.
I know the formula for summation by parts is $$\sum u\Delta v=uv-\sum\left(Ev\right)\Delta u$$ where $E\left(v\left(x\right)\right)=v\left(x+1\right)$ and $(v(x))=v(x+1)-vx)$.
Further if $f$ is a Antiderivative of $g$ I know the formula $$\sum_{k=a}^{b}g\left(k\right)=f\left(b+1\right)-f\left(a\right)$$
First I choose $u=x^{2}$. This means $\Delta u=\Delta x^{2}=2x+1$. Choose $v=2^{x}$. That means $\Delta v=2^{x}$. Then I get
$$\begin{eqnarray*} \sum_{k=0}^{n}k^{2}2^{k} &=& \sum_{0}^{n+1}x^{2}2^{x} \\ &=& \left.x^{2}*2^{x}\right|_{0}^{n+1}-\sum_{0}^{n+1}2^{x+1}(2x+1) \\ &=& (n+1)^2 2^{n+1}-\sum_{0}^{n+1}2x2^{x+1}+2^{x+1} \\ &=& (n+1)^2 2^{n+1}-4\sum_{0}^{n+1}x2^{x} - 2\sum_{0}^{n+1}2^{x} \end{eqnarray*}$$
Now choose $u(x)=x$. This means $\Delta u=\Delta x=1$. Chose $v=2^{x}$. This means $\Delta v=2^{x}$ and $E(v(x))=2^{x+1}$. I get then
$$\begin{eqnarray*} \sum_{x=0}^{n+1}x2^{x+1} &=& \left[x2^{x}-2^{x+1}\right]_{0}^{n+1} \\ &=& ((n+1)-1)2^{(n+1)+1}+2 \\ &=& n2^{n+2}+2 \end{eqnarray*}$$
Putting those two calculations together resolves in $$\begin{eqnarray*} \sum_{k=0}^{n}k^{2}2^{k} &=&(n+1)^2 2^{n+1}-2\sum_{0}^{n+1}x2^{x+1} - \sum_{0}^{n+1}2^{x+1} \\ &=& (n+1)^2 2^{n+1}-2(n2^{n+2}+2) - (n+2)2^{x} \\ &=& 2^{n+1}(n^2+2n+1) -4(n2^{n+2}+2) - 2(n+2)2^{x} \\ &=& 2^{n+1}(n^2+2n+1-8n-(n+2))-8 \\ &=& 2^{n+1}(n^2-7n-1)-8 \\ \end{eqnarray*}$$
But Mathematica says $$2^{n+1} ((n-2) n+3)-6 = 2^{n+1} (n^2-2n+3)-6$$ Where is my fault?
Update
I placed the right calculations as an answer below.