2. Determine the numbers $A, B$, and $C$ such that for every natural number $n \in \mathbb{N}$, the following equality holds:

$$
\frac{1}{2}+\frac{2}{2^{2}}+\frac{3}{2^{3}}+\ldots+\frac{n}{2^{n}}=\frac{A n+B}{2^{n}}+C
$$
Solution. A, B, and $C$ must be determined so that (1) holds for every natural number $n$. For $n=1$, we get

$$
\frac{1}{2}=\frac{A+B}{2}+C \text {. }
$$

For $n+1$, equation (1) becomes

$$
\frac{1}{2}+\frac{2}{2^{2}}+\frac{3}{2^{3}}+\ldots+\frac{n}{2^{n}}+\frac{n+1}{2^{n+1}}=\frac{A(n+1)+B}{2^{n+1}}+C
$$

Assuming that equation (1) holds for the number $n$, the previous equation holds if and only if

$$
\frac{A n+B}{2^{n}}+C+\frac{n+1}{2^{n+1}}=\frac{A(n+1)+B}{2^{n+1}}+C
$$

After rearranging, we get

$$
(A+1) n+(B-A+1)=0 \text {. }
$$

This equation must hold for every natural number $n$, so $A+1=0$ and $B-A+1=0$, i.e., $A=-1$ and $B=-2$. From (2), we get $C=2$. By the principle of mathematical induction, for these values of $A, B$, and $C$, equation (1) indeed holds for every $n \in \mathbb{N}$.