Help with Complex integration

327 Views Asked by At

I have to calculate the following integral

$$\int_{-\infty}^{\infty} \frac{\cos(x)}{e^x+e^{-x}} dx$$

Anyone can give me an idea about what complex function or what path I should choose to calculate the integral?

4

There are 4 best solutions below

0
On

Hint: You should find the solutions of $$e^z+e^{-z}=0 ~~(*), $$ with $z=x+iy$. As

$$e^z+e^{-z}=(e^x+e^{-x})\cos y+i(e^{x}-e^{-x})\sin y, $$

$(*)$ gives

$$\cos y = \sin y = 0$$ or $$\cos y= 0 \cap x = 0. $$

In summary $e^z+e^{-z}=0 \Leftrightarrow x= 0,~ y= \frac{\pi}{2}+k\pi, $ with $k\in\mathbb Z$: the poles of the function $f(z)=\frac{\cos z}{e^z+e^{-z}}$ lie on the imaginary axis. Now you can use @DanielFischer comment.

0
On

By following the Daniel Fischer's suggestion, consider the integration path $\gamma=\partial D$ (with counter-clockwise orientation) where $D$ that is the rectangle with vertices in $R,R+i\pi,-R+i\pi,-R$. Since the zero set of $e^x+e^{-x}=2\cosh x$ is $\frac{\pi}{2}i+\pi i\mathbb{Z}$, by the residue theorem: $$\int_{\gamma}\frac{\cos z}{e^z+e^{-z}}dz = 2\pi i\cdot\operatorname{Res}\left(\frac{\cos z}{e^z+e^{-z}},z=\frac{\pi}{2}i\right)=\pi \cosh\frac{\pi}{2}.$$ Since $\cos(z+\pi i)=\cos(z)\cosh(\pi)-i\sin(z)\sinh(\pi)$ and $\cosh(z+\pi i)=-\cosh(z)$, the contribute given by integrating $\frac{\cos z}{e^z+e^{-z}}$ along the horizontal sides the rectangle equals: $$(1+\cosh\pi)\int_{-R}^{R}\frac{\cos z}{e^z+e^{-z}}dz,$$ because $\sin(z)$ is an odd function while $\cos(z)$ and $\cosh(z)$ are even functions.

When $|\Re z|=R$ we have: $$|\cos z|\leq\sqrt{\cosh^2(|\Im z|)+\sinh^2(|\Im z|)}\leq \cosh(\Im z)$$ $$|2\cosh z|\geq 2\sinh(|\Re z|),$$ hence the contribute given by the vertical sides of the rectangle is negligible when $R\to +\infty$, and: $$\int_{-\infty}^{+\infty}\frac{\cos z}{e^z+e^{-z}}\,dz = \frac{\pi}{2\cosh(\pi/2)}=\frac{\pi}{e^{\pi/2}+e^{-\pi/2}}.$$

2
On

You can use this way to do. Clearly \begin{eqnarray} I&=&\int_{-\infty}^{\infty} \frac{\cos(x)}{e^x+e^{-x}}dx=2\int_{0}^{\infty} \frac{\cos(x)}{e^x+e^{-x}}dx\\ &=&2\int_{0}^{\infty} \frac{e^{-x}\cos(x)}{1+e^{-2x}}dx=2\text{Re}\int_{0}^{\infty} \frac{e^{-x}e^{-ix}}{1+e^{-2x}}dx\\ &=&2\text{Re}\int_{0}^{\infty} \frac{e^{-(1+i)x}}{1+e^{-2x}}dx=2\text{Re}\int_{0}^{\infty} \sum_{n=0}^\infty e^{-(1+i)x}(-1)^ne^{-2nx}\\ &=&2\text{Re}\int_{0}^{\infty} \sum_{n=0}^\infty(-1)^n e^{-(2n+1+i)x}dx\\ &=&2\text{Re}\int_{0}^{\infty} \sum_{n=0}^\infty(-1)^n e^{-(2n+1+i)x}dx\\ &=&2\text{Re}\sum_{n=0}^\infty(-1)^n \frac{1}{2n+1+i}=2\sum_{n=0}^\infty(-1)^n \frac{2n+1}{(2n+1)^2+1}\\ &=&\sum_{n=0}^\infty(-1)^n \frac{2n+1}{2n^2+2n+1}=\frac{1}{2}\sum_{n=-\infty}^\infty(-1)^n \frac{2n+1}{2n^2+2n+1}\\ &=&\frac{\pi\sinh\frac{\pi}{2}}{\sinh\pi}=\frac{\pi}{2\cosh\frac{\pi}{2}}. \end{eqnarray} Here we used $$ \sum_{n=-\infty}^\infty(-1)^n f(n)=-\pi \sum_{k=1}^m\text{Res}(\frac{f(z)}{\sin(\pi z)},a_k) $$ where $a_1,a_2,\cdots,a_m$ are poles of $f(z)$.

