# Evaluating the integral $\int_{0}^{\infty} \frac{\cos ax}{1+x^2}dx$ [duplicate]

I encountered this problem while calculating the Fourier Cosine Integral for the function $f(x) = \frac{1}{1+x^2}$. I know that $\int \frac{1}{1+x^2} = \arctan x + c$. I just can't figure out what to do with $cosax$ term combined. If I do integration by parts, I get: $$\left [ \cos ax \times \tan^{-1}x \right ]_{0}^{\infty} +\int_{0}^{\infty}a \sin ax \times \tan^{-1}xdx$$ I don't know how to proceed after that. Perhaps a hint could help.

## marked as duplicate by Guy Fsone, Jack, Zubzub, Michael Seifert, user296602 Oct 24 '17 at 19:16

• the $a\sin(ax)$ should be "inside" the integral, multiplied with the $\tan^{-1}(x)$. – Zachary Oct 24 '17 at 12:51
• This is quite easy using a contour integral - do you know enough complex analysis to do these? – Joppy Oct 24 '17 at 12:59
• @Messney Sorry my bad! Thanks for pointing out. – bikalpa Oct 24 '17 at 13:01
• @Joppy I am quite new to complex analysis, but I do know the basics of Cauchy's theorems and Residue theorem. How do you propose the solultioin using complex analysis? – bikalpa Oct 24 '17 at 13:02

Your idea of using integration by parts can be used to evaluate the integral; you'll just have to couple that with Feynman's Trick. Making the substitution $u=1/(1+x^2)$ and $dv=\cos ax\, dx$ gives\begin{align*}I(a)=\int\limits_0^{\infty}\frac {\cos ax}{1+x^2}\, dx & =\frac {\sin ax}{a(1+x^2)}\,\Biggr\rvert_{0}^{\infty}+\frac 2a\int\limits_{0}^{\infty}\frac {x\sin ax}{(1+x^2)^2}\, dx\\ & =\frac 2a\int\limits_0^{\infty}\frac {x\sin ax}{\left(1+x^2\right)^2}\, dx\end{align*} Multiplying both sides by $a$ and differentiating with respect to $a$, we see that\begin{align*}a\cdot I'(a)+I(a) & =2\int\limits_0^{\infty}\frac {x^2\cos ax}{(1+x^2)^2}\, dx\\ & =2I(a)-2\int\limits_0^{\infty}\frac {\cos ax}{\left(1+x^2\right)^2}\, dx\end{align*}So$$a\cdot I'(a)-I(a)=-2\int\limits_0^{\infty}\frac {\cos ax}{\left(1+x^2\right)^2}\, dx$$Differentiating a second time and solving the little differential equation that follows gives$$I(a)=C_1e^a+C_2e^{-a}$$To find the constants, set $a=0$ and $a\to\infty$. Evaluating, we find that$$(C_1,C_2)=\left(0,\tfrac {\pi}2\right)$$Hence$$\int\limits_{0}^{\infty}\frac {\cos ax}{1+x^2}\, dx=\color{blue}{\frac {\pi}{2e^{|a|}}}$$With the absolute value there because $I(a)=I(-a)$ from the cosine function.

• that suspicious the left function is even in a-variable but the right is not – Guy Fsone Oct 24 '17 at 13:40
• how is $C_1 + C_2 = \pi$? Shouldn't it be $\frac \pi 2$? – bikalpa Oct 24 '17 at 14:09
• @bikalpa Yes that too. When I solved it, I rewrote the limits as from $-\infty$ to $\infty$. – Crescendo Oct 24 '17 at 14:12
• All clear except this line: "As a tends to $\infty$, $I(a)=0$". Could you make that point clear? – bikalpa Oct 24 '17 at 14:18
• I think I got it now. I guess it is from $I(a)=\frac 2a\int\limits_{0}^{\infty}\frac {x\sin ax}{(1+x^2)^2}\, dx$ – bikalpa Oct 24 '17 at 14:26

I'll give a purely probabilistic solution.

Let $X%$ be a random variable that takes the value of $a$ and $-a$ each with probability $1/2$. The characteristic function of $X$ is then $\phi_X(t)=E[e^{itX}]=\frac{1}{2}(e^{iatx}+e^{-iatx})=cos(at)$. Now let $Y$ be a random variable with standard cauchy distribution.

$\int_{-\infty}^{\infty}\frac{cos(at)}{1+t^2} dt=\pi\int_{-\infty}^{\infty}\phi_X(t)f_y(t) dt$

Using Parseval's relation you have that

$\pi\int_{-\infty}^{\infty}\phi_X(t)f_y(t) dt=\pi\int_{-\infty}^{\infty}\phi_Y(t)dFx(t) dt$

Where $\phi_Y(t)$ is the characteristic function of the standard cauchy distribution, $\phi_Y(t)=e^{-|t|}$. Now, you should note that the distribution of $X$ takes only two values $a$ and $-a$ with probability $\frac{1}{2}$ hence:

$\pi\int_{-\infty}^{\infty}e^{-|t|}dFx(t) dt=\frac{\pi}{2}(e^{ -|a|}+e^{ -|-a|})=\frac{\pi}{e^{|a|}}$.

Now this is the value for the full integral from $(-\infty, \infty)$ in your case you have $(0,\infty)$ but since $cos(x)$ is an even function and the denominator $(1+t^2)$ is the same for negative and positive numbers, you have:

$\int_{-\infty}^{\infty}\frac{cos(at)}{1+t^2} dt=2\int_{0}^{\infty}\frac{cos(at)}{1+t^2} dt$

Recall that, if we consider the Fourier transform $$\mathcal Ff (a) =\int_\Bbb R e^{-ia x}f(x)dx$$ then its Fourier inverse is defined as $$\mathcal F^{-1}f (x) =\frac{1}{2\pi}\int_\Bbb R e^{it x}f(t)dt.$$

But we have, \begin{split} \mathcal F(e^{-|t|})(x) = \int_{-\infty}^{\infty}e^{-|t|}e^{-ix t}\,dt &=&\int_{-\infty}^{0}e^{t}e^{-ix t}\,dt+\int_{0}^{\infty}e^{-t}e^{-ix t}\,dt\\ &=&\left[ \frac{e^{(1-ix)t}}{1-ix} \right]_{-\infty}^0-\left[\frac{e^{-(1+ix)t}}{1+ix} \right]_{0}^{\infty}\\ &=&\frac{1}{1-ix}+\frac{1}{1+ix}\\ &=&\frac{2}{x^2+1}. \end{split} Then, \begin{align} e^{-|a|}=\mathcal F^{-1}\left( \frac{2}{x^2+1}\right)(a) &=\frac{1}{2\pi}\int_\Bbb R \frac{2}{x^2+1}e^{ix a}\,dx = \frac{1}{\pi}\int_\Bbb R\frac{e^{ix a}}{x^2+1}\,dx \\&=\frac{1}{\pi}\int_\Bbb R\frac{\cos a x}{x^2+1}\,dx = \frac{2}{\pi}\int_0^\infty\frac{\cos ax}{x^2+1}\,dx \end{align} Given that, as $x\mapsto\sin ax$ is an old function we have, $$\int_\Bbb R \frac{\sin{a x}}{x^2+1}dx= 0.$$

Thus we have, $$\int_0^\infty\frac{\cos ax}{x^2+1}\,dx =\frac{\pi}{2}e^{-|a|}$$