Closed form for $\int_{-\infty}^\infty\operatorname{sech}(x)\operatorname{sech}(a\, x)\ dx$

In what follows we obtain the exact formula $$f\left(\frac{c}{d}\right)=\int_{-\infty}^\infty \text{sech}(x)\text{sech}\left(\frac{c}{d} x\right)dx$$ $$= 2d\pi\left(\frac{1}{c}\sum_{k=1}^{c}\frac{\left(1-\frac{2k-1}{2c}\right)}{\sin\left((c+d)\frac{2k-1}{2c}\pi\right)}+\frac{1}{d}\sum_{k=1}^{d}\frac{\left(1-\frac{2k-1}{2d}\right)}{\sin\left((c+d)\frac{2k-1}{2d}\pi\right)}\right),$$ where $c/d$ is a rational number in lowest terms $>0$ not equal to $1$ with at least one of $c,d$ even. The method uses the Chebyshev polynomials. (If $c$,$d$ are both odd, the same method will work, however we have to change the term corresponding to the double pole at $0$.) This proves that for rational $a\neq 1$ the integral is always of the form $\pi\alpha$ where $\alpha$ is algebraic, and it allows us to easily evaluate $f\left(c/d\right)$ for many values of $c,d$, (values for which Wolfram Alpha fails to give anything) such as $$f\left(\frac{4}{5}\right)=\pi\left(1-\sqrt{5\left(26+5\sqrt{2}-8\sqrt{10+5\sqrt{2}}\right)}\right), $$ $$f\left(\frac{4}{7}\right)=\pi\left(2\sec\left(\frac{\pi}{7}\right)+2\csc\left(\frac{\pi}{8}\right)-\frac{7}{2}\sec\left(\frac{\pi}{8}\right)+2\csc\left(\frac{3\pi}{14}\right)-2\csc\left(\frac{\pi}{14}\right)-1\right),$$ $$f\left(\frac{5}{6}\right)=\pi\left(-\frac{6}{5}+\frac{24}{5}\sqrt{5}+2\sqrt{2}+4\sqrt{6}\right),$$ $$f(8)=\pi-\frac{\pi}{2}\sqrt{2\left(6-\sqrt{10+7\sqrt{2}}\right)}.$$ Moreover, the nature of this identity strongly suggests that there is no closed form for irrational $a$. It is interesting to note that the value is strongly tied to the roots of the Chebyshev polynomials, and the degree of the algebraic field in which $\alpha$ lives depends directly on $d$ and $c$.


Proof: Notice that $$\int_{-\infty}^{\infty}\frac{1}{e^{x}+e^{-x}}\frac{1}{e^{ax}+e^{-ax}}dx=\int_{-\infty}^{\infty}\frac{4}{e^{(a+1)x}+e^{-(a+1)x}+e^{(a-1)x}+e^{-(a-1)x}}dx$$ $$=\int_{-\infty}^{\infty}\frac{2}{\cosh((a+1)x)+\cosh((a-1)x)}dx. $$

Thus, if $a=\frac{c}{d}$ is a rational number greater than $0$ and not equal to $1$, then $f\left(\frac{c}{d}\right)$ equals $$\int_{-\infty}^{\infty}\frac{2}{\cosh\left(\frac{c+d}{d}x\right)+\cosh\left(\frac{c-d}{d}x\right)}dx=2d\int_{-\infty}^{\infty}\frac{1}{\cosh\left(\left(c+d\right)x\right)+\cosh\left(\left(d-c\right)x\right)}dx.$$ Let $T_{n}$ denote the $n^{th}$ Chebyshev polynomial of the first kind. Then $$f\left(\frac{c}{d}\right)=2d\int_{-\infty}^{\infty}\frac{1}{T_{c+d}\left(\cosh(x)\right)+T_{d-c}\left(\cosh(x)\right)}dx,$$ and so by the product formula for Chebyshev polynomials of the first kind, this is $$f\left(\frac{c}{d}\right)=d\int_{-\infty}^{\infty}\frac{1}{T_{d}\left(\cosh(x)\right)T_{c}\left(\cosh(x)\right)}dx.$$ Letting $\cosh(x)=u$, we have that $$f\left(\frac{c}{d}\right)=2d\int_{1}^{\infty}\frac{1}{T_{d}\left(x\right)T_{c}\left(x\right)}\frac{1}{\sqrt{x^{2}-1}}dx.$$

