Let $H_n$ be the $n^{th}$ harmonic number,

$$ H_n = \sum_{i=1}^{n} \frac{1}{i} $$

Question: Calculate the following

$$\sum_{j=1}^{n} H_j^2.$$

I have attempted a generating function approach but could not solve this.


This is an interesting exercise in partial summation. For first, we have: $$\begin{eqnarray*}\sum_{j=1}^{n}H_j &=& n H_n-\sum_{j=1}^{n-1} \frac{j}{j+1} = n H_n - (n-1)+\sum_{j=1}^{n-1}\frac{1}{j+1}\\&=& n H_n-n+1+(H_n-1) = (n+1)\,H_n-n\tag{1}\end{eqnarray*} $$ hence: $$\begin{eqnarray*}\color{red}{\sum_{j=1}^n H_j^2} &=& \left((n+1)H_n^2-nH_n\right)-\sum_{j=1}^{n-1}\frac{(j+1)\,H_j-j}{j+1}\\&=&\left((n+1)H_n^2-nH_n\right)-\sum_{j=1}^{n-1}H_j+(n-1)-(H_n-1)\\&=&(n+1)\,H_n^2-nH_n-(n+1)\,H_n+n+H_n+(n-1)-H_n+1\\&=&\color{red}{(n+1)\,H_n^2-(2n+1)\,H_n+2n\phantom{\sum_{j=0}^{+\infty}}}.\tag{2}\end{eqnarray*}$$ Notice the deep analogy with: $$\int \log^2 x\,dx = x\log^2 x -2x\log x +2x.$$

  • 3
    $\begingroup$ This a really beautiful solution ! Thanks for providing it :) $\endgroup$ – Claude Leibovici Sep 16 '14 at 16:32
  • $\begingroup$ Very nice solution. I would lile to know the relationship between harmonic numbers and logarithm. Could you please explain it? $\endgroup$ – Bumblebee Jul 23 '16 at 2:02
  • 3
    $\begingroup$ @NilMal: the first terms of the asymptotic for $H_n$ are $\log(n)+\gamma$, and we may compute our sum by partial summation, as well as we may compute $\int_{1}^{n}\log^2(x)\,dx $ through integration by parts. That is the tight analogy. $\endgroup$ – Jack D'Aurizio Jul 23 '16 at 13:31
  • 1
    $\begingroup$ A classic solutiont! (+1). Interesting to note that it was referenced in two of the solutions to the question here which was posted today, exactly three years after your solution! :) $\endgroup$ – hypergeometric Sep 16 '17 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.