Integral $\int_{-\infty}^\infty \frac{\exp{(-x^2)}}{1+x^4}dx$

I have an integral that I'd like some advice on how to find. It is: $$\int_{-\infty}^{\infty} \frac{\exp(-x^2)}{1+x^4}dx$$

I have some experience with contour integrals so I tried using a contour integral where the contour is a semi-circle of radius R in the upper half of the complex plane. I think the integral along the arc vanishes as $R \to \infty$ so I used the residue theorem and am getting a value of $\tfrac{\pi}{\sqrt{8}}(\cos(1) - \sin(1))$. But this can't be right as the value is negative whereas the integrand is always positive! I can't work out what is going wrong.

Does anyone have an idea about how to evaluate this integral? Contour integration is the preferred method if possible but I am also open to other methods. Any suggestion is appreciated!


$$\int_{-\infty}^\infty \frac{e^{-x^2}}{\color{blue}{1+x^4}}dx=\int_{-\infty}^\infty e^{-x^2}\color{blue}{\int_0^\infty e^{-x^2 t} \sin t \,dt} dx=\int_0^\infty \sin t\color{red}{\int_{-\infty}^\infty e^{-(1+t)x^2}dx}dt$$ $$=\color{red}{\sqrt \pi} \int_0^\infty\frac{\sin t}{\color{red}{\sqrt{1+t}}}dt\overset{1+t=x^2}=2\sqrt{\pi}\int_1^\infty \sin(x^2-1)dx$$$$=2\sqrt{\pi} \cos 1 \int_1^\infty\sin(x^2)dx-2\sqrt{\pi} \sin 1 \int_1^\infty\cos(x^2)dx $$ $$=\boxed{\pi\cos 1\frac{1-2S\left(\sqrt{\frac{2}{\pi}}\right)}{\sqrt 2}-\pi\sin 1\frac{1-2C\left(\sqrt{\frac{2}{\pi}}\right)}{\sqrt 2}}$$ Where $S(x)$ and $C(x)$ are Fresnel Integrals.


Brian's suggestion above deserves a mention as I was able to solve the integral that way too!

Let $$I(t) = \int_{-\infty}^{\infty} \frac{\exp(-tx^2)}{1+x^4}dx$$ for a parameter $t \geq 0$. Differentiating gives $$I'(t) = -\int_{-\infty}^{\infty} \frac{x^2 \exp(-tx^2)}{1+x^4}dx$$ and a second differentiation gives $$I''(t) = \int_{-\infty}^{\infty} \frac{x^4 \exp(-tx^2)}{1+x^4}dx.$$ Hence, $$I''(t) + I(t) = \int_{-\infty}^{\infty} \exp(-tx^2) = \sqrt{\frac{\pi}{t}}$$ as Brian pointed out.

Recalling my lecture notes, we now have a second order inhomogenous linear ODE with constant coefficients. The solution can be written $$I(t) = I_C(t) + I_P(t)$$ where $I_C(t)$ solves the homogenous ODE $$I_C''(t) + I_C(t) = 0.$$ Let $I_1(t) = \sin(t)$ and $I_2(t) = \cos(t)$ be the two solutions to the homogenous ODE. The particular solution $I_P(t)$ can now be found using the method described here http://tutorial.math.lamar.edu/Classes/DE/VariationofParameters.aspx

Noting that the Wronskian for I1 and I2 is -1, the particular solution is $$I_P(t) = \sin(t) \int_{0}^t \sqrt{\frac{\pi}{u}} \cos(u) du - \cos(t) \int_{0}^t \sqrt{\frac{\pi}{u}} \sin(u) du$$ or $$I_P(t) = 2\sqrt{\pi} \left( \sin(t) \int_{0}^{\sqrt{t}} \cos(u^2) du - \cos(t) \int_{0}^{\sqrt{t}} \sin(u^2) du \right).$$ Putting this all together gives $$I(t) = A \sin(t) + B \cos(t) + \pi \sqrt{2} \left\{ C\left( \sqrt{\frac{2t}{\pi}} \right) \sin(t) - S\left( \sqrt{\frac{2t}{\pi}} \right) \cos(t) \right\},$$ where $C(x)$ and $S(x)$ are the Fresnel cosine and sine integrals respectively.

The initial conditions are $$I(0) = \int_{-\infty}^{\infty} \frac{dx}{1+x^4}$$ and $$-I'(0) = \int_{-\infty}^{\infty} \frac{x^2}{1+x^4} dx.$$

Using a D shaped contour in the complex plane, these integrals can be shown to both equal $\frac{\pi}{\sqrt{2}}$. Hence $B = -A = \frac{\pi}{\sqrt{2}}$.

This finally gives $$I(1) = \pi\cos(1) \frac{1 - 2 S\left( \sqrt{\frac{2}{\pi}} \right)}{\sqrt{2}} - \pi\sin(1) \frac{1 - 2 C\left( \sqrt{\frac{2}{\pi}} \right)}{\sqrt{2}}.$$