Evaluate the integral $\displaystyle\int\limits_{-\infty}^\infty \frac{\cos(x)}{x^2+1} dx$.
Hint: $\cos(x) = \Re(\exp(ix))$
Hi, I am confused that if I need to use the Residue Theorem in order to solve this, and I am not sure where I should start.
Evaluate the integral $\displaystyle\int\limits_{-\infty}^\infty \frac{\cos(x)}{x^2+1} dx$.
Hint: $\cos(x) = \Re(\exp(ix))$
Hi, I am confused that if I need to use the Residue Theorem in order to solve this, and I am not sure where I should start.
METHODOLOGY $1$: Complex Analysis
Note that the function $\frac{e^{iz}}{z^2+1}$ has poles at $\pm i$. Then, by Cauchy's Integral Formula we have for $R>1$
$$\begin{align} \oint_{C_R}\frac{e^{iz}}{z^2+1}\,dz&=\int_{-R}^R \frac{e^{ix}}{x^2+1}\,dx+\int_0^\pi \frac{e^{iRe^{i\phi}}}{(Re^{i\phi})^1+1}\,iRe^{i\phi}\,d\phi\tag1\\\\ &=2\pi i \frac{e^{i(i)}}{2i}\\\\ &=\pi/e \end{align}$$
As $R\to \infty$, the second integral on the right-hand side of $(1)$ approaches $0$. Therefore, we find that
$$\int_{-\infty}^\infty \frac{e^{ix}}{x^2+1}\,dx=\frac{\pi}{e} \tag2$$
Taking the real part of both sides of $(2)$ and exploiting the even symmetry yields
$$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty \frac{\cos(x)}{x^2+1}\,dx=\frac{\pi}{2e}}$$
METHODOLOGY $2$: Real Analysis
Let $f(a)$ be given by the convergent improper integral
$$f(a)=\int_0^\infty \frac{\cos(ax)}{x^2+1}\,dx \tag3$$
Since the integral $\int_0^\infty \frac{x\sin(ax)}{x^2+1}\,dx$ is uniformly convergent for $|a|\ge \delta>0$, we may differentiate under the integral in $(3)$ for $|a|>\delta>0$ to obtain
$$\begin{align} f'(a)&=-\int_0^\infty \frac{x\sin(ax)}{x^2+1}\,dx\\\\ &=-\int_0^\infty \frac{(x^2+1-1)\sin(ax)}{x(x^2+1)}\,dx\\\\ &=-\int_0^\infty \frac{\sin(ax)}{x}\,dx+\int_0^\infty \frac{\sin(ax)}{x(x^2+1)}\,dx\\\\ &=-\frac{\pi}{2}+\int_0^\infty \frac{\sin(ax)}{x(x^2+1)}\,dx\tag4 \end{align}$$
Again, since the integral $\int_0^\infty \frac{\cos(ax)}{x^2+1}\,dx$ converges uniformly for all $a$, we may differentiate under the integral in $(4)$ to obtain
$$f''(a)=\int_0^\infty \frac{\cos(ax)}{x^2+1}\,dx=f(a)\tag 5$$
Solving the second-order ODE in $(5)$ reveals
$$f(a)=C_1 e^{a}+C_2 e^{-a}$$
Using $f(0)=\pi/2$ and $f'(0)=-\pi/2$, we find that $C_1=0$ and $C_2=\frac{\pi}{2}$ and hence $f(a)=\frac{\pi e^{-a}}{2}$. Setting $a=1$ yields the coveted result
$$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty \frac{\cos(x)}{x^2+1}\,dx=\frac{\pi}{2e}}$$
as expected!
Use the Fourier transform: $$\frac{2}{\pi}\int_{-\infty}^{\infty}\frac{e^{i\nu x}}{x^{2}+1}dx=e^{-\left|\nu\right|}$$
Just set $\nu=1$, divide by $\frac{2}{\pi}$, and take the real part of both sides.
We may also see that $$I=\int_{-\infty}^{\infty}\frac{\cos\left(x\right)}{1+x^{2}}dx=2\int_{0}^{\infty}\frac{\cos\left(x\right)}{1+x^{2}}dx$$ $$ =\int_{0}^{\infty}\frac{e^{ix}+e^{-ix}}{1+x^{2}}dx=\frac{e^{-1}}{2}\left(\int_{0}^{\infty}\frac{e^{1+ix}+e^{1-ix}}{1+ix}dx+\int_{0}^{\infty}\frac{e^{1+ix}+e^{1-ix}}{1-ix}dx\right)$$ $$ =\frac{e^{-1}}{2i}\left(\int_{0}^{\infty}\frac{1}{x}\left(\frac{ixe^{1+ix}}{1+ix}+\frac{ixe^{1-ix}}{1-ix}\right)dx+\int_{0}^{\infty}\frac{1}{x}\left(\frac{ixe^{1-ix}}{1+ix}+\frac{ixe^{1+ix}}{1-ix}\right)dx\right)$$ and now applying the complex version of Frullani's theorem to the functions $$f\left(x\right)=\frac{xe^{1-x}}{1-x},\,g\left(x\right)=\frac{xe^{1-x}}{1+x}$$ we get $$I=\frac{e^{-1}}{i}\log\left(-1\right)=\color{red}{\pi e^{-1}}.$$
Another approach: A combination of Feynman's Trick and Laplace Transforms:
\begin{equation} J = \int_{-\infty}^{\infty}\frac{\cos(x)}{x^2 + 1}\:dx \end{equation}
Here let:
\begin{equation} I(t) = \int_{-\infty}^{\infty}\frac{\cos(xt)}{x^2 + 1}\:dx \end{equation}
We see $I(1) = J$ and $I(0) = \pi$. Here we take the Laplace Transform w.r.t. '$t$':
\begin{align} \mathscr{L}\left[I(t)\right] &= \int_{-\infty}^{\infty}\frac{\mathscr{L}\left[\cos(xt)\right]}{x^2 + 1}\:dx = \int_{-\infty}^{\infty} \frac{s}{s^2 + x^2}\cdot\frac{1}{x^2 + 1}\:dx \\ &=\frac{s}{s^2 - 1}\int_{-\infty}^{\infty}\left[\frac{1}{x^2 + 1} - \frac{1}{x^2 + s^2} \right]\:dx \\ &= \frac{s}{s^2 - 1} \left[ \arctan(x) - \frac{1}{s}\arctan\left(\frac{x}{s} \right)\right]_{-\infty}^{\infty} \\ &= \frac{s}{s^2 - 1} \left[ \left(\frac{\pi}{2} - \frac{1}{s}\cdot \frac{\pi}{2} \right) - \left(-\frac{\pi}{2} - \frac{1}{s}\cdot -\frac{\pi}{2} \right) \right] \\ &= \frac{s}{s^2 - 1} \left[ \pi - \pi\frac{1}{s} \right] = \frac{s}{s^2 - 1} \cdot \frac{s - 1}{s}\pi = \frac{\pi}{s + 1} \end{align}
We now take the inverse Laplace Transform:
\begin{align} I(t) = \mathscr{L}^{-1}\left[ \frac{\pi}{s + 1}\right] = \pi e^{-t} \end{align}
And finally:
\begin{equation} J = I(1) = \pi e^{-1} = \frac{\pi}{e} \end{equation}
Now this is essentially residue analysis, but I've found it to be a useful technique for integrals of this type.