0
On

$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ \begin{align}&\color{#c00000}{% \int_{-\infty}^{\infty}{\cos\pars{x} \over \expo{x} + \expo{-x}}\,\dd x} =\Re\ \overbrace{% \int_{-\infty}^{\infty}{\expo{\ic x} \over \expo{x} + \expo{-x}}\,\dd x} ^{\ds{\mbox{Set}\ \expo{x} \equiv t\ \imp\ x = \ln\pars{t}}}\ =\ \Re\int_{0}^{\infty}{t^{\ic} \over t + 1/t}\,{\dd t \over t} \\[3mm]&=\color{#00f}{\Re\int_{0}^{\infty}{t^{\ic} \over t^{2} + 1}\,\dd t} =\Re\bracks{2\pi\ic\,{\pars{\expo{\pi\ic/2}}^{\ic} \over 2\ic} +2\pi\ic\,{\pars{\expo{3\pi\ic/2}}^{\ic} \over -2\ic} -\int_{\infty}^{0}{t^{\ic}\pars{\expo{2\pi\ic}}^{\ic} \over t^{2} + 1}\,\dd t} \\[3mm]&=\pi\expo{-\pi/2} - \pi\expo{-3\pi/2} +\expo{-2\pi}\,\color{#00f}{\Re\int_{0}^{\infty}{t^{\ic} \over t^{2} + 1}\,\dd t} \end{align}

From here we can get an expression for $\ds{\color{#c00000}{% \int_{-\infty}^{\infty}{\cos\pars{x} \over \expo{x} + \expo{-x}}\,\dd x} =\color{#00f}{\Re\int_{0}^{\infty}{t^{\ic} \over t^{2} + 1}\,\dd t}}\,$: \begin{align}&\color{#66f}{\large% \int_{-\infty}^{\infty}{\cos\pars{x} \over \expo{x} + \expo{-x}}\,\dd x} ={\pi\expo{-\pi/2} - \pi\expo{-3\pi/2} \over 1 - \expo{-2\pi}} =\pi\,{\expo{\pi/2} - \expo{-\pi/2} \over \expo{\pi} - \expo{-\pi}} =\pi\,{\sinh\pars{\pi/2} \over \sinh\pars{\pi}} \\[3mm]&=\pi\,{\sinh\pars{\pi/2} \over 2\sinh\pars{\pi/2}\cosh\pars{\pi/2}} =\color{#66f}{\large\half\,\pi\,\sech\pars{\pi \over 2}} \approx {\tt 0.6260} \end{align}

We used the contour enter image description here

There are two simple poles at $\ds{i = \expo{\pi\ic/2}}$ and at $\ds{-i = \expo{3\pi\ic/2}}$ since the branch cut of $\ds{t^{\ic}}$ is given by: $$ t^{\ic} \equiv \exp\pars{\ic\ln\pars{\verts{t}} - {\rm Arg}\pars{t}}\,,\qquad t \not= 0\,,\quad 0 < {\rm Arg}\pars{t} < 2\pi $$