Now, since $$T_{n}(x)=2^{n-1}\prod_{k=1}^{n}\left(x-\cos\left(\frac{2k-1}{2n}\pi\right)\right),$$ when $c,d$ are relatively prime the polynomial $T_{c}(x)T_{d}(x)$ will have $d+c$ distinct roots as long as $c,d$ are not both odd, and all of these roots lie in the interval $[-1,1]$. Thus we may write $$\frac{1}{T_{c}(x)T_{d}(x)}=\sum_{i=1}^{d+c}\frac{\beta_{i}}{x-\alpha_{i}}$$ where $\beta_{i}=\text{Res}_{x=\alpha_{i}}\frac{1}{T_{c}(x)T_{d}(x)}$ is an algebraic number. Now, since $$\int_{1}^{\infty}\frac{1}{(x-\alpha_{i})\sqrt{x^{2}-1}}dx=\frac{\pi-\cos^{-1}(\alpha_{i})}{\sqrt{1-\alpha_{i}^{2}}}=\frac{\pi-\pi q_{i}}{\sqrt{1-\alpha_{i}^{2}}}$$ for $q_i$ satisfying $\alpha_i=\cos(\pi q_i)$, we see that $$f\left(\frac{c}{d}\right)=2d\sum_{i=1}^{d+c}\frac{\beta_{i}\pi\left(1-q_{i}\right)}{\sqrt{1-\cos^{2}\left(q_{i}\pi\right)}}=2d\sum_{i=1}^{d+c}\frac{\beta_{i}\pi\left(1-q_{i}\right)}{\sin\left(q_{i}\pi\right)}.$$ To find exact form for $\beta_{i}$ notice that $$\beta_{i}=\frac{1}{T'_{c}(\alpha_{i})T_{d}(\alpha_{i})+T_{c}(\alpha_{i})T_{d}'(\alpha_{i})}=\frac{1}{cU_{c-1}(\alpha_{i})T_{d}(\alpha_{i})+dT_{c}(\alpha_{i})U_{d-1}(\alpha_{i})}$$ where $U_{n}(x)$ is a Chebyshev Polynomial of the second kind. Since $U_{n-1}(\cos(\theta))=\frac{\sin(n\theta)}{\sin(\theta)}$, $T_{n}(\cos(\theta))=\cos(n\theta)$, we see that $$\beta_{i}=\frac{\sin(q_{i}\pi)}{c\sin(cq_{i}\pi)\cos(dq_{i}\pi)+d\cos(cq_{i}\pi)\sin(dq_{i}\pi)}.$$ Notice that when $q_{i}=\frac{2k-1}{2d}$, $\sin(cq_{i}\pi)\cos(dq_{i}\pi)=0$, and so we may change its coefficient from $c$ to $d$ and use the addition identity for $\sin$ to obtain $$\beta_{i}=\frac{\sin(q_{i}\pi)}{d\sin\left((c+d)\frac{2k-1}{2d}\pi\right)}.$$ Similarly when $q_{i}=\frac{2k-1}{2c}$ we see that $$\beta_{i}=\frac{\sin(q_{i}\pi)}{c\sin\left((c+d)\frac{2k-1}{2d}\pi\right)}.$$ Thus we obtain the final form $$f\left(\frac{c}{d}\right)=2d\pi\left(\frac{1}{c}\sum_{k=1}^{c}\frac{\left(1-\frac{2k-1}{2c}\right)}{\sin\left((c+d)\frac{2k-1}{2c}\pi\right)}+\frac{1}{d}\sum_{k=1}^{d}\frac{\left(1-\frac{2k-1}{2d}\right)}{\sin\left((c+d)\frac{2k-1}{2d}\pi\right)}\right),$$ as desired.


${\large\mbox{We just need to evaluate}\ {\rm f}\left(a\right)\ \mbox{when}\ a \in \left\lbrack 0, 1\right\rbrack}$ since $$ {\rm f}\left(-a\right) = {\rm f}\left(a\right) \quad\mbox{and}\quad {\rm f}\left(1 \over a\right) = \left\vert a\right\vert\,{\rm f}\left(a\right) $$

\begin{align} {\rm f}\left(1 \over a\right) &= \int_{-\infty}^\infty {\rm sech}\left(x\right)\,{\rm sech}\left(x \over a\right)\,{\rm d}x = a\int_{-\infty}^\infty {\rm sech}\left(a\,{x \over a}\right){\rm sech}\left(x \over a\right) \,{{\rm d}x \over a} \\[3mm]&= \left\vert a\right\vert\int_{-\infty}^\infty {\rm sech}\left(ax\right)\,{\rm sech}\left(x\right)\,{\rm d}x = \left\vert a\right\vert\,{\rm f}\left(a\right) \end{align}

For example \begin{align} {\rm f}\left(1 \over 2\right) &= 2\,{\rm f}\left(2\right) = 2\left(\sqrt{2\,} - 1\right)\pi \\[3mm] {\rm f}\left(4 \over 3\right) &= {3 \over 4}\,{\rm f}\left(3 \over 4\right) = \left(3\sqrt{2 +\sqrt{\vphantom{\large A}2\,}\,} - 5\right)\,\pi \\[3mm] {\rm f}\left(a\right) & = {1 \over \left\vert a\right\vert}\,{\rm f}\left(1 \over a\right) \approx {1 \over \left\vert a\right\vert}\,{\rm f}\left(0\right) = {\pi \over \left\vert a\right\vert}\,, \quad \left\vert a \right\vert \gg 1 \end{align}


You can have this form of solution

$$ \int_{-\infty}^\infty\operatorname{sech}(x)\operatorname{sech}(a\, x)\ dx =\frac{2}{a}\sum _{k=0}^{\infty } \left( -1 \right)^{k} \left( \psi \left( \,{\frac {3\,a+2\,k+1}{4a}} \right) -\psi \left( {\frac {2\,k+1+a} {4a}} \right) \right),$$

where $\psi(x)$ is the digamma function. Note that, $a=0$ is a special case.