as it's told on the title im asking for the convergence of the $\sum_{n=1}^{\infty}(-1)^n\left (\frac{1}{n}+\frac{\cos (\pi n)}{2n}\right)$ . I tried to use the Leibniz's test, but I need the $\cos$ term to be monotonic. I derived it, and the derivative function it's always negative, but i tried to plot the function or give the first values for $n=1,2,3,4$ and it's not monotonic. I know it converges but I don't know how to prove it.
Thanks for helping
First of all note that $\cos(n\pi) = (-1)^n$, so we have that:
$$\sum_{n=1}^{\infty}(-1)^n\left (\frac{1}{n}+\frac{\cos (\pi n)}{2n}\right) = \sum_{n=1}^{\infty}(-1)^n\left (\frac{1}{n}+\frac{(-1)^n}{2n}\right)= \sum_{n=1}^{\infty}\left (\frac{(-1)^n}{n}+\frac{1}{2n}\right)$$
Now as $\frac{(-1)^n}{n}+\frac{1}{2n} = \frac{1 + 2(-1)^n}{2n}$, so for the sum is $\frac{3}{2n}$ for even terms and $\frac{-1}{2n}$ for odd terms. Considering the partial sums we have:
$$S_N = \sum_{n=1}^N (-1)^n\left (\frac{1}{n}+\frac{\cos (\pi n)}{2n}\right) = -\frac 12 + \frac 34 - \frac 16 + \frac{3}{8} - \cdots$$
For two consecutive numbers we have $\frac{3}{4k} - \frac{1}{2(2k-1)} = \frac{6k-3-2k}{4k(2k-1)} = \frac{4k-3}{8k^2 - 4k}$. This means that the partial sums behave like the harmonic series, so it's divergent.