Residue theory complex 
$$\int_{-\infty}^{\infty}\frac{\cos x}{x^4+5x^2+4}dx$$
  Give full justification of your answer, including appropriate bounds for the contributions from all portions of your contour!

I am not sure of how to define the contour. A semi circle with radius R? And then as R goes to infinity the 4 limits go to zero?
What is the correct way to define the curve?
(Original image)
 A: You first need to express cosine as 
$$\cos{x} = \frac12 (e^{i x}+e^{-i x})$$
and consider each exponential separately.  For the $e^{i x}$, consider
$$\oint_{C_+} dz \frac{e^{i z}}{z^4+5 z^2+4}$$
where $C_+$ is a semicircle in the upper half plane of radius $R$, positively oriented.  The contour integral is equal to
$$\int_{-R}^R dx \frac{e^{i x}}{x^4+5 x^2+4}+ i R \int_0^{\pi} d\theta \, e^{i \theta} \frac{e^{i R \cos{\theta}} e^{-R \sin{\theta}}}{R^4 e^{i 4 \theta}+ 5 R^2 e^{i 2 \theta}+4}$$
You may show that the second integral vanishes in the limit as $R \to \infty$ by showing that its magnitude is bounded by
$$\frac{2}{R^3}\int_0^{\pi/2} d\theta \, e^{-R \sin{\theta}} \le \frac{2}{R^3}\int_0^{\pi/2} d\theta \,  e^{-2 R \theta/\pi} \le \frac{\pi}{R^4}$$
The contour integral is also equal to $i 2 \pi$ times the sum of the residues of the poles in the contour $C_+$.  You may show that the poles of the integrand are at $z=\pm 2 i$ and $z=\pm i$, so that the poles of interest here are at $z=2 i$ and $z=i$.  By the residue theorem, we have
$$\begin{align}\int_{-\infty}^{\infty} dx \frac{e^{i x}}{x^4+5 x^2+4} &= i 2 \pi \left (\frac{e^{-2}}{4 (2 i)^3 + 10 (2 i)} + \frac{e^{-1}}{4 (i)^3+10 (i)} \right )\\ &= \frac{\pi}{6 e} \left (2-\frac1{e}\right )\end{align}$$
Normally, I would say that we need to consider the other contour in the lower half plane, but because of the symmetry, we need only take the real part of the integral; hence, we are done.
A: $\newcommand{\+}{^{\dagger}}%
 \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{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}%
 \newcommand{\dd}{{\rm d}}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\fermi}{\,{\rm f}}%
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
 \newcommand{\half}{{1 \over 2}}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\isdiv}{\,\left.\right\vert\,}%
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}%
 \newcommand{\ol}[1]{\overline{#1}}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
 \newcommand{\sech}{\,{\rm sech}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
\begin{align}
&\color{#ff0000}{\int_{-\infty}^{\infty}{\cos\pars{x} \over x^{4} + 5x^{2} + 4}
\,\dd x}
=
{1 \over 3}\int_{-\infty}^{\infty}\cos\pars{x}
\pars{{1 \over x^{2} + 1} - {1 \over x^{2} + 4}}\,\dd x
\\[3mm]&=
{1 \over 3}\int_{-\infty}^{\infty}{\cos\pars{x} \over x^{2} + 1}\,\dd x
-
{1 \over 6}\int_{-\infty}^{\infty}{\cos\pars{2x} \over x^{2} + 1}\,\dd x
=
\color{#ff0000}{{1 \over 3}\,{\cal F}\pars{1} - {1 \over 6}\,{\cal F}\pars{2}}\tag{1}
\\[3mm]&\mbox{where}\
{\cal F}\pars{\mu} \equiv
\Re\int_{-\infty}^{\infty}{\expo{\ic\verts{\mu}x} \over x^{2} + 1}\,\dd x\,,
\quad \mu \in {\mathbb R}
\end{align}

With the integration contour depicted at this answer end ( the integration over the upper arc vanishes out in the limit $R \to \infty$ ):
\begin{align}
{\cal F}\pars{\mu} \equiv
\Re\int_{-\infty}^{\infty}
{\expo{\ic\verts{\mu}x} \over \pars{x - \ic}\pars{x + \ic}}\,\dd x
=
\Re\bracks{%
2\pi\ic\,{\exp\pars{\ic\verts{\mu}\ic} \over \ic + \ic}} = \pi\expo{-\verts{\mu}}
\end{align}

We replace this result in $\pars{1}$:
$$
\int_{-\infty}^{\infty}{\cos\pars{x} \over x^{4} + 5x^{2} + 4}
\,\dd x
=
{1 \over 3}\,\pars{\pi\expo{-\verts{1}}} - {1 \over 6}\,\pars{\pi\expo{-\verts{2}}}
$$
$$
\color{#0000ff}{\large\int_{-\infty}^{\infty}{\cos\pars{x} \over x^{4} + 5x^{2} + 4}
\,\dd x}
=\color{#0000ff}{\large{1 \over 6}\,\pi\expo{-2}\pars{2\expo{} - 1}}
$$

