Find$\int_{-\infty}^{\infty} \frac{\cos(x)}{x^2 + 2x + 4}\,dx$ and $\int_{-\infty}^{\infty} \frac{\sin(x)}{x^2 + 2x + 4}\,dx$ Find  
$$\int_{-\infty}^{\infty} \dfrac{\cos(x)}{x^2 + 2x + 4}\,dx$$
and
$$\int_{-\infty}^{\infty} \dfrac{\sin(x)}{x^2 + 2x + 4}\,dx$$
I find it really difficult.
Much appreciate it if anyone can solve this for me thanks.
 A: Hint: Consider the function $$f(z) = \frac{e^{iz}}{z^2  +2z  +4}$$ Notice that $f(z)$ has poles at $-1 \pm i \sqrt 3$. Choose one root and take the path $C_R$ to be a semi-circunference of radius $R > 2$. 
Use the Residue Theorem, to find the real and imaginary parts of your function $f(z)$ as $R \to \infty$. 
A: To add a bit of detail:
Let $\gamma_1$ be the contour $[-R,R]$ and $\gamma_2$ be the contour $Re^{i[0,\pi]}$ as $R\to\infty$. Then
$$
\begin{align}
&\int_{-\infty}^\infty\frac{\cos(x)\,\mathrm{d}x}{x^2+2x+4}
+i\int_{-\infty}^\infty\frac{\sin(x)\,\mathrm{d}x}{x^2+2x+4}\\[6pt]
&=\int_{-\infty}^\infty\frac{e^{ix}\,\mathrm{d}x}{(x+1)^2+3}\tag{1}\\[6pt]
&=\frac1{2i\sqrt3}\int_{\gamma_1\cup\gamma_2}\left(\frac1{z+1-i\sqrt3}-\frac1{z+1+i\sqrt3}\right)e^{iz}\,\mathrm{d}z\\
&-\int_{\gamma_2}\frac{e^{iz}\,\mathrm{d}z}{(z+1)^2+3}\tag{2}\\[6pt]
&=\frac{2\pi i}{2i\sqrt3}\operatorname*{Res}_{z=-1+i\sqrt3}\left(\frac{e^{iz}}{z-(-1+i\sqrt3)}\right)\tag{3}\\[6pt]
&=\frac\pi{\sqrt3}e^{i(-1+i\sqrt3)}\tag{4}\\[6pt]
&=\frac\pi{\sqrt3}e^{-\sqrt3}(\cos(1)-i\sin(1))\tag{5}
\end{align}
$$
Explanation:
$(1)$: Euler's Formula
$(2)$: the integral over the line is the limit of the difference of two contour integrals
$(3)$: Residue Theorem and
$$\small\left|\int_{\gamma_2}\frac{e^{iz}\,\mathrm{d}z}{(z+1)^2+3}\right| \le2\int_0^{\pi/2}\frac{e^{-R\sin(\theta)}}{(R-1)^2}R\,\mathrm{d}\theta \le2\int_0^{\pi/2}\frac{e^{-2R\theta/\pi}}{(R-1)^2}R\,\mathrm{d}\theta\le\frac{\pi}{(R-1)^2}$$
$(4)$: evaluate the residue
$(5)$: Euler's Formula

Equating the real and imaginary parts above, we get
$$
\int_{-\infty}^\infty\frac{\cos(x)\,\mathrm{d}x}{x^2+2x+4}=\frac\pi{\sqrt3}e^{-\sqrt3}\cos(1)\tag{6}
$$
and
$$
\int_{-\infty}^\infty\frac{\sin(x)\,\mathrm{d}x}{x^2+2x+4}=-\frac\pi{\sqrt3}e^{-\sqrt3}\sin(1)\tag{7}
$$
A: It gave us:
$$\int_{-\infty}^{\infty} \dfrac{\cos(x)}{x^2 + 2x + 4}\,dx=\frac{e^{-\sqrt{3}}\pi \cos(1)}{\sqrt{3}}$$
And
$$\int_{-\infty}^{\infty} \dfrac{\sin(x)}{x^2 + 2x + 4}\,dx=\frac{e^{-\sqrt{3}}\pi \sin(1)}{\sqrt{3}}$$
