# How to calculate $\sum_{n=1}^\infty\frac{(-1)^n}n H_n^2$?

I need to calculate the sum $\displaystyle S=\sum_{n=1}^\infty\frac{(-1)^n}n H_n^2$, where $\displaystyle H_n=\sum\limits_{m=1}^n\frac1m$.

Using a CAS I found that $S=\lim\limits_{k\to\infty}s_k$ where $s_k$ satisfies the recurrence relation \begin{align} & s_{1}=-1,\hspace{5mm} s_{2}=\frac18,\hspace{5mm} s_{3}=-\frac{215}{216},\hspace{5mm} s_{4}=\frac{155}{1728},\hspace{5mm} \text{for all} \quad k>4, \\ s_{k} &=\frac1{k^3(2k-3)}\left(\left(-4k^4+18k^3-25k^2+12k-2\right)s_{k-1}+\left(12k^3-39k^2+38k-10\right)s_{k-2} \right.\\ & \hspace{5mm} \left. +\left(4k^4-18k^3+25k^2-10k\right)s_{k-3}\\+\left(2k^4-15k^3+39k^2-40k+12\right)s_{k-4}\right), \end{align} but it could not express $S$ or $s_k$ in a closed form.

Can you suggest any ideas how to calculate $S$?

• Is that just $(H_n)^2$ or $H_n^{(2)}$? – Ali May 29 '13 at 4:22
• Looking at the definition of $H_n$, lack of $\,{}^{(\phantom2)}$ around ${}^2$ and the values of partial sums, I would assume $(H_n)^2$. – Vladimir Reshetnikov May 29 '13 at 4:38
• The $s$ sequences make a real vector space of dimension 4. So, if you manage to find the sequences with $(s_1, s_2,s_3,s_4) = (1,0,0,0),$ then $(s_1, s_2,s_3,s_4) = (0,1,0,0),$ then $(s_1, s_2,s_3,s_4) = (0,0,1,0),$ then $(s_1, s_2,s_3,s_4) = (0,0,0,1),$ you are set. – Will Jagy May 29 '13 at 4:50
• – math110 May 29 '13 at 5:22
• @math110: There may be some useful ideas there, but $H_n^2\ne H_n^{(2)}$, so this isn’t $A(2,1)$. – Brian M. Scott May 29 '13 at 5:24

Write down the function $$g(z) = \sum_{n\geq1} \frac{z^n}{n}H_n^2,$$ so that $S=g(-1)$ and $g$ can be reduced to $$zg'(z) = \sum_{n\geq1} z^n H_n^2 = h(z).$$

Now, using $H_n = H_{n-1} + \frac1n$ ($n\geq2$), we can get a closed form for $h(z)$: $$h(z) = z + \sum_{n\geq2}\frac{z^n}{n^2} + \sum_{n\geq 2}z^n H_{n-1}^2 + \sum_{n\geq 2} 2\frac{z^n}{n}H_{n-1}.$$ Now, the first and third sums Mathematica can evaluate itself in closed form (the third one evaluates to the function $p(z)$ below, the first one is $\text{Li}_2(z)-z$), and the middle sum is $z h(z)$.

