Calculate the following sums using generating functions:
a) $\sum_{k=0}^{n-1} 2^{k} x^{k} ;$
b) $\sum_{k=0}^{n-1} k \cdot 2^{k}$
c) $\sum_{k=0}^{n-1} k^{2} \cdot 2^{k}$
d) $\sum_{k=0}^{n-1} k \sin k x$.
a) Let the desired sum be denoted by $f(x)$. By the formula for the sum of a geometric progression, $f(x)=\frac{(2 x)^{n}-1}{2 x-1}$.

b) This sum is equal to $f^{\prime}(1)=2^{n}(n-2)+2$.

c) This sum is equal to $f^{\prime}(1)+f^{\prime \prime}(1)=2^{n}\left(n^{2}-5 n+8\right)-8$.

d) According to the formula from problem $\underline{61123}$ a),

$$
g(x)=\sum_{k=0}^{n-1} \cos k x=\frac{\sin \frac{(n-1) x}{2} \cos \frac{n x}{2}}{\sin \frac{x}{2}}=\frac{\sin \left(n-\frac{1}{2}\right) x-\sin \frac{1}{2} x}{2 \sin \frac{1}{2} x}=\frac{\sin \left(n-\frac{1}{2}\right) x}{2 \sin \frac{1}{2} x}-\frac{1}{2}
$$

The desired sum is

$$
\begin{gathered}
-g^{\prime}(x)=\frac{\frac{1}{2} \sin \left(n-\frac{1}{2}\right) x \cos \frac{1}{2} x-\left(n-\frac{1}{2}\right) \cos \left(n-\frac{1}{2}\right) x \sin \frac{1}{2} x}{2 \sin ^{2} \frac{1}{2} x}= \\
=\frac{(\sin n x+\sin (n-1) x)-(2 n-1)(\sin n x-\sin (n-1) x)}{4(1-\cos x)}=\frac{n \sin (n-1) x-(n-1) \sin n x}{2(1-\cos x)}
\end{gathered}
$$

## Answer

a) $\frac{2^{n} x^{n}-1}{2 x-1}$
b) $2^{n}(n-2)+2$
c) $2^{n}\left(n^{2}-5 n+8\right)-8$
d) $\frac{n \sin (n-1) x-(n-1) \sin n x}{2(1-\cos x)}$.