# Closed-form expressions for $\sum^N_{n}\frac{1}{n^2}$ ($n$, even or odd)

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

$$\sum^N_{k=1}\frac{1}{(2k)^2}=\frac{\pi^2}{24}-f(N)$$

$$\sum^N_{k=1}\frac{1}{(2k-1)^2}=\frac{\pi^2}{8}-g(N)$$

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?

-
can anyone point me to an article where i can read about what 'closed expression' means? –  Bhargav Nov 28 '12 at 12:37
if you tell me the answer to my question I'll show you the article :)... –  Dario Alexander Nov 28 '12 at 12:39
@b555 I edited.. better? –  Dario Alexander Nov 28 '12 at 12:55

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

-
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! –  Dario Alexander Nov 28 '12 at 18:55