Use of residues to find I=$\int_0^\infty \frac{\sin^2(x)}{1+x^4} dx$ I'm working on the problem $$I=\int_0^\infty \frac{\sin^2(x)}{1+x^4} dx$$
I found 4 singularities and i would like to use the singularities in the 1st and 2nd quadrants to solve this integral; i.e. $z_0=e^{i\frac{\pi}{4}}$ and $e^{i\frac{3\pi}{4}}$. My prof. said we should split this into two integrals using the trig identity $\sin^2(x)=\frac{1-\cos(2x)}{2}$ so we have 
$$I=\frac{1}4 \int_{-\infty}^{\infty}\frac{dx}{1+x^4}- \frac{1}4\int_{-\infty}^{\infty}\frac{\cos(2x)}{1+x^4}$$
Or
$$I=\frac{2\pi i}{4}Res[\frac{1}{1+z^4}, z_0=e^{\frac{\pi i}{4}}, e^{\frac{3\pi i}{4}}]-\frac{2\pi i}{4}Res[\frac{e^{2ix}}{1+z^4},z_0=e^{\frac{\pi i}{4}},e^{\frac{3\pi i}{4}}]$$
I didn't have any trouble with the 1st residue but i'm a bit unsure how to handle the second residue. Should i let $e^{2ix}=e^{2iz}$ then substitute $z=z_0$? In that case I seems to get a really messy answer. Is there a cleaner way to deal with that second residue? I should add that I am a physics major and this is a problem for my Mathematical Methods class. I haven't taken any complex variable courses.
Thank you. 
 A: Let's start at the beginning because it appears that, although you have the correct formulation, you really do not seem to understand what is going on.(For example, why not use the singularities in the 3rd and 4th quadrants?)
Consider the contour integral:
$$\oint_C dz \frac{1-e^{i 2 z}}{1+z^4} $$
where $C$ is a semicircle of radius $R$ in the upper half plane.  The contour integral is equal to
$$\int_{-R}^R dx \frac{1-e^{i 2 x}}{1+x^4} + i R \int_0^{\pi} d\theta \, e^{i \theta} \, \frac{1-e^{i 2 R e^{i \theta}}}{1+R^4 e^{i 4 \theta}}$$
The first integral is equal to 
$$\int_{-R}^R dx \frac{1-\cos{2 x}}{1+x^4} $$
We now show that the magnitude the second integral vanishes as $R \to \infty$.  We do this by using the inequality $\sin{\phi} \ge 2 \phi/\pi$ when $\phi \in [0,\pi/2]$.  The magnitude of the second integral is then bounded by
$$\begin{align}\left |i R \int_0^{\pi} d\theta \, e^{i \theta} \, \frac{1-e^{i 2 R e^{i \theta}}}{1+R^4 e^{i 4 \theta}} \right | &\le R \int_0^{\pi} d\theta \, \left | \frac{1}{1+R^4 e^{i 4 \theta}} \right | + R \int_0^{\pi} d\theta \, \left | \frac{e^{i 2 R e^{i \theta}}}{1+R^4 e^{i 4 \theta}} \right |\\ &\le \frac{\pi R}{R^4-1} + \frac{2 R}{R^4-1} \int_0^{\pi/2} d\theta \, e^{-2 R \sin{\theta}} \\ &\le \frac{\pi R}{R^4-1} + \frac{2 R}{R^4-1} \int_0^{\pi/2} d\theta \, e^{-2 R (2 \theta/\pi)}\\ &\le \frac{\pi (R+1/2)}{R^4-1}\end{align} $$
which vanishes as $R \to \infty$.
By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the sum of the residues at the poles of the integrand inside $C$, or $z=e^{i \pi/4}$ and $z=e^{i 3 \pi/4}$.  Thus,
$$\begin{align}\int_{-\infty}^{\infty} dx \frac{1-\cos{2 x}}{1+x^4} &= i 2 \pi \left [\frac{1-e^{i 2 e^{i \pi/4}}}{4 e^{i 3 \pi/4}} + \frac{1-e^{i 2 e^{i 3 \pi/4}}}{4 e^{i 9 \pi/4}} \right ] \\ &= i \frac{\pi}{2} \left [-i \sqrt{2} - e^{-i 3 \pi/4} e^{i \sqrt{2}} e^{-\sqrt{2}} - e^{-i \pi/4} e^{-i \sqrt{2}} e^{-\sqrt{2}} \right ] \\ &= i \frac{\pi}{2} \left [-i \sqrt{2} + e^{i \pi/4} e^{i \sqrt{2}} e^{-\sqrt{2}} - e^{-i \pi/4} e^{-i \sqrt{2}} e^{-\sqrt{2}} \right ] \\ &= i \frac{\pi}{2} \left [-i \sqrt{2} + i 2 \operatorname{Im}{\left ( e^{i \pi/4} e^{i \sqrt{2}} e^{-\sqrt{2}}\right )} \right ] \\ &= \frac{\pi}{\sqrt{2}}-\pi e^{-\sqrt{2}} \sin{\left (\sqrt{2} + \frac{\pi}{4} \right )}  \end{align}$$
Thus,
$$\int_0^{\infty} dx \frac{\sin^2{x}}{1+x^4} = \frac{\pi}{4 \sqrt{2}}-\frac{\pi}{4} e^{-\sqrt{2}} \sin{\left (\sqrt{2} + \frac{\pi}{4} \right )}$$
which can also be written as

$$\int_0^{\infty} dx \frac{\sin^2{x}}{1+x^4} = \frac{\pi}{4 \sqrt{2}} \left ( 1 -e^{-\sqrt{2}} \left [ \sin{\left (\sqrt{2} \right )} +\cos{\left (\sqrt{2} \right )} \right ] \right )$$

