Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
can anyone point me to an article where i can read about what 'closed expression' means? – Bhargav Nov 28 '12 at 12:37
@b555 I edited.. better? – Dar Far Nov 28 '12 at 12:55
up vote 8 down vote accepted

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

share|cite|improve this answer
Hmm... I just realized that this was for ALL $1\leq n\leq N$, rather than for the even/odd you asked for. – Gwyn W Nov 28 '12 at 13:17
Thanks! This is exactly what I needed! – Dar Far Nov 28 '12 at 18:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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