# How to integrate $\int_{-\infty} ^\infty \frac{\cos(xy)}{x^2+1}dx$

Is there a standard trick to compute this integral for $y\ge 0$?

$\int_{-\infty} ^\infty \frac{\cos(xy)}{x^2+1}dx = \int_{-\infty}^{\infty}\frac{y \cos(x)}{x^2+y^2}$

Hopefully the same trick could be used to evaluate

$\int_{-\infty} ^\infty \frac{x\sin(x)}{x^2+y^2}dx$

Wolfram tells me these are both equal to $\pi e^{-y}$

• the method is called residue calculation.. look up a book on complex analysis. – username Jul 10 '14 at 21:35
• Your formula is only valid for $y \geq 0$. Note the integral is an even function of $y$, but $\pi{e}^{-y}$ is not. Or you could say the integral is $\pi{e}^{-|y|}$ for all $y$. – KCd Jul 10 '14 at 21:42
• While using the residue theorem is probably the standard method, for someone who knows complex analysis, the integral can also be evaluated without complex analysis by using differentiation under the integral sign. See section 11 of math.uconn.edu/~kconrad/blurbs/analysis/diffunderint.pdf. – KCd Jul 10 '14 at 21:45
• To use the residue theorem, is it obvious what the contour should be? I can't always find the right one. – Mark Jul 10 '14 at 21:46
• You have to try something, so just go ahead and use the contours you've used in the past for integrals over the whole real line. At least try a contour before asking others what to use. This stuff is learned by experience. – KCd Jul 10 '14 at 21:55

Consider the integral $\Re[\int_\gamma \frac{ae^{iz}}{x^2+a} dz] = \int_\gamma \Re[ \frac{ae^{iz}}{z^2+a}] dz$ where $\gamma$ is a semicircular contour of radius $R$. On the real line the contour reduces to the integral in question. We see a residue at $ia$ with a value of $2 \pi ia e^{i i a}/(2 i a) = \pi e^{-a}$ by substituting $ia$ into $\frac{ae^{iz}}{z+ia}$, which means $\Re[\int_\gamma \frac{ae^{iz}}{z^2+a} dz] = \pi e^{-a}$. Taking the limit as the countour goes to infinity yeilds the result, as the semicircular part goes to zero by Jordan's Lemma.

For the second integral, do the same argument except using $\Re[\int_\gamma \frac{-ize^{iz}}{z^2+a} dz]$

• See this. I answered the same problem without using contour integration and of course for the second integral can be evaluated using Feynman way. – Tunk-Fey Jul 11 '14 at 9:35

Once you evaluate the first integral then the second one can be found easily by noting that

$$I(y) = \int_{-\infty}^{\infty}\frac{\cos(xy)}{1+x^2}dx \implies \frac{dI}{dy}=-\int_{-\infty}^{\infty}\frac{x\sin(xy)}{1+x^2}dx$$

which implies

$$\int_{-\infty}^{\infty}\frac{x\sin(xy)}{1+x^2}dx = -\frac{dI}{dy}.$$

• How would you justify differentiating under the integral sign? – Mark Jul 11 '14 at 3:00