# Comparison of sum and integral over squares of Harmonic numbers

This is an extension of the simpler question 

This time we compare sum and integral over the squares of the harmonic numbers (see  for definitions)

The sum is

$$f_{s2}(n) = \sum_{k=0}^n H_k^2$$

It can be calculated to give (see (4) in )

$$f_{s2}(n) = (n+1) H_n^2 - (2n+1) H_n + 2n$$

Now define the integral

$$f_{i2}(n) = \int_0^n H_x^2 \, dx$$

We are interested in the difference

$$d_{f2}(n) = f_{s2}(n) - f_{i2}(n)$$

The task is to determine the asyptotic behaviour of this differences as $n\to \infty$.

While the asymptotics of $f_{s2}(n)$ is trivially deduced from that of $H_n$ the integral form seems to be tough (compare ).

• @ Jean Marie Merci. Corrected. – Dr. Wolfgang Hintze Oct 3 '17 at 16:59
• By the Euler-Maclaurin summation formula,$$d_{f2}(n)=C+\frac12H_n^2+\frac1{12}\psi^{(0)}(n)+\mathcal O(\psi^{(2)}(n))$$where $C$ is some constant... – Simply Beautiful Art Oct 3 '17 at 17:10
• @Simply Beautiful Art : What is the value of the constant C? – Dr. Wolfgang Hintze Oct 6 '17 at 11:22
• Some constant C that I haven't figured out. – Simply Beautiful Art Oct 6 '17 at 12:30
• @Simply Beautiful Art : May I kindly ask you to explain in more detail how you arrived at your interesting formula, and what the value of C could be, maybe as an answer? – Dr. Wolfgang Hintze Oct 6 '17 at 14:01

## Beware: work-in-progress.

Since $H_x=\psi(x+1)+\gamma$ and $\int_{0}^{n}\psi(x+1)\,dx=\log\Gamma(n+1)$, the given problem boils down to computing/approximating $\int_{0}^{n}\psi(x+1)^2\,dx$ (where the basic case $n=1$ is already non-trivial) then applying Stirling's approximation.

$$H_x = \sum_{a\geq 1}\frac{x}{a(a+x)}, \qquad \int_{0}^{n}H_x^2\,dx=\int_{0}^{n}\sum_{a,b\geq 1}\frac{x^2}{ab(a+x)(b+x)}\,dx$$ lead to: $$\begin{eqnarray*} \int_{0}^{n}H_x^2\,dx &=& \sum_{c\geq 1}\int_{0}^{n}\frac{x^2\,dx}{c^2(c+x)^2}+\sum_{\substack{a,b\geq 1\\ a\neq b}}\frac{1}{ab(a-b)}\int_{0}^{n}\left(\frac{ax}{a+x}-\frac{bx}{b+x}\right)\,dx\\&=&S_1(n)+2\sum_{a>b\geq 1}\frac{1}{ab(a-b)}\int_{0}^{n}\left(\frac{ax}{a+x}-\frac{bx}{b+x}\right)\,dx\\&=&S_1(n)+2\,S_2(n)\end{eqnarray*}$$ where: $$\begin{eqnarray*} S_1(n) &=& n\,\zeta(2)+H_n+2\sum_{a\geq 1}\frac{\log(a)-\log(a+n)}{a}\\ &=& n\,\zeta(2)+H_n+2\int_{0}^{+\infty}(1-e^{-nt})\log(1-e^{-t})\frac{dt}{t}\\&=&n\,\zeta(2)+H_n+2\color{blue}{\int_{0}^{1}\frac{(1-u^n)\log(1-u)}{u\log u}\,du} \end{eqnarray*}$$ and $$S_2(n) = \sum_{b\geq 1}\sum_{s\geq 1}\frac{1}{bs(b+s)}\int_{0}^{n}\frac{sx^2\,dx}{(b+x)(b+s+x)}\,dx.$$

It follows that the first terms of the wanted asymptotic expansion are not that difficult to find, but the constant term depends on not-so-common integrals like the blue one, which we already met when trying to find a closed form for $\int_{0}^{1}H_x^2\,dx$.