TITLE: Improper integrals with singularities on the REAL AXIS (Complex Variable)
QUESTION [5 upvotes]: I'm having some troubles when I try to solve improper integrals exercises that have singularities on the real axis. I have made a lot of exercises where singularities are inside a semicircle in the upper half side, but I don't know how to solve them when the singularities are on the real axis.
I read some books but I think they are not very good explained (at least, I can't understood them).
This is the exercise:
$$\int_{-\infty}^{\infty} \frac{\cos(2\pi x)}{x^2-1} dx$$
Using complex variable, I have:
$$f(z) =\frac{e^{i2\pi z}}{z^2-1}$$
so there are 2 singularities:
$z_1 = -1$ and $z_2 = 1$
I use a curve $C$ that is holomorphic inside it, because both singularities are out of it. Of course, I can divide $C$ in 6 curves: $C_R$ that is the "roof" of the curve and, using Jordan's Lemma, I can prove that 
$$\int_{C_R}^{ } \frac{e^{i2\pi z}}{z^2-1} dx = 0$$
but I don't know what do I have to do now. I saw in some places they said that the Residue Theorem over the semicircle around the singularities was something like: $$-i\pi\sum{}{}Res[f(z), z_k]$$ but I didn't understand why.
I hope you can help me, because I don't know what can I do.
Thanks!!

REPLY [2 votes]: $\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{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,{\rm Li}_{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
First at all we realize that
$$\color{#66f}{%
\,{\rm P.V.}\int_{-\infty}^{\infty}\frac{\cos\pars{2\pi x}}{x^{2} - 1}\,\dd x}
=\Re\int_{-\infty}^{\infty}\frac{\expo{2\pi x\ic} - 1}{x^{2} - 1}\,\dd x
+\,{\rm P.V.}\int_{-\infty}^{\infty}\frac{\dd x}{x^{2} - 1}
$$
The first integral, in the right hand side, vanishes out which can be shown by means of a contour integration. Then, we are left with a 'simple' term: 
\begin{align}\color{#66f}{%
\,{\rm P.V.}\int_{-\infty}^{\infty}\frac{\cos\pars{2\pi x}}{x^{2} - 1}\,\dd x}
&=\,{\rm P.V.}\int_{-\infty}^{\infty}\frac{\dd x}{x^{2} - 1}
\\[5mm]&=\lim_{\epsilon \to 0^{+}}\bracks{%
\int_{-\infty}^{-1 - \epsilon}\frac{\dd x}{x^{2} - 1}
+\int_{-1 + \epsilon}^{1 - \epsilon}\ \frac{\dd x}{x^{2} - 1}
+\int_{1 + \epsilon}^{\infty}\frac{\dd x}{x^{2} - 1}}
\end{align}
Since
$\ds{\int\frac{\dd x}{x^{2} - 1} =\half\,\ln\pars{\verts{\frac{1 - x}{1 + x}}}  + \mbox{a constant}}$, the above expression is reduced to:
\begin{align}&\color{#66f}{\large%
\,{\rm P.V.}\int_{-\infty}^{\infty}\frac{\cos\pars{2\pi x}}{x^{2} - 1}\,\dd x}
\\[5mm]&=\lim_{\epsilon \to 0^{+}}\ \braces{%
\ln\pars{\verts{\frac{2 + \epsilon}{-\epsilon}}}
+\ln\pars{\verts{\frac{\epsilon}{2 - \epsilon}\,\frac{\epsilon}{2 - \epsilon}}}
-\ln\pars{\verts{\frac{-\epsilon}{2 + \epsilon}}}}=\color{#66f}{\large 0}
\end{align}