I have to do the following integral(using complex analysis):
$$\int_{0}^{\infty} \frac{\cos{nx}}{x^{4}+1} dx $$
So, first I evaluated $x^{4}+1=0 $ and got $x = \pm \frac{1+i}{\sqrt{2}}, \pm \frac{-1+i}{\sqrt{2}} $
Let, $\Gamma$ be a semicircle(in the upper half-plane) of radius $R$, where $R > 1$ so,
$$ \int_{\Gamma} \frac{\cos{nz}}{z^{4}+1} dz = \int_{\Gamma} \frac{cos(nz)}{(z-z_{1})(z-z_{2})(z-z_{3})(z-z_{4})} dz$$, where $z_{1}, z_{2}, z_{3}, z_{4}$ are the four zeroes of $ z^{4} +1 = 0$. Then I computed the residues in the following manner:
Res($f$, $\frac{1+i}{\sqrt{2}})$ = $ \lim_{\ z\to\ \frac{1+i}{\sqrt{2}}} \frac{cosnz}{(z+\frac{1+i}{\sqrt{2}})((z-\frac{-1+i}{\sqrt{2}} )(z+\frac{-1+i}{\sqrt{2}})} $
Since, the expression is messy I will call the residue $a$ and doing the same thing to compute the other residue I get $b$.
Then, we notice that on the semicircular arc:
$$ \left|\frac{cos(nz)}{z^{4} +1} \right| \leq \frac{1}{R^{4}+1} $$ and
$$ \left| \int \frac{cos(nz)}{z^{4} +1} dz \right| \leq \frac{1}{R^{4}+1} .\pi R $$
So, the integral goes to $0$ as $R \rightarrow \infty$. So, as $R \rightarrow \infty$
$$\int_{\Gamma} f(z) dz = \int_{-\infty}^{\infty} \frac{\cos{nx}}{x^{4}+1} dx = 2\pi i(a+b)$$
So,
$$ \int_{0}^{\infty} \frac{\cos{nx}}{x^{4}+1} dx = \frac{1}{2} \int_{0}^{\infty} \frac{\cos{nx}}{x^{4}+1} dx = \frac{1}{2}(a+b) \pi i $$
Is my work correct? If not, where did I go wrong?
Some things:
The exponential eventually overpowers any polynomial in the denominator.