Substituting this into the expression for $g(z)$, we get $$g(z) = \int \frac{\text{Li}_2(z) + p(z)}{z(1-z)}\,dz,$$ $$p(z) = -\frac{\pi^2}{3} + 2\log^2(1-z)-2\log(1-z)\log(z)+2\text{Li}_2((1-z)^{-1}) - 2\text{Li}_2(z).$$ Mathematica can also evaluate this integral, giving (up to a constant of integration) \begin{align} g(z) &= \frac{1}{3} \left(-2 \log(1-z^3+3 \log(1-z)^2 \log(-z)+\log(-1+z)^2 (\log(-1+z)+3 \log(-z) \right. \\ & \hspace{5mm} \left. -3 \log(z))+\pi ^2 (\log(-z)-2 \log(z))+\log(1-z) \left(\pi^2 - 3 \log(-1+z)^2 \right. \right.\\ & \hspace{5mm} \left.\left. +6 (\log(-1+z)-\log(-z)) \log(z)\right)-6 (\log(-1+z)-\log(z)) \left(\text{Li}_{2}\left(\frac{1}{1-z}\right)-\text{Li}_{2}(z)\right) \right.\\ & \hspace{10mm} \left. -3 \log(1-z) \text{Li}_{2}(z)+3 \text{Li}_{3}(z)\right). \end{align} The constant of integration is fixed by requiring $g(0)=0$.

Some care needs to be taken, because the function is multi-valued, when evaluating $g(-1)$. The answer is $$\frac{1}{12}(\pi^2\log2-4(\log 2)^3-9\zeta(3)).$$

let $$y=\sum_{n=1}^{\infty}H^2_{n}x^n$$

then we have $$y=x+xy+\ln^2{(1-x)}+\int_{0}^{x}\dfrac{\ln{(1-t)}}{t}dt$$

so $$y=\dfrac{\ln^2{(1-x)}}{1-x}+\sum_{n=1}^{\infty}\left(1+\dfrac{1}{2^2}+\cdots+\dfrac{1}{n^2}\right)x^n$$

we have $$\frac{\ln^2(1-x)}{1-x}=\sum_{n=1}^{\infty}\left(H_n^2-H_n^{(2)}\right)x^n$$

replace $$x$$ with $$-x$$, divide both sides by $$x$$ then integrate w.r.t $$x$$ from $$0$$ to $$1$$ , we get: \begin{align*} S_1&=\sum_{n=1}^{\infty}(-1)^n\left(H_n^2-H_n^{(2)}\right)\int_0^1x^{n-1}\ dx=\sum_{n=1}^{\infty}\left(H_n^2-H_n^{(2)}\right)\frac{(-1)^n}n=\underbrace{\int_0^1\frac{\ln^2(1+x)}{x(1+x)}\ dx}_{x=\frac{1-y}{y}}\\ &=\int_{1/2}^1 \frac{\ln^2x}{1-x}\ dx=\sum_{n=1}^{\infty}\int_{1/2}^1x^{n-1}\ln^2x\ dx=\sum_{n=1}^{\infty}\left(\frac{2}{n^3}-\frac{2}{2^n n^3}-\frac{2\ln2}{2^n n^2}-\frac{\ln^22}{2^n n}\right)\\ &=2\zeta(3)-2\operatorname{Li_3}\left(\frac12\right)-2\ln2\operatorname{Li_2}\left(\frac12\right)-\ln^32 \end{align*}

Now using the identity:

$$\displaystyle \int_0^1x^{n-1}\ln^2(1-x)\ dx=\frac1n\left(H_n^2+H_n^{(2)}\right)$$

multiply both sides by $$(-1)^n$$ then sum both sides w.r.t $$n$$ from $$1$$ to $$\infty$$, we get \begin{align*} S_2&=\sum_{n=1}^{\infty}\left(H_n^2+H_n^{(2)}\right)\frac{(-1)^n}{n}=\int_0^1\frac{\ln^2(1-x)}{x}\sum_{n=1}^{\infty}(-x)^n\ dx=\underbrace{-\int_0^1\frac{\ln^2(1-x)}{1+x}\ dx}_{x=1-y}\\ &=-\int_0^1\frac{\ln^2(x)}{2-x}=-\sum_{n=1}^{\infty}\frac1{2^n}\int_0^1 x^{n-1}\ln^2x\ dx=-2\sum_{n=1}^{\infty}\frac1{2^n n^3}=-2\operatorname{Li_3}\left(\frac12\right) \end{align*} we are now ready to calcualate our sum: \begin{align*} \frac{S_1+S_2}{2}=\sum\frac{(-1)^n H_n^2}{n}&=\zeta(3)-2\operatorname{Li_3}\left(\frac12\right)-\ln2\operatorname{Li_2}\left(\frac12\right)-\frac12\ln^32\\ &=\frac12\ln2\zeta(2)-\frac34\zeta(3)-\frac13\ln^32 \end{align*}

and as a bonus : \begin{align*} \frac{S_2-S_1}{2}=\sum\frac{(-1)^n H_n^{(2)}}{n}&=\ln2\operatorname{Li_2}\left(\frac12\right)-\zeta(3)+\frac12\ln^32\\ &=\frac12\ln2\zeta(2)-\zeta(3) \end{align*}

where the results of $$\operatorname{Li_3}\left(\frac12\right)=\frac78\zeta(3)-\frac12\ln2\zeta(2)+\frac16\ln^32$$ and $$\operatorname{Li_2}\left(\frac12\right)=\frac12\zeta(2)-\frac12\ln^22$$ were used in the calculations.

Or we can use the generating function

$$\sum_{n=1}^\infty\frac{H_{n}^2}{n}x^{n}=\operatorname{Li}_3(x)-\ln(1-x)\operatorname{Li}_2(x)-\frac13\ln^3(1-x)$$

By setting $$x=-1$$ we get

$$\sum_{n=1}^\infty\frac{H_n^2}{n}(-1)^n=-\frac34\zeta(3)+\frac12\ln2\zeta(2)-\frac13\ln^32$$

note that $$\operatorname{Li}_3(-1)=-\frac34\zeta(3)$$ and $$\operatorname{Li}_2(-1)=-\frac12\zeta(2)$$

Here is a solution using simple tools

We have

$$\sum_{n=1}^\infty x^nH_n=-\frac{\ln(1-x)}{1-x}$$

Replace $$x$$ with $$-x$$ then multiply both sides by $$-\frac{\ln(1-x)}{x}$$ and use the fact that $$-\int_0^1 x^{n-1}\ln(1-x)\ dx=\frac{H_n}{n}$$

$$\sum_{n=1}^\infty\frac{(-1)^nH_n^2}{n}=\int_0^1\frac{\ln(1-x)\ln(1+x)}{x(1+x)}\ dx$$ $$=\underbrace{\int_0^1\frac{\ln(1-x)\ln(1+x)}{x}\ dx}_{-5/8\zeta(3)}-\underbrace{\int_0^1\frac{\ln(1-x)\ln(1+x)}{1+x}\ dx}_{\frac{1}{1+x}=y}$$

$$=-\frac58\zeta(3)-\int_{1/2}^1\frac{\ln\left(\frac{y}{2y-1}\right)\ln y}{y}\ dy=-\frac58\zeta(3)-I$$

$$I=\int_{1/2}^1\frac{\ln^2y}{y}\ dy-\int_{1/2}^1\frac{\ln(2y-1)\ln y}{y}\ dy=\frac13\ln^32-\Re\int_{1/2}^1\frac{\ln(1-2y)\ln y}{y}\ dy$$

$$=\frac13\ln^32+\Re\sum_{n=1}^\infty \frac{2^n}{n}\int_{1/2}^1 y^{n-1}\ln y\ dy=\frac13\ln^32+\Re\sum_{n=1}^\infty\frac{2^n}{n}\left(\frac{\ln2}{n2^n}+\frac{1}{n^22^n}-\frac{1}{n^2}\right)$$

$$=\frac13\ln^32+\ln2\zeta(2)+\zeta(3)-\Re\text{Li}_3(2)=\frac18\zeta(3)-\frac12\ln2\zeta(2)+\frac13\ln^32$$

where we used $$\Re\text{Li}_3(2)=\frac78\zeta(3)+\frac32\ln2\zeta(2)$$

Plug the result of $$I$$ we get $$\sum_{n=1}^\infty\frac{(-1)^nH_n^2}{n}=\frac12\ln2\zeta(2)-\frac34\zeta(3)-\frac13\ln^32$$

A different way to find $$\int\frac{\ln(1-x)\ln(1+x)}{1+x} \ dx$$ First, add and subtract $$\ln2$$ and note that $$\int\ln\left(\frac{1-x}{2}\right)\ dx=-\text{Li}_2\left(\frac{1+x}{2}\right)$$

$$\int\frac{\ln(1-x)\ln(1+x)}{1+x} \ dx=\int\frac{\ln\left(\frac{1-x}{2}\right)\ln(1+x)}{1+x} \ dx+\ln2\int\frac{\ln(1+x)}{1+x}\ dx$$

$$\overset{IBP}{=}-\ln(1+x)\text{Li}_2\left(\frac{1+x}{2}\right)+\int\frac{\text{Li}_2\left(\frac{1+x}{2}\right)}{1+x}\ dx+\frac12\ln2\ln^2(1+x)$$

$$=-\ln(1+x)\text{Li}_2\left(\frac{1+x}{2}\right)+\text{Li}_3\left(\frac{1+x}{2}\right)+\frac12\ln2\ln^2(1+x)$$

Therefore

$$\small{\int_0^a\frac{\ln(1-x)\ln(1+x)}{1+x} \ dx=\text{Li}_3\left(\frac{1+a}{2}\right)-\text{Li}_3\left(\frac{1}{2}\right)-\ln(1+a)\text{Li}_2\left(\frac{1+a}{2}\right)+\frac12\ln2\ln^2(1+a)}$$