How do I evaluate $\sum_{n=1}^{\infty}\frac{(-1)^{n+1}H_n}{2n+1}?$

So, I am coming from this question. I managed to bring the answer to this series:

$$\sum_{n=1}^{\infty}\frac{(-1)^{n+1}H_n}{2n+1}$$ where $H_n$ is the $n$th harmonic number.

However, as seen in the comments, the integral is $\frac{\pi\ln(2)}{2}-C$ where $C$ is Catalan's constant. Certainly, the series looks somewhat like the series for Catalan's constant, but I'm not sure how to deal with the harmonic numbers. The series does seem to be numerically correct, as it slowly converges to the desired value. Any help is appreciated.


Let $\psi(z)$ be the digamma function.

The integral $$\int_{0}^{1} \frac{\ln(1+x^{2})}{1+x^{2}} \, \mathrm dx = -2 \int_{0}^{\pi/4} \log(\cos u) \, \mathrm du$$ can be evaluated in several ways. See this question for example.

But if you want to evaluate the series in a way that doesn't involve that integral, you could integrate the meromorphic function $$f(z) = \frac{\pi \csc(\pi z)\left(\psi(-z)+ \gamma \right)}{2z+1}$$ around a rectangular contour $C_{N}$ with vertices at $z = \pm (N+ \frac{1}{2}) \pm i \sqrt{N} $, where $N$ is a positive integer.

The function has double poles at the nonnegative integers, simple poles at the negative integers, and a simple pole at $z= - \frac{1}{2}$.

On the contour, the magnitude of $\psi(-z)$ grows slowly like $\ln|z|$ as $N \to \infty$.

This, combined with the fact that the magnitude of $\csc(\pi z)$ decays exponentially to zero as $\Im(z) \to \pm \infty$, means the integral will vanish on the contour as $N \to \infty$.

Therefore, we get $$ \lim_{N \to \infty} \int_{C_{N}} f(z) \, \mathrm dz = 0 = \sum_{n=-\infty}^{-1}\operatorname{Res}[f(z), n] + \sum_{n=0}^{\infty} \operatorname{Res}[f(z), n] + \operatorname{Res}[f(z), -1/2].$$

The Laurent series of $f(z)$ at a nonnegative integer is $$ \begin{align} f(z) &= \small \left(\frac{(-1)^n}{z-n} + \mathcal{O}(z-n) \right)\left(\frac{1}{z-n} + H_{n} + \mathcal{O}(z-n) \right) \left(\frac{1}{2n+1} -\frac{2(z-n)}{(2n+1)^{2}} + \mathcal{O}\left((z-n)^{2} \right)\right) \\ &= \frac{(-1)^{n}}{2n+1} \frac{1}{(z-n)^{2}} + \left( \color{red}{\frac{(-1)^{n}H_{n}}{2n+1} -\frac{2 (-1)^{n}}{(2n+1)^{2}} }\right ) \frac{1}{(z+n)}+ \mathcal{O}(1). \end{align}$$

Therefore, at an nonnegative integer $n$, there is a double pole with residue $$\frac{(-1)^{n}H_{n}}{2n+1} -\frac{2 (-1)^{n}}{(2n+1)^{2}}. $$

At $z=-n, n <0$, there is a simple pole with residue $$(-1)^{n+1} \frac{\psi(n)+ \gamma}{2n-1} = (-1)^{n+1} \frac{H_{n-1}}{2n-1}. $$

And at $z= - \frac{1}{2}$, there is a simple pole with residue $$-\frac{\pi}{2} \left( \psi \left(\frac{1}{2}\right)+ \gamma\right) = \pi \ln 2 . \tag{1}$$

Putting everything together, we have

$$\begin{align} 0 &= \sum_{n=1}^{\infty} \frac{(-1)^{n+1} H_{n-1}}{2n-1} + \sum_{n=0}^{\infty} \frac{(-1)^{n}H_{n}}{2n+1} -\sum_{n=0}^{\infty} \frac{2 (-1)^{n}}{(2n+1)^{2}} + \pi \ln 2 \\ &= -\sum_{k=0}^{\infty} \frac{(-1)^{k+1} H_{k}}{2k+1} - \sum_{n=0}^{\infty} \frac{(-1)^{n+1}H_{n}}{2n+1} -2 \sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2n+1)^{2}} + \pi \ln 2 \\ &= -2 \sum_{n=0}^{\infty}\frac{(-1)^{n+1}H_{n}}{2n+1} - 2 \sum_{n=0}^{\infty} \frac{ (-1)^{n}}{(2n+1)^{2}} + \pi \ln 2 \\ &= -2 \sum_{n=0}^{\infty}\frac{(-1)^{n+1}H_{n}}{2n+1} - 2 G + \pi \ln 2 \\ &= -2 \sum_{n=1}^{\infty}\frac{(-1)^{n+1}H_{n}}{2n+1} - 2 G + \pi \ln 2 \end{align}$$

The result then follows.


$(1)$ Special values $\psi \left(\frac12\right)$ and $\psi \left(\frac13\right)$


Using the generating function for $\displaystyle \sum_{n=1}^{\infty}z^{n}H_{n}=\frac{-\ln(1-z)}{1-z}$

So we have $$\sum_{n=1}^{\infty}(-1)^{n}z^{n}H_{n}=\frac{-\ln(1+z)}{1+z}$$

So $$\sum_{n=1}^{\infty}(-1)^{n}z^{2n}H_{n}=\frac{-\ln(1+z^{2})}{1+z^{2}}$$.

Integrating both sides from $0\to 1$ we get:-

$$\sum_{n=1}^{\infty}\frac{(-1)^{n+1}H_n}{2n+1}=\int_{0}^{1}\frac{\ln(1+z^{2})}{1+z^{2}}\,dz=\int_{0}^{\frac{\pi}{4}}2\ln(\sec(x))\,dx$$