Calculate the sums:

a) $C_{n}^{1}+2 C_{n}^{2}+3 C_{n}^{3}+\ldots+n C_{n}^{n}$

b) $C_{n}^{1}+2^{2} C_{n}^{2}+3^{2} C_{n}^{3}+\ldots+n^{2} C_{n}^{n}$
a) Let $f(x)=(1+x)^{n}=\sum_{k=0}^{n} C_{n}^{k} x^{k}$. Then $f^{\prime}(x)=n(1+x)^{n-1}=\sum_{k=0}^{n} k C_{n}^{k} x^{k-1}$. Substituting $x=1$ into this formula, we find the sum $\sum_{k=0}^{n} k C_{n}^{k}=f^{\prime}(x)=n \cdot 2^{n-1}$.

b) $\sum_{k=0}^{n} k^{2} C_{n}^{k} x^{k-1}=\left(x f^{\prime}(x)\right)^{\prime}=\left(n x(1+x)^{n-1}\right)^{\prime}=n x(1+x)^{n-1}+n(n-1) x(1+x)^{n-2}$. Therefore, $\sum_{k=1}^{n} k^{2} C_{n}^{k}=n \cdot 2^{n-1}+n(n-1) \cdot 2^{n-2}=n(n+1) \cdot 2^{n-2}$

## Answer

a) $n \cdot 2^{n-1}$; b) $n(n+1) \cdot 2^{n-2}$.