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!

  • 6
    $\begingroup$ Welcome to MSE. Nice first question! $\endgroup$ Nov 7, 2019 at 11:30
  • 3
    $\begingroup$ The problem with your semi-circle is that if $x=iy$ then $\exp(-x^2)/(1+x^4)=\exp(y^2)/(1+y^4)$, which goes to $+\infty$ as $y \to +\infty$. $\endgroup$
    – Botond
    Nov 7, 2019 at 11:37
  • 4
    $\begingroup$ Just a warning to anyone trying this. It looks like the Fresnel integrals are inevitable. WolframAlpha will give an exact answer in terms of the Fresnel $S$ and $C.$ Trying to use a method similar to this post is one option, but it leads to solving $y'' + y = \sqrt{\pi/x},$ which again leads to the Fresnel integrals. $\endgroup$ Nov 7, 2019 at 12:22
  • 2
    $\begingroup$ Mathematica gives the answer $$\frac{\pi \left(\left(2 C\left(\sqrt{\frac{2}{\pi }}\right)-1\right) \sin (1)+\left(1-2 S\left(\sqrt{\frac{2}{\pi }}\right)\right) \cos (1)\right)}{\sqrt{2}}.$$ Here, $S$ and $C$ are the Fresnel integral functions mentioned above. $\endgroup$
    – YiFan
    Nov 7, 2019 at 13:37
  • 2
    $\begingroup$ Maple evaluates this in terms of the Anger function $J$ and the Weber function $E$. Another reason to think it is not "elementary". $\endgroup$
    – GEdgar
    Nov 7, 2019 at 14:07

2 Answers 2


$$\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.

  • 1
    $\begingroup$ Nice solution! The only non obvious trick is recognising $1/(1+x^4)$ as $\int_0^\infty \exp(-x^2 t) sin(t) dt$ $\endgroup$
    – Craig
    Nov 8, 2019 at 17:26
  • 2
    $\begingroup$ You have a unique talent for solving integrals. $\endgroup$
    – Axion004
    Nov 8, 2019 at 18:46
  • $\begingroup$ Thanks for the nice words! $\endgroup$
    – Zacky
    Nov 8, 2019 at 19:13
  • 1
    $\begingroup$ This effectively demonstrates the importance of remembering Laplace transforms while integrating :D $\endgroup$
    – TravorLZH
    Dec 27, 2020 at 9:21

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}}.$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.