Show that $\sum^\infty_{k=0} \frac{2(-1)^k}{(2k+1)\pi\cosh[(2k+1)\pi/2]}=1/4$

I am busy as hell today but this is such a nice problem (and amusingly posed question) i can't resist... :)

The key idea here is simple: Look for a function in the complex plane $f(z)$ which has poles at the correct values $z_n$ and integrate it over an appropriate contour $C$.

It turns out that the function (which is also the simplest guess i can imagine)

$$ f(z)=\frac{1}{z \cos(z)\cosh(z)} $$

is the correct choice. Its poles are given by $z_0=0$, $z_k=\frac{(2 k-1)\pi}{2} $ and $\tilde{z}_k=i \frac{(2 k-1)\pi}{2} $ with $k \in \mathbb{Z/0}$. We furthermore have

$$ \text{res}(z_0)=1 \\ \text{res}(z_k)=\text{res}(\tilde{z}_k)=\frac{2}{\pi}\frac{(-1)^{k}}{(2k-1)\cosh\left(\pi\frac{2k-1}{2}\right)}\\ \text{res}(z_{-k})=\text{res}(z_k) $$

since $z\cos(z)\cosh(z)\sim |z| e^{a |z|}$ with $\Re(a)>0$ as $|z|\rightarrow\infty$ we can choose a big circle traversed anticlockwise with radius choosen such that we hit no pole of $f(z)$ as the integration contour $C$ (Thanks to @Dr. MV for rigorizing this point).

Then, we get by applying the residue theorem, we get in the limit of infinte radius

$$ \oint_Cf(z)dz=2\pi i\text{res}(z_0)+4\pi i \sum_{k\geq1}\text{res}(z_k)+4\pi i\sum_{k\geq1}\text{res}(\tilde{z}_k)=0 $$

or

$$ 8\pi i \sum_{k\geq1}\text{res}(z_k)=-2\pi i $$

which can be rewritten as (after shifting $k\rightarrow k+1$)

$$ \sum_{k\geq0}\frac{2}{\pi}\frac{(-1)^{k}}{(2k+1)\cosh\left(\pi\frac{2k+1}{2}\right)}=\frac{1}{4}\\ \textbf{Q.E.D.} $$


To make things clearer, here is a sketch of the integration contour $\color{blue}{C}$ and the singularities $\color{red}{z_n}$

enter image description here



As mentioned by Zucker in The summation of series of hyperbolic functions, in Question 358, J. Indian Math. Soc., 4 (1912), p. 78. Ramanujan proves (through the residue theorem) that $$ \sum_{n\geq 1}(-1)^{n+1}(2n-1)^{4m-1}\,\text{sech}\left[(2n-1)\frac{\pi}{2}\right] = 0 $$ holds for every $m\geq 0$. Your identity then follows from the $m=0$ case.

It is truly remarkable to know that such identity can be proved through Dirichlet's problem about the eigenvalues of the Laplacian operator. Can you be more specific about the relation between such a series and the physical problem?$^{(0)}$ A brilliant piece of math might arise from there.

$^{(0)}$Update: I found the connection - such series are related with the Green function of a square.


I will show an interesting technique for deriving a similar identity.

From the Weierstrass product $$ \cosh(\pi x/2) = \prod_{m\geq 0}\left(1+\frac{z^2}{(2m+1)^2}\right)\tag{1} $$ by applying $\frac{d^2}{dz^2}\log(\cdot)$ to both sides we get: $$ \frac{\pi^2}{8\cosh^2(\pi x/2)}=\sum_{m\geq 0}\frac{(2m+1)^2-z^2}{((2m+1)^2+z^2)}\tag{2} $$ If we replace $z$ with $(2n+1)$ and sum over $n\geq 0$, $$ \sum_{n\geq 0}\frac{\pi^2}{8\cosh^2(\pi(2n+1)/2)} = \sum_{n\geq 0}\sum_{m\geq 0}\frac{(2m+1)^2-(2n+1)^2}{((2m+1)^2+(2n+1)^2)^2} \tag{3}$$ where the RHS of $(3)$ can also be written as $$ \sum_{n\geq 0}\sum_{m\geq 0}\int_{0}^{+\infty}\cos((2n+1)x)x e^{-(2m+1)x}\,dx = \sum_{n\geq 0}\int_{0}^{+\infty}\frac{x\cos((2n+1)x)}{2\sinh(x)}\,dx\tag{4}$$ or, by exploiting integration by parts, $$ \sum_{n\geq 0}\int_{0}^{+\infty}\frac{x\cosh(x)-\sinh(x)}{2\sinh(x)}\cdot\frac{\sin((2n+1)x)}{2n+1}\,dx\tag{5}$$ On the other hand, $\sum_{n\geq 0}\frac{\sin((2n+1)x)}{2n+1}$ is the Fourier series of a $2\pi$-periodic rectangle wave that equals $\frac{\pi}{4}$ over $(0,\pi)$ and $-\frac{\pi}{4}$ over $(\pi,2\pi)$. That implies, by massive cancellation: $$ \sum_{n\geq 0}\frac{1}{\cosh^2(\pi(2n+1)/2)}=\frac{1}{2\pi}.\tag{6} $$ On the other hand, the Fourier transform of $\frac{1}{\cosh^2(\pi x)}$ is given by by $\frac{s\sqrt{8\pi}}{\sinh(\pi s)}$.
By Poisson's summation formula, $$ \sum_{n\geq 1}\frac{(-1)^{n+1}n}{\sinh(\pi n)}=\frac{1}{4\pi}.\tag{7}$$