I tried to solve these two examples, but without success, could someone help me solve it because I got stuck on them and don't understand how to solve them.
Using the sum disturbance method, find a compact form of the following sums: \begin{align} &\textrm{(a)} &&\sum_{k=1}^n{(-1)^k \frac{k}{2^{k-1}}}\\ &\textrm{(b)} &&\sum_{k=1}^n{(1+k2^{k-1})^2} \end{align}
The disturbance method is sum $${s_{n+1} = a_{1} + a_2 + \dots + a_n + a_{n+1}}$$ expressed in two ways. The first is obvious: $$s_{n+1} = s_n + a_{n+1}.$$ The second is to present $s_{n+1}$ in form: $$s_{n+1} = a_1 + f(s_n),$$ where f is a function. Then we get the equality $$s_n + a_{n+1} = a_1 + f(s_n).$$ This equality can be treated as an equation with one unknown $s_n$. When it is solved in relation to this unknown, we obtain a compact form of a sum.
For part (a), \begin{align} f(s_n) &=s_{n+1}-a_1\\ &=\sum_{k=2}^{n+1}{(-1)^k \frac{k}{2^{k-1}}}\\ &=\sum_{k=1}^n {(-1)^{k+1} \frac{k+1}{2^k}}\\ &=-\frac{1}{2}\sum_{k=1}^n (-1)^k \frac{k}{2^{k-1}} -\sum_{k=1}^n \left(-\frac{1}{2}\right)^k\\ &=-\frac{s_n}{2} -\frac{-1/2-(-1/2)^{n+1}}{1-(-1/2)}\\ &=-\frac{s_n}{2} +\frac{1-(-1/2)^n}{3}, \end{align} so $s_n + a_{n+1} = a_1 + f(s_n)$ becomes $$s_n + (-1)^{n+1} \frac{n+1}{2^n} = -1 -\frac{s_n}{2} +\frac{1-(-1/2)^n}{3},$$ which implies that $$s_n = \frac{2}{3}\left((-1)^n \frac{n+1}{2^n} -1 +\frac{1-(-1/2)^n}{3}\right) = \frac{2}{9}\left((3n+2)\left(\frac{-1}{2}\right)^n -2\right). $$