## An unusually alternating sum

Problem: evaluate the following sum…

$$\sum_{k=0}^{\infty}\dfrac{(-1)^{\frac{k(k+1)}{2}}}{(2k+1)^2}$$

This is unusual because the $-1$ is raised to the $k (k+1)/2$ power, rather than the usual $k$th power. On the surface, this problem may look hopeless, but really, it is all about determining the pattern of odd and even numbers from the sequence $k (k+1)/2$, which turns out to be not complicated at all.

The pattern of the signs of the sum are

$$a_0-a_1-a_2+a_3+a_4-a_5-a_6+a_7+a_8-\cdots$$

so that each term of the form $8 k+3$ and $8 k+5$ is negative, and $8 k+1$ and $8 k+7$ is positive. Thus we may write the sum as

$$\sum_{k=0}^{\infty} \left [\frac1{(8 k+1)^2} – \frac1{(8 k+3)^2} – \frac1{(8 k+5)^2}+\frac1{(8 k+7)^2} \right ]$$

Note that this sum is symmetric in sign about $k$; thus we may write the sum as

$$\frac12 \sum_{k=-\infty}^{\infty} \left [\frac1{(8 k+1)^2} – \frac1{(8 k+3)^2} – \frac1{(8 k+5)^2}+\frac1{(8 k+7)^2} \right ]$$

We may thus evaluate this sum using the residue theorem. Omitting details, we use the result

$$\sum_{k=-\infty}^{\infty} f(k) = -\sum_n \operatorname*{Res}_{z=z_n} \pi \, \cot{(\pi z)} \, f(z)$$

where

$$f(z) = \frac12 \left [\frac1{(8 z+1)^2} – \frac1{(8 z+3)^2} – \frac1{(8 z+5)^2}+\frac1{(8 z+7)^2} \right ]$$

$f$ has (double) poles at $z_1=-1/8$, $z_2=-3/8$, $z_3=-5/8$, and $z_4=-7/8$. Thus, for instance,

\begin{align}\operatorname*{Res}_{z=-1/8} \pi \, \cot{(\pi z)} \, f(z) &= \frac12\pi \frac1{8^2}\left [\frac{d}{dz} \left ( \left [1- \frac{(8 z+1)^2}{(8 z+3)^2} – \frac{(8 z+1)^2}{(8 z+5)^2}+\frac{(8 z+1)^2}{(8 z+7)^2} \right ] \cot{(\pi z)} \right ) \right ]_{z=-1/8} \\ &= -\frac1{128} \pi^2 \csc^2{\frac{\pi}{8}}\end{align}

The factor of $1/8^2$ comes from the fact that the residue calculation has us multiply $f$ by $(z+1/8)^2$. Similarly,

$$\operatorname*{Res}_{z=-3/8} \pi \, \cot{(\pi z)} \, f(z) = \frac1{128} \pi^2 \csc^2{\frac{3 \pi}{8}}$$
$$\operatorname*{Res}_{z=-5/8} \pi \, \cot{(\pi z)} \, f(z) = \frac1{128} \pi^2 \csc^2{\frac{5 \pi}{8}}$$
$$\operatorname*{Res}_{z=-7/8} \pi \, \cot{(\pi z)} \, f(z) = -\frac1{128} \pi^2 \csc^2{\frac{7 \pi}{8}}$$

Using

$$\sin^2{\frac{\pi}{8}} = \sin^2{\frac{7\pi}{8}} = \frac{2-\sqrt{2}}{4} = \frac{1/2}{2+\sqrt{2}}$$
$$\sin^2{\frac{3\pi}{8}} = \sin^2{\frac{5\pi}{8}} = \frac{2+\sqrt{2}}{4} = \frac{1/2}{2-\sqrt{2}}$$

Then the sum is finally

$$\frac{\pi^2}{128} 2 \left (\frac{2+\sqrt{2}}{1/2} – \frac{2-\sqrt{2}}{1/2} \right ) = \frac{\sqrt{2} \pi^2}{16}$$