Take the 2-minute tour ×

I need to calculate a closed-form expression for $\sum_{j=0}^{k-1}(2j+2)\sum_{i=1}^j \frac 1 {i^2}$. This isn't particularly difficult, and I do it by hand pretty much routinely.

However I found out Mathematica's symbolic computation gives me an answer which is slightly different from the one I'd derived myself: I believe the problem arises when switching the indices of the sums, and I'm sure I'm doing it right, but of course I can't believe Mathematica would give a wrong answer (for such a trivial problem in any case).

I'm purposefully omitting giving either answers so as to not bias responses (which, hopefully, there will be, as this is driving me crazy).

Any comment or help appreciated, thanks!

EDIT: Thanks to all who answered. What I find, by hand, is that my sum (let's call it $S$) is such that $S=k^2H_{k-1}^{(2)}-k$, where $H_{j}^{(2)}=\sum_{i=1}^j 1/j^2$.

What Mathematica/Maple finds (when you've done the appropriate simplifications as suggested by Andrew) is $S=k^2H_{k}^{(2)}-k$. For instance, with Maple, I type:

assume(k,posint): additionally(k>0):

I believe I get this discrepancy when I'm switching the sum on $j$ and the sum on $i$, but I don't understand what I'm doing wrong.

share|improve this question

2 Answers 2

Maple's answer is $ \left( 1/6\,k+1/6\,{k}^{2} \right) {\pi }^{2}-\Psi \left( k \right) + \left( -k-{k}^{2} \right) \Psi \left( 1,k \right) -\gamma+1-k$.

share|improve this answer
Thanks for looking into it: I've edited for details. –  Jérémie Jul 10 '11 at 2:18

Mathematica 7.0.1 answer for

Sum[(2 j + 2)*Sum[1/i^2, {i, 1, j}], {j, 0, k - 1}]


-EulerGamma - k + k HarmonicNumber[k, 2] + k^2 HarmonicNumber[k, 2] - PolyGamma[0, 1 + k]

I have verified that this compact formula yields, for $k=1,2,3,4$, the results $0,4,23/2, 403/18$, just like the explicit summation.

share|improve this answer
Simplifying your answer FullSimplify[Sum[(2 j + 2)*Sum[1/i^2, {i, 1, j}], {j, 0, k - 1}],k > 0 && k [Element] Integers] gives $k \left((k+1) H_k^{(2)}-1\right)-H_k$. –  Andrew Jul 9 '11 at 15:04

Your Answer


