Example 4.30. Find the sum of the series:

$$
1-\frac{1}{2}+\frac{1}{3}-\frac{1}{4}+\ldots=\sum_{n=1}^{\infty}(-1)^{n+1} \frac{1}{n}
$$
Solution. As in Example 4.29, we will base our approach on the infinite geometric series $\sum_{n=1}^{\infty} x^{n}$. Let $|x|<1$, and apply Theorem 4.25\left(x_{0}=0\right)$ to this series:

$$
\int_{0}^{x}\left(\sum_{n=0}^{\infty} t^{n}\right) d t=\sum_{n=0}^{\infty} \frac{x^{n+1}}{n+1}=\sum_{n=0}^{\infty} \frac{x^{n}}{n}
$$

For $x=-1$, we obtain the original series multiplied by (-1). On the other hand,

$$
\int_{0}^{x}\left(\sum_{n=0}^{\infty} t^{n}\right) d t=\int_{0}^{x} \frac{t}{1-t}=-\ln (1-x)
$$

According to Remark 4.2, the upper limit of integration can be taken as $x=-1$. Therefore, $\sum_{n=1}^{\infty}(-1)^{n} \frac{1}{n}=-\ln 2$. The sum of the original series $\sum_{n=1}^{\infty}(-1)^{n+1} \frac{1}{n}=\ln 2$.