Two nice integrals: $\int_{-\infty}^{+\infty} \frac{\cos(x^2)}{1 + x^2} dx$ and $\int_{-\infty}^{+\infty} \frac{\sin(x^2)}{1 + x^2} dx$

Wolfram Alpha solve those two integrals, and apparently it depends from the residue of the pole at $$x = i$$ and at infinity, as far I could solve.

The results can be previewed here:

https://www.wolframalpha.com/input/?i=integrate(sin(x%5E2)%2F(1%2Bx%5E2),x,-inf,%2Binf)

https://www.wolframalpha.com/input/?i=integrate(cos(x%5E2)%2F(1%2Bx%5E2),x,-inf,%2Binf)

Part of the answer makes sense, since it can be directly evaluated by the Residue Theorem.

However the terms that depends from the Fresnel Functions are a little strange.

How to solve this integral that combine a Fresnel Integral and a rational function that should be solvable using the Residues Theorem ?

• What do you get when you differentiate $\int_{\Bbb R}\frac{\exp is(1+x^2)}{1+x^2}dx$ with respect to $s$? What is that function of $s$ at $s=0$? – J.G. Mar 4 '19 at 22:36
• @user I'm too old for this game $\ddot \smile$ – Git Gud Mar 4 '19 at 22:46
• Differentiate the function given by J.G. and integrating it, will give 0, since it was an even function. – Arucard Mar 5 '19 at 12:37
• I made a mistake earlier, but differenciate $f(s) = \int_\infty^\infty \frac{exp ( i s (1+x^2))}{1+x^2} dx$, over s, and calculate the whole integral will get: $f(s) = - \pi * erf ((\frac{\sqrt{2}}{2} - \frac{\sqrt{2} i}{2}) \sqrt{s}) + \pi$ – Arucard Mar 5 '19 at 16:16
• And for f(0), it's a trivial integral, since: $f(0) = \int_{-\infty}^\infty \frac{1}{1 + x^2} dx = \pi$. – Arucard Mar 5 '19 at 16:26

Using the tip giving by J.G. the problem can be view as the following complex integral:

$$f(s) = \int_{-\infty}^\infty \frac{\exp{(i s (1 + x^2))}}{1 + x^2} dx$$

Taking the derivative of $$f(s)$$, it will give a Complex Fresnel Integral:

$$f'(s) = \int_{-\infty}^\infty i \exp{(i s (1 + x^2))} dx$$

Luckily, the solution for this integral was already solved on standard textbooks, so I will skip this step:

$$f'(s) = \sqrt{\frac{\pi}{2 s}} (i + 1) i \exp{(i s)}$$

Finally, the original problem are almost equal to $$f(1)$$, which implies to evaluate the integral:

$$f(1) - f(0) = \int_0^1 \sqrt{\frac{\pi}{2 s}} (i + 1) i \exp{(i s)} ds$$

Where $$f(0) = \int_{-\infty}^\infty \frac{1}{1 + x^2} dx = \pi$$ is a trivial integral

The integral itself, after a simple substitution that I don't reproduce here, should get the Euler's error function. When I use Maxima and simplify the expression, luckily, it gets a simple formula:

$$f(1) = \pi - \pi \times erf{(\sqrt{-i})}$$

By the other hand, the initial function are also represented by:

$$f(1) = \int_{-\infty}^\infty \frac{\exp{(i(1 + x^2))}}{1 + x^2} dx = exp{(i)} \int_{-\infty}^\infty \frac{\exp{(i x^2)}}{1 + x^2} dx$$

Joining together, it will get:

$$\int_{-\infty}^\infty \frac{\exp{(i x^2)}}{1 + x^2} dx = \pi \exp{(-i)} - \pi \exp{(-i)} \times erf{(\sqrt{-i})}$$

Finally, the final results will be:

$$\int_{-\infty}^\infty \frac{\cos{(x^2)}}{1 + x^2} dx = \Re (\pi \exp{(-i)} - \pi \exp{(-i)} \times erf{(\sqrt{-i})} ) \approx 1.305608$$

$$\int_{-\infty}^\infty \frac{\sin{(x^2)}}{1 + x^2} dx = \Im (\pi \exp{(-i)} - \pi \exp{(-i)} \times erf{(\sqrt{-i})} ) \approx 0.723571$$

Using the reference from Wikipedia about Fresnel Functions are Error Function, luckily, we obtain: $$C(1) + i S(1) = \sqrt{\frac{\pi}{2}} \frac{(1 + i)}{2} erf(\sqrt{- i})$$

