I'm trying to integrate the following:
$$I = \int^\infty_0 \dfrac{\cos x}{x^2 + 1} dx$$
What I did was:
$$I = \int^\infty_0 \dfrac{\cos x}{x^2 + 1} dx = \dfrac{1}{2}\int^\infty_{-\infty} \dfrac{e^{ix}+e^{-ix}}{2(x^2+1)} dx = \dfrac{1}{4}\int^\infty_{-\infty} \dfrac{e^{ix}}{x^2+1} + \dfrac{1}{4}\int^\infty_{-\infty} \dfrac{e^{-ix}}{x^2+1} dx$$
Now I'm not sure what to do. I'm aware that I'm supposed to solve this using Jordan's Lemma (I think?), though I don't know how.
Let's call $$I_1 = \dfrac{1}{4}\int^\infty_{-\infty} \dfrac{e^{ix}}{x^2+1}$$ and
$$I_2 = \dfrac{1}{4}\int^\infty_{-\infty} \dfrac{e^{-ix}}{x^2+1} dx$$
I know that both $I_1$ and $I_2$ have simple poles in $Z = \pm i$. $I_1$ is easy to calculate, as:
$$I_1 = 2\pi i R_{z=i}$$, where,
$$R_{z=i} = lim_{z-> i} (z-i)\dfrac{e^{iz}}{(z -i)(z+i)} = \dfrac{1}{2ei}$$
Now, what should I do with $I_2$? Can I do exactly the same? Why or why not?
Note that making the change of variables $y=-x$ in $I_2$ you get $I_2=I_1$.