33

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.

Cecil
  • 331
  • Given your interest in the harmonic numbers you may find this interesting about the Stirling numbers, which are related to the logarithm: http://functions.wolfram.com/IntegerFunctions/StirlingS1/03/ShowAll.html – pshmath0 Sep 16 '14 at 14:52

3 Answers3

63

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.$$

Jack D'Aurizio
  • 353,855
  • 3
    This a really beautiful solution ! Thanks for providing it :) – Claude Leibovici Sep 16 '14 at 16:32
  • Very nice solution. I would lile to know the relationship between harmonic numbers and logarithm. Could you please explain it? – Bumblebee Jul 23 '16 at 02:02
  • 6
    @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. – Jack D'Aurizio Jul 23 '16 at 13:31
  • 1
    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! :) – Hypergeometricx Sep 16 '17 at 17:28
3

$$\sum_{k =1}^xH_k^2 = (x+1)H_x^2 - (2x+1)H_x + 2x$$ Before we prove the above solution consider this following $$\begin{align*} \color{blue}{\sum_{k =1}^{x}H_k} &=\sum_{k =1}^{x}\sum_{n =1}^{k}\frac 1{n}=\sum_{k =1}^{x}\frac 1{n}\sum_{k =n}^{x}1 = \sum_{k =1}^{x}\frac 1{n}(x-n+1)\\ &=\sum_{k =1}^{x}\frac {(x+1)-n}{n} =(x+1)\sum_{k =1}^{x}\frac 1{n} - \sum_{k =1}^{x}1 = \color{blue}{(x+1)H_x - x = \sum_{k =1}^{x}H_k} \end{align*}$$ Consider, $$\sum_{k =1}^xa_kb_k = s_xb_x- \sum_{k = 1}^{x-1}s_k(b_{k+1}-b_k)\text{ Where } s_u =\sum_{k =1}^ua_k$$ Put: $a_k = b_k = H_k$

$$\begin{align*} \color{blue}{\sum_{k =1}^xH^2_k} & = s_xH_k- \sum_{k =1}^{x-1}s_k(H_{k+1}- H_k)\\ & =((x+1)H_x-x)H_k -\sum_{k =1}^{x-1}[(k+1)H_k - k](\frac 1{k+1})\\ & = (x+1)H^2_x - xH_x - \sum_{k =1}^{x-1}H_k + \sum_{k =1}^{x-1}\left(1-\frac {1}{k+1}\right)\\ & = (x+1)H^2_x-xH_x -xH_{x-1} + 2x - 2- \sum_{k =2}^{x}\frac 1{k}\\ & = \color{blue}{(x+1)H^2_x-(2x+1)H_x +2x} \end{align*}$$

image

Darshan P.
  • 1,181
0

Let's do this using interchanges of the order of summation:

$$\begin{align} \sum_{n=1}^NH_n^2 &=\sum_{n=1}^N\sum_{h,k=1}^n{1\over hk}\\ &=\sum_{h,k=1}^N\sum_{n=\max(h,k)}^N{1\over hk}\\ &=\sum_{h,k=1}^N{N+1-\max(h,k)\over hk}\\ &=(N+1)H_N^2-\sum_{h,k=1}^N{\max(h,k)\over hk}\\ &=(N+1)H_N^2-\sum_{m=1}^N{m\over m^2}-2\sum_{m=2}^N\sum_{k=1}^{m-1}{m\over mk}\\ &=(N+1)H_N^2-H_N-2\sum_{k=1}^{N-1}\sum_{m=k+1}^N{1\over k}\\ &=(N+1)H_N^2-H_N-2\sum_{k=1}^{N-1}{N-k\over k}\\ &=(N+1)H_N^2-H_N-2NH_{N-1}+2(N-1)\\ &=(N+1)H_N^2-H_N-2N(H_N-1/N)+2(N-1)\\ &=(N+1)H_N^2-(2N+1)H_N+2N \end{align}$$

Barry Cipra
  • 79,832