Where:

$$C(1) = \int_0^1 \cos(x^2) dx$$

$$S(1) = \int_0^1 \sin(x^2) dx$$

And the real and imaginary parts of the Error's function can be separated, resulting:

$$\int_{-\infty}^\infty \frac{\cos{(x^2)}}{1 + x^2} dx = \pi \cos{(1)} - \frac{\sqrt{8 \pi} [S(1)(\sin(1) + \cos(1)) + C(1)(\cos(1)-\sin(1))]}{2}$$

$$\int_{-\infty}^\infty \frac{\sin{(x^2)}}{1 + x^2} dx = -\pi \sin{(1)} - \frac{\sqrt{8 \pi} [S(1)(\cos(1) - \sin(1)) - C(1)(\cos(1)+\sin(1))]}{2}$$

Here we will address your integrals: $$$$A = \int_{-\infty}^{\infty}\frac{\sin\left(x^2\right)}{x^2 + 1}\:dx = 2 \int_{0}^{\infty}\frac{\sin\left(x^2\right)}{x^2 + 1}\:dx\qquad D = \int_{-\infty}^{\infty}\frac{\cos\left(x^2\right)}{x^2 + 1}\:dx = \int_{0}^{\infty}\frac{\cos\left(x^2\right)}{x^2 + 1}\:dx\nonumber$$$$ Here we employ Feynman's Trick by letting $$$$J(t) = \int_{0}^{\infty}\frac{\sin\left(tx^2\right)}{x^2 + 1}\:dx\qquad H(t) = \int_{0}^{\infty}\frac{\cos\left(tx^2\right)}{x^2 + 1}\:dx\nonumber$$$$ We see $$J(1) = \frac{1}{2}A$$ and $$H(1) = \frac{1}{2}D$$

We proceed by taking the Laplace Transform of $$J(t)$$ with respect to $$t$$: \begin{align} \mathscr{L}_{t \rightarrow s}\left[J(t) \right] &= \int_{0}^{\infty}\frac{\mathscr{L}_{t \rightarrow s}\left[\sin\left(tx^2\right)\right]}{x^2 + 1}\:dx = \int_{0}^{\infty}\frac{x^2}{s^2 + x^4} \frac{1}{x^2 + 1}\:dx = \int_{0}^{\infty}\frac{x^2}{\left(s^2 + x^4\right)\left(x^2 + 1\right)}\:dx \nonumber \\ &= \frac{1}{s^2 + 1} \int_{0}^{\infty}\left[ \frac{x^2}{x^4 + s^2} + \frac{s^2}{x^4 + s^2} - \frac{1}{x^2 + 1} \right]\:dx \nonumber \\ &= \frac{1}{s^2 + 1} \left[ \int_{0}^{\infty} \frac{x^2}{x^4 + s^2}\:dx + s^2\int_{0}^{\infty}\frac{1}{x^4 + s^2}\:dx -\int_{0}^{\infty}\frac{1}{x^2 + 1}\:dx \right] \end{align} We now employ the following result (as detailed here): $$$$\int_0^\infty \frac{t^k}{\left(t^n + a\right)^m}\:dt = \frac{1}{n}a^{\frac{k + 1}{n} - m} B\left(m - \frac{k + 1}{n}, \frac{k + 1}{n}\right)$$$$ Thus, \begin{align} \mathscr{L}_{t \rightarrow s}\left[J(t) \right] &= \frac{1}{s^2 + 1} \left[ \int_{0}^{\infty} \frac{x^2}{x^4 + s^2}\:dx + s^2\int_{0}^{\infty}\frac{1}{x^4 + s^2}\:dx - \int_{0}^{\infty}\frac{1}{x^2 + 1}\:dx \right] \nonumber \\ &= \frac{1}{s^2 + 1} \bigg[ \frac{1}{4}\cdot\left(s^2\right)^{\frac{2 + 1}{4} - 1} \cdot B\left(1 - \frac{2 + 1}{4}, \frac{2 + 1}{4} \right) + s^2 \cdot \frac{1}{4}\cdot \left(s^2\right)^{\frac{0 + 1}{4} - 1} \cdot B\left(1 - \frac{0 + 1}{4}, \frac{0 + 1}{4} \right) - \frac{\pi}{2}\bigg] \nonumber \\ &= \frac{1}{s^2 + 1}\left[ \frac{1}{4\sqrt{s}}B\left(1 - \frac{3}{4}, \frac{3}{4} \right) + \frac{\sqrt{s}}{4}B\left(1 - \frac{1}{4}, \frac{1}{4} \right) - \frac{\pi}{2}\right] \nonumber \\ &= \frac{1}{4}B\left(1 - \frac{3}{4}, \frac{3}{4} \right) \frac{1}{\sqrt{s}\left(s^2 + 1\right)} + \frac{1}{4}B\left(1 - \frac{3}{4}, \frac{3}{4} \right) \frac{\sqrt{s}}{\left(s^2 + 1\right)} - \frac{\pi}{2} \frac{1}{\left(s^2 + 1\right)} \end{align} We now employ the identity: $$$$B\left(1 - z, z\right) = \frac{\pi}{\sin(\pi z)}\nonumber$$$$ Where $$z \not \in \mathbb{Z}^{-}$$. Thus, \begin{align} \mathscr{L}_{t \rightarrow s}\left[J(t) \right] &= \frac{1}{4}\cdot \frac{\pi}{\sin\left(\frac{\pi}{4}\right)} \frac{1}{\sqrt{s}\left(s^2 + 1\right)} + \frac{1}{4}\frac{\pi}{\sin\left(\frac{3\pi}{4}\right)} \frac{1}{\sqrt{s}\left(s^2 + 1\right)} - \frac{\pi}{2} \frac{1}{\left(s^2 + 1\right)} \nonumber \\ &= \frac{\sqrt{2}\pi}{4}\frac{1}{\sqrt{s}\left(s^2 + 1\right)} + \frac{\sqrt{2}\pi}{4}\frac{\sqrt{s}}{s^2 + 1} - \frac{\pi}{2}\frac{1}{s^2 + 1} \end{align} To resolve $$J(t)$$ we now take the inverse Laplace Transform: \begin{align} J(t) &= \frac{\sqrt{2}\pi}{4}\mathscr{L}_{s \rightarrow t}^{-1}\left[\frac{1}{\sqrt{s}\left(s^2 + 1\right)}\right] + \frac{\sqrt{2}\pi}{4}\mathscr{L}_{s \rightarrow t}^{-1}\left[\frac{\sqrt{s}}{s^2 + 1}\right] - \frac{\pi}{2}\mathscr{L}_{s \rightarrow t}^{-1}\left[\frac{1}{s^2 + 1}\right] \nonumber \\ &=\pi 2^{- \frac{3}{2}}\left(I_1 + I_2\right) -\frac{\pi}{2}\sin(t) \end{align} We now address $$I_1$$ and $$I_2$$ individually. We will address both with the convolution theorem: $$$$\mathscr{L}_{s \rightarrow t}^{-1} \left[F(s)G(s) \right] = \int_0^t f( \tau)g(t - \tau)\:d\tau\nonumber$$$$ Here for $$I_1$$: \begin{align} F(s) &= \frac{1}{\sqrt{s}} & f(t) &= \frac{1}{\sqrt{\pi}\sqrt{t}} \nonumber \\ G(s) &= \frac{1}{s^2 + 1} & g(t) &= \sin(t) \nonumber \end{align} And so $$I_1$$ becomes: $$$$I_1 = \int_0^t \frac{1}{\sqrt{\pi}\sqrt{\tau}} \sin(t - \tau)\:d\tau = \frac{1}{\sqrt{\pi}}\left[ \sin(t)\int_0^t \frac{\cos(\tau)}{\sqrt{\tau}}\:d\tau - \cos(t)\int_0^t \frac{\sin(\tau)}{\sqrt{\tau}}\:d\tau\right] \nonumber$$$$ For $$I_2$$ we first reposition the expression into the form: $$$$I_2 = \mathscr{L}_{s \rightarrow t}^{-1}\left[ \frac{\sqrt{s}}{s^2 + 1} \right] = \mathscr{L}_{s \rightarrow t}^{-1}\left[ \frac{1}{\sqrt{s}}\cdot\frac{s}{s^2 + 1} \right]$$$$ Here for $$I_2$$: \begin{align} F(s) &= \frac{1}{\sqrt{s}} & f(t) &= \frac{1}{\sqrt{\pi}\sqrt{t}} \nonumber \\ G(s) &= \frac{s}{s^2 + 1} & g(t) &= \cos(t) \nonumber \end{align} And so $$I_2$$ becomes: $$$$I_2 = \int_0^t \frac{1}{\sqrt{\pi}\sqrt{\tau}} \cos(t - \tau)\:d\tau = \frac{1}{\sqrt{\pi}}\left[ \cos(t)\int_0^t \frac{\cos(\tau)}{\sqrt{\tau}}\:d\tau + \sin(t)\int_0^t \frac{\sin(\tau)}{\sqrt{\tau}}\:d\tau\right]$$$$ We now return to $$J(t)$$: \begin{align} J(t) &= \pi 2^{- \frac{3}{2}}\left(I_1 + I_2\right) -\frac{\pi}{2} \sin(t) \nonumber \\ &= \pi 2^{- \frac{3}{2}}\left(\frac{1}{\sqrt{\pi}}\left[ \sin(t)\int_0^t \frac{\cos(\tau)}{\sqrt{\tau}}\:d\tau - \cos(t)\int_0^t \frac{\sin(\tau)}{\sqrt{\tau}}\:d\tau\right] + \frac{1}{\sqrt{\pi}}\left[ \cos(t)\int_0^t \frac{\cos(\tau)}{\sqrt{\tau}}\:d\tau + \sin(t)\int_0^t \frac{\sin(\tau)}{\sqrt{\tau}}\:d\tau\right]\right) -\frac{\pi}{2} \sin(t) \nonumber \\ &= \sqrt{\pi} 2^{- \frac{3}{2}}\left[ \left(\sin(t) + \cos(t) \right)\int_0^t \frac{\cos(\tau)}{\sqrt{\tau}}\:d\tau + \left(\sin(t) - \cos(t) \right)\int_0^t \frac{\sin(\tau)}{\sqrt{\tau}}\:d\tau \right] -\frac{\pi}{2} \sin(t)\nonumber \\ &= \sqrt{\pi} 2^{- \frac{3}{2}}\left[ \sqrt{2}\sin\left(t + \frac{\pi}{4}\right)\int_0^t \frac{\cos(\tau)}{\sqrt{\tau}}\:d\tau + \sqrt{2}\sin\left(t - \frac{\pi}{4}\right)\int_0^t \frac{\sin(\tau)}{\sqrt{\tau}}\:d\tau \right] -\frac{\pi}{2} \sin(t)\nonumber \\ &= \frac{\sqrt{\pi}}{2}\left[\sin\left(t + \frac{\pi}{4}\right)\int_0^t \frac{\cos(\tau)}{\sqrt{\tau}}\:d\tau + \sin\left(t - \frac{\pi}{4}\right)\int_0^t \frac{\sin(\tau)}{\sqrt{\tau}}\:d\tau \right]-\frac{\pi}{2} \sin(t) \end{align} For each of the integrals for $$J(t)$$ let $$\tau = u^2$$: \begin{align} J(t) &= \frac{\sqrt{\pi}}{2}\left[2\sin\left(t + \frac{\pi}{4}\right)\int_0^\sqrt{t} \cos\left(u^2\right) \:du + 2\sin\left(t - \frac{\pi}{4}\right)\int_0^\sqrt{t} \sin\left(u^2\right)\:du \right] -\frac{\pi}{2} \sin(t) \nonumber \\ &= \sqrt{\pi}\left[\sin\left(t + \frac{\pi}{4}\right)\int_0^\sqrt{t} \cos\left(u^2\right) \:du + \sin\left(t - \frac{\pi}{4}\right)\int_0^\sqrt{t} \sin\left(u^2\right)\:du \right] -\frac{\pi}{2} \sin(t)\nonumber \\ &= \sqrt{\pi}\left[\sin\left(t + \frac{\pi}{4}\right)C\left(\sqrt{t} \right) + \sin\left(t - \frac{\pi}{4}\right)S\left(\sqrt{t}\right) \right] -\frac{\pi}{2} \sin(t)\nonumber \end{align} Where $$S(a), C(a)$$ are the Fresnel Integrals. We now can finally solve $$A$$ using $$2J(1) = A$$. Thus, $$$$2J(1) = A = \int_{-\infty}^{\infty}\frac{\sin\left(x^2\right)}{x^2 + 1}\:dx = 2\sqrt{\pi}\left[\sin\left(1 + \frac{\pi}{4}\right)C\left(1\right) + \sin\left(1 - \frac{\pi}{4}\right)S\left(1\right) \right] -\pi \sin(1)\nonumber$$$$

Now to solve $$D$$ we could take the same approach or differentiate $$J(t)$$. I'm too lazy to do it.