I just encountered this problem in my complex analysis course. The textbook asks to solve $\int _{-\infty}^{\infty} \frac{\cos x}{x^2 + a^2} dx$ using contour integration. So I followed the standard procedure but somehow came up with a wrong answer. Here I will show my steps:

**Step 1:** Find all poles of $\frac{\cos z}{z^2 + a^2}$ above the x-axis in the complex plane. This just means finding all zeros of $z^2 + a^2$ since $\cos z$ is perfectly defined except for the $\pm \infty$. So $z^2 + a^2 = 0 \Rightarrow z = \pm ia$ and hence the only pole above the x-axis is $z = ia$.

**Step 2:** Compute the residues of $\frac{\cos z}{z^2 + a^2}$ at the poles and sum them up. In this case there is only one residue to be found. $res_{ia} (\frac{\cos z}{z^2 + a^2}) = \displaystyle{\lim_{z \to ia} (z-ia)(\frac{\cos z}{z^2 + a^2})}=\displaystyle{\lim_{z \to ia} \frac{\cos z}{z+ia}} = \frac{\cos ia}{2ia}$. Thus $\sum res (\frac{\cos z}{z^2 + a^2}) = \frac{\cos ia}{2ia}$.

**Step 3:** Apply the residue theorem. $\oint _C \frac{\cos z}{z^2 + a^2} dz = (2\pi i)(\frac{\cos ia}{2ia}) = \frac{\pi \cos {ia}}{a}$ where C is the usual half circle (above x-axis) of radius R plus -R to R contour, in the anti-clockwise direction.

**Step 4:** Rewrite the integral as $\oint _C \frac{\cos z}{z^2 + a^2} dz = \int _{-R} ^R \frac{\cos x}{x^2 + a^2} dx + \int _\gamma \frac{\cos z}{z^2 + a^2} dz$, where $\gamma$ refers to the contour along the circumference part of the half circle. We have already found the LHS, and the $\gamma$ integral is just zero after taking $R \rightarrow \infty$ because $\frac{\cos z}{z^2 + a^2} \le \frac{1}{R^2-a^2}$ after applying triangle inequality and the fact $\cos z \le 1$ (valid for complex plane??). Therefore $\int _{-\infty}^{\infty} \frac{cosx}{x^2 + a^2} dx = \frac{\pi \cos ia}{a}$.

However the correct answer should be $\frac{\pi e^{-a}}{a}$. I am not sure why I got this wrong, but most likely it has something to do with step 2. Any help will be greatly appreciated!

# Solve $\int _{-\infty}^{\infty} \frac{\cos x}{x^2 + a^2} dx$ using contour integration

complex-analysis

## Best Answer

No, $|\cos(z)|\le1$ is

notvalid for $z\in\Bbb C$. In fact $\cos(iy)\not\to0$, and in fact the integral of your function over that semicircle does not tend to zero. Hence this is not going to work without some change.You say you did the "standard thing". If you look up for example the standard evaluation of $\int_{-\infty}^\infty\frac{\sin(t)}{t}\,dt$ you see that this problem is solved by taking $\sin(t)=\Im e^{it}$; that works because $e^{i(iy)}$ does tend to zero at infinity.