I am trying to find a closed-form expression for the finite sum

$$\sum^N_{n=1}\frac{1}{n^2}$$ when $n$ is even and when $n$ is odd. I know that for $N\to\infty$ these series converge towards $\frac{\pi^2}{24}$ and $\frac{\pi^2}{8}$ respectively. I wish to find the functions $f$ and $g$ such that



such that $$\lim_{N\to\infty}f(N)=\lim_{N\to\infty}g(N)=0.$$

I remember some time ago I bumped into these expressions (in some book I think...), $f$ and $g$ were complicated functions involving some ugly integral. Someone?

  • 1
    $\begingroup$ can anyone point me to an article where i can read about what 'closed expression' means? $\endgroup$
    – Bhargav
    Nov 28, 2012 at 12:37
  • $\begingroup$ @b555 I edited.. better? $\endgroup$
    – Dar Far
    Nov 28, 2012 at 12:55

1 Answer 1


Yeah, the "ugly integral" involves something called the digamma function.

The gamma function is given by $$\Gamma(x)=\int_0^{\infty} e^{-t}t^{x-1}dt,$$ and the digamma function is given by $$\Psi(x) = \frac{d}{dx}\ln\bigl(\Gamma(x)\bigr).$$

A closed formula for the sum (for all $n\leq N$) is $$\sum_{n=1}^N \frac{1}{n^2}=\frac{1}{6}\pi^2-\left(\frac{d}{dx}\Psi(x)\right)\bigg|_{x=N+1}.$$

To get your expression for the sum of only even $n$, note that $$\sum_{n=2}^{2N}\frac{1}{n^2}=\sum_{n=1}^{N}\frac{1}{(2n)^2}=\frac{1}{4}\left(\sum_{n=1}^N\frac{1}{n^2}\right),$$ so $$\sum_{\substack{n=2\\ n \text{ even}}}^N \frac{1}{n^2}=\frac{\pi^2}{24}-f(N),$$ where $$f(N)=\frac{1}{4}\left(\frac{d}{dx}\Psi(x)\right)\bigg|_{x=\left\lfloor\frac{N}{2}\right\rfloor+1}$$

For the odds, you can take the difference of these two formulas,

\begin{align} \sum_{\substack{n=1\\ n \text{ odd}}}^N\frac{1}{n^2}&=\left(\sum_{n=1}^N \frac{1}{n^2}\right)-\left(\sum_{\substack{n=2\\ n \text{ even}}}^N \frac{1}{n^2}\right)\\ &=\left(\frac{1}{6}\pi^2-\left(\frac{d}{dx}\Psi(x)\right)\bigg|_{x=N+1}\right)-\left(\frac{\pi^2}{24}-\frac{1}{4}\left(\frac{d}{dx}\Psi(x)\right)\bigg|_{x=\left\lfloor\frac{N}{2}\right\rfloor+1}\right)\\ &=\frac{\pi^2}{8}-g(N), \end{align} where $$g(N)=\left(\frac{d}{dx}\Psi(x)\right)\bigg|_{N+1}-f(N).$$

  • $\begingroup$ Hmm... I just realized that this was for ALL $1\leq n\leq N$, rather than for the even/odd you asked for. $\endgroup$
    – Gwyn W
    Nov 28, 2012 at 13:17

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.