Complex analysis: Compute $\int_{-\infty}^\infty \frac{\cos(x)}{1+x^4} dx$. This is a problem that I was trying to solve in preparation for an entrance exam. The first part of the problem was to solve $\int_{-\infty}^\infty \frac{1}{1+x^4} dx$ which is a fairly straight-forward application of complex analysis using a half-circle toy contour. I am not sure however, how I should proceed with this integral. One approach I thought to use was an "expanding rectangle" persae but that didn't seem to work. Any help is appreciated.
 A: Hint: Consider the integral 
$$\int_{-\infty}^\infty \frac{e^{ix}}{1+x^4}\,dx.$$
Integrate the corresponding complex function over a closed curve consisting of a line segment $(-R,R)$ and the semicircle from $R$ to $-R$ in the op upper half plane. Since $|e^{iz}|=e^{-y}$ is bounded in the upper half plane, we can conclude that the integral over the semicircle tends to zero. We obtain 
$$\int_{-\infty}^\infty \frac{e^{ix}}{1+x^4}\,dx=2\pi i \sum_{y>0} \text{Res } \frac{e^{iz}}{1+z^4}$$
Finally, taking the real part gives the answer.
A: As Feng Shao said, for this integral you could first consider: $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = \int_{-\infty}^{\infty}\frac{\cos\left(x\right)+i\sin\left(x\right)}{x^{4}+1}dx $$
And after you'd take as a result just the real part. Converting that integral into the complex world we get $$ \int_{c}^{ }\frac{e^{iz}}{z^{4}+1}dz $$
Now, let's find the poles of this expression, letting $z^4$ + 1 = 0, we get $z^4$ = -1, or ($z^2$ + i)($z^2$ - i) = 0, then let's find all roots. $$ z^{4} + 1 = (z + \sqrt{i})(z - \sqrt{i})(z + i\sqrt{i}))(z - i\sqrt{i}))$$
So, we get to know that the poles are $ ±\sqrt{i}, and ±i\sqrt{i}$. We're going to be integrating on the upper half of the complex plane, such that the poles that matter for us are the positive versions, $ \sqrt{i}\ and, i\sqrt{i}\ $. $\hspace{0cm}$
As the expression in the integral goes to 0 when the limits of the integration of the circle goes to infinity, we can conclude that. $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx =  Resi_{z=\sqrt{i}}\frac{e^{iz}\left(z-\sqrt{i}\right)}{z^{4}+1}+Resi_{z=i\sqrt{i}}\frac{e^{iz}\left(z-i\sqrt{i}\right)}{z^{4}+1}  $$
Now let's work on the residues, simplifying both expressions, we get $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = Resi_{z=\sqrt{i}}\frac{e^{iz}}{\left(z^{2}+i\right)\left(z+\sqrt{i}\right)}+Resi_{z=i\sqrt{i}}\frac{e^{iz}}{\left(z^{2}-i\right)\left(z+i\sqrt{i}\right)} $$
Pluging in the values of the residues we get $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = Residue\frac{e^{i\sqrt{i}}}{\left(2i\right)\left(2\sqrt{i}\right)}-\frac{e^{-\sqrt{i}}}{\left(2i\right)\left(2i\sqrt{i}\right)} $$
To get the result we want, we need to multiply the residue by 2iπ. $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = \left(\frac{e^{i\sqrt{i}}}{\left(2i\right)\left(2\sqrt{i}\right)}-\frac{e^{-\sqrt{i}}}{\left(2i\right)\left(2i\sqrt{i}\right)}\right)2i\pi $$
$$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = \left(\frac{ie^{i\sqrt{i}}-e^{-\sqrt{i}}}{\left(2i\sqrt{i}\right)}\right)\pi $$
Now, let's actually figure out what $\sqrt{i}$ is. We know $ i = e^{iπ/2}$, taking the square root on both sides, we get $$ \sqrt{i} = e^{iπ/4} $$ $$ \sqrt{i} = cos(π/4) + isin(π/4) $$ $$ \sqrt{i} = \frac{i+1}{\sqrt{2}} $$. Now that we've just figured out what $\sqrt{i}$ is, let's plug that in in our expression. $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = \left[\frac{ie^{\frac{i}{\sqrt{2}}-\frac{1}{\sqrt{2}}}-e^{-\frac{i}{\sqrt{2}}-\frac{1}{\sqrt{2}}}}{2\left(\frac{i-1}{\sqrt{2}}\right)}\right]\pi $$
$$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = \left[\frac{ie^{\frac{i}{\sqrt{2}}}-e^{-\frac{i}{\sqrt{2}}}}{\sqrt{2}\left(i-1\right)e^{\frac{1}{\sqrt{2}}}}\right]\pi $$
Simplifying the complex e's. $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = \left[\frac{i\cos\left(\frac{1}{\sqrt{2}}\right)-\sin\left(\frac{1}{\sqrt{2}}\right)-\cos\left(\frac{1}{\sqrt{2}}\right)+i\sin\left(\frac{1}{\sqrt{2}}\right)}{\sqrt{2}\left(i-1\right)e^{\frac{1}{\sqrt{2}}}}\right]\pi $$
If you take a look at the expression in the numerator, we can factor out (i - 1), so we get $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = \left[\frac{\left(i-1\right)\left(\cos\left(\frac{1}{\sqrt{2}}\right)+\sin\left(\frac{1}{\sqrt{2}}\right)\right)}{\sqrt{2}\left(i-1\right)e^{\frac{1}{\sqrt{2}}}}\right]\pi $$
Now we can cancel out the (i-1) on the top and bottom, then we get. $$ \int_{-\infty}^{\infty}\frac{e^{ix}}{x^{4}+1}dx = \frac{\pi\left(\cos\left(\frac{1}{\sqrt{2}}\right)+\sin\left(\frac{1}{\sqrt{2}}\right)\right)}{\sqrt{2}e^{\frac{1}{\sqrt{2}}}} $$
Expanding the integral on the left, we get. $$ \int_{-\infty}^{\infty}\frac{\cos\left(x\right)+i\sin\left(x\right)}{x^{4}+1}dx = \frac{\pi\left(\cos\left(\frac{1}{\sqrt{2}}\right)+\sin\left(\frac{1}{\sqrt{2}}\right)\right)}{\sqrt{2}e^{\frac{1}{\sqrt{2}}}} $$
As $i\int_{-\infty}^{\infty}\frac{\sin\left(x\right)}{x^{4}+1}dx$ is the imaginary part, and we don't have any imaginary expression here, as a bonus we get that $$ \int_{-\infty}^{\infty}\frac{\sin\left(x\right)}{x^{4}+1}dx = 0 $$
And for the final answer, we get: $$ \int_{-\infty}^{\infty}\frac{\cos\left(x\right)}{x^{4}+1}dx = \frac{\pi\left[\cos\left(\frac{1}{\sqrt{2}}\right)+\sin\left(\frac{1}{\sqrt{2}}\right)\right]}{\sqrt{2}e^{\frac{1}{\sqrt{2}}}} ≈ 1.54427600962... $$
I hope this explanation was helpful to someone, thank you!
