<s>[INST] Another way to find the sum $S=1-\dfrac{3}{2}+\dfrac{5}{4}-\dfrac{7}{8}+\cdots+(-1)^{n-1}\cdot\dfrac{2n-1}{2^{n-1}}$ I want to know the sum
$$S=1-\dfrac{3}{2}+\dfrac{5}{4}-\dfrac{7}{8}+\cdots+(-1)^{n-1}\cdot\dfrac{2n-1}{2^{n-1}}.$$ This is my way.
First, we find the sum
$$1 + 3 x + 5x^2 + \cdots + (2n-1) \cdot x^{n-1}=\sum _{k=1}^n (2 k-1) x^{k-1}.$$
We have
$$\sum _{k=1}^n (2 k-1) x^{k-1} = 2\sum _{k=1}^n k\cdot x^{k-1}-\sum _{k=1}^n  x^{k-1}. $$
Note that
$$\sum _{k=1}^n k\cdot x^{k-1} = \left (\sum _{k=1}^n x^k\right)' = \left (\dfrac{x\left(x^n-1\right)}{x-1}\right)'=\dfrac{n x^{n+1}-(n+1)x^n+1}{(x-1)^2}.$$
Another way
$$\sum _{k=1}^n  x^{k-1} = \dfrac{x^n-1}{x-1}.$$
From the above results, we have
$$1 + 3 x + 5x^2 + \cdots + (2n-1) \cdot x^{n-1}= \dfrac{(2 n-1) x^{n+1}-(2 n+1)x^n+x+1}{(x-1)^2}.$$
With $x=-\dfrac{1}{2}$,we get
$$S=\dfrac{2^n + (-1)^{n+1} \cdot(6n+1)}{9 \cdot 2^{n-1}}.$$
How to find the result with another way?
 [/INST] $$S+\frac S2=\sum_1^n\frac{(-1)^{k-1}(2k-1)}{2^{k-1}}+\sum_1^n\frac{(-1)^{k-1}(2k-1)}{2^{\color{red}k}}\\
=\sum_1^n\frac{(-1)^{k-1}(2k-1)}{2^{k-1}}+\sum_\color{red}2^{\color{red}{n+1}}\frac{(-1)^{k-2}(2k-3)}{2^{\color{red}{k-1}}}\\
=1+\sum_2^n\frac{(-1)^{k-2}(\color{red}{2k-1-2k+3})}{2^{k-1}}+\frac{(-1)^{n-1}(2n-1)}{2^n}.$$
The rest is well-known.
</s>