TITLE: Infinite summation : $\displaystyle S= \sum_{r=0}^{\infty} \frac{\cos (2xr)}{4r^2 - 1}$
QUESTION [7 upvotes]: So I ran into this problem on Quora:

$$\displaystyle S = \sum_{r=0}^{\infty} \frac{\cos (2xr)}{4r^2 - 1}$$

Initially I thought it cannot be resolved as telescoping method failed. But I tried something else.
MY ATTEMPT:
Let $\displaystyle S = \mathbb{R} \left [ \sum_{r=0}^{\infty} \frac {e^{-\iota 2rx}}{4r^2 -1} \right ] \equiv \mathbb{R} [J], \ $ where$ \ \mathbb{R} \ $ shows real part.
So let us find $J.$
Now, $\displaystyle J(x) = \sum_{r=0}^{\infty} \frac {e^{-\iota 2rx}}{4r^2 -1} \implies J'(x) = \sum_{r=0}^{\infty} \frac {-\iota  (2r)e^{-\iota 2rx}}{4r^2 -1} \ $ and hence
$\displaystyle J''(x) = -\sum_{r=0}^{\infty} \frac {(4r^2)e^{-\iota 2rx}}{4r^2 -1}.$
Therefore some maipulations and we get:
$$\displaystyle J'' + J =  - \sum_{r=0}^{\infty} e^{-\iota 2rx} \implies J'' + J =  \iota \sin(x) e^{-\iota x}.$$
We can solve this by variation of parameters:
Initial soltuions of the equation $\ \displaystyle J'' + J = 0 \ $ are $\displaystyle e^{\iota x} , e^{-\iota x} $. And let $\ \displaystyle J= C_0 e^{\iota x} \phi_1 + C_1 e^{-\iota x} \phi_2 \ $ satisfy $ \ \displaystyle J'' + J =  \iota \sin(x) e^{-\iota x}. \ $
Therefrore,
$$\displaystyle 
e^{\iota x} \phi_1' +  e^{-\iota x} \phi_2' = 0 \\
e^{\iota x} \phi_1' -  e^{-\iota x} \phi_2' = \sin(x) e^{-\iota x} 
$$
Solving for $ \ \displaystyle \phi_1 , \phi_2\ $ we get:

$$\displaystyle J = C_0 e^{\iota x}\left ( \frac{1}{6} \cos (x) + \frac{1}{3} \sin ^2(x)  e^{\iota x} \right ) + \frac{C_1}{2} e^{-\iota x} \cos (x)$$


But the issue is $ \ \displaystyle  C_0 , C_1 .\ $ I was only able to find that $ \ \displaystyle  C_0 + 3C_1 = 3 ,\ $ using the condition :$\displaystyle J(x=0) = J(x=\pi) = J(x=-\pi) = \frac{1}{2} = \frac{C_0}{6} + \frac{C_1}{2}$
I was only able to conclude:

$$\displaystyle  S = \mathbb{R} \left[ C_0 e^{\iota x}\left ( \frac{1}{6} \cos (x) + \frac{1}{3} \sin ^2(x)  e^{\iota x} \right ) + \frac{C_1}{2} e^{-\iota x} \cos (x) \right] \\ \text{where} \ C_0 + 3C_1 = 3 $$


I want anyone guide me further. Or suggest some another method to solve this.

REPLY [3 votes]: Below is presented one of the way - how the problem can be solved via the complex integration. This solution I also posted on Quora.
Let's consider
$\displaystyle S_0=\sum_{r=1}^\infty\frac{\cos 2rx}{4r^2-1}=\frac{1}{2}\Big(\Re\sum_{r=-\infty}^\infty\frac{e^{2irx}}{4r^2-1}+1\Big)=\frac{1}{2}(\Re S+1)\tag*{}$
To evaluate $S=\sum_{r=-\infty}^\infty\frac{e^{2irx}}{4r^2-1}$ we introduce the function $g(z)=\frac{2\pi i}{e^{2\pi iz}-1}$, which has the residues $\operatorname{Res}g(z)=1$ at the points $s=0,\pm1,\pm2 ...$
Let's consider
$\displaystyle I=\oint \frac{2\pi i}{e^{2\pi iz}-1}\frac{e^{2izx}}{4z^2-1}dz\tag*{}$
where we impose the condition $x\in[0;\pi]$, and the integration is along a contour that encloses the axis $X$ (red contour on the picture below). It also encloses all the poles of the function (because they lie on the axis $X$).

Then we can deform the contour - making a circle of radius $R\to\infty$.
Due to the requirement $x\in[0;\pi]\,\,\, |\frac{1}{e^{2\pi iz}-1}\frac{e^{2izx}}{4z^2-1}|<|\frac{1}{4z^2-1}|\sim \frac{1}{R^2}$ at $R\to\infty$, and, therefore, $I\to0$ at $R\to\infty$.
It means that
$\displaystyle I=\oint=\sum\operatorname{Res}\frac{2\pi i}{e^{2\pi iz}-1}\frac{e^{2izx}}{4z^2-1}=0\tag*{}$
On the other hand,
$\displaystyle \sum\operatorname{Res}\frac{2\pi i}{e^{2\pi iz}-1}\frac{e^{2izx}}{4z^2-1}=\sum\operatorname{Res}_{z=\pm1/2}\frac{2\pi i}{e^{2\pi iz}-1}\frac{e^{2izx}}{4z^2-1}+S\tag*{}$
Therefore,
$\displaystyle S=-\operatorname{Res}_{z=\pm1/2}\frac{2\pi i}{e^{2\pi iz}-1}\frac{e^{2izx}}{4z^2-1}\tag*{}$
The residues evaluation is straightforward:
$\displaystyle S=-2\pi i\Big(\frac{e^{ix}}{4(e^{\pi i}-1)}+\frac{e^{-ix}}{(-4)(e^{-\pi i}-1)}\Big)=-\frac{\pi}{2}\sin x\tag*{}$
and the sum $S_0$
$\displaystyle S_0=\frac{1}{2}(\Re S+1)=\frac{1}{2}(1-\frac{\pi}{2}\sin x); \,\,x\in[0;\pi]\tag*{}$
Then $$\sum_{r=0}^\infty\frac{\cos 2rx}{4r^2-1}=S_0-1=-\frac{1}{2}(1+\frac{\pi}{2}\sin x); \,\,x\in[0;\pi]$$
We can rewrite the answer for $x\in[-\pi;\pi]$ as
$\displaystyle \boxed{\,\,\sum_{r=0}^\infty\frac{\cos 2rx}{4r^2-1}=-\frac{1}{2}\big(1+\frac{\pi}{2}|\sin x|\big); \,\,x\in[-\pi;\pi]\,\,}\tag*{}$