Computing the integral $\int \exp(ix^2) dx$ I'm trying to compute the following integral: $I_1 =  \int_{-\infty}^\infty \exp(iu^2) du$. 
This is what I did, but it is wrong and I don't know why:
$$I_1^2 = \left (\int_{-\infty}^\infty \exp(iu^2) du \right)^2 = \int_{-\infty}^{\infty} \exp(iu^2) du \int_{-\infty}^{\infty} \exp(iv^2) dv = \iint_{\mathbb{R}^2} \exp{i(v^2+y^2)} dA$$
Using polar coordinates:
$$I_1^2 = \lim_{c\to \infty} \int_0^{2\pi} d\varphi \int_0^{c} \exp(ir^2) r dr$$
But the last integral doesn't converge. What is wrong here?
 A: In the last equality of the second equation, you tried to utilize Fubini's theorem. But the issue is that the integral is only conditionally convergent. So in principle, you cannot apply Fubini's theorem to convert your iterated improper integral into the double integral.
Assuming that you have already established the existence of $I$, here are two workarounds that savages your approach. Notice that both methods approximate the original integral by absolutely convergent ones so that Fubini's theorem is applicable.
Method 1. Consider the truncated version
$$ I_R = \int_{-R}^{R} e^{ix^2} \, dx. $$
Then by Fubini's theorem, we have
$$ I_R^2 = \iint_{[-R,R]^2} e^{i(x^2+y^2)} \, dxdy. $$
Divide the square region $[-R,R]^2$ into 4 congruent pieces along lines $y = x$ and $y = -x$. This will result in 4 integrals. Exploiting the symmetry, it is easy to check that these 4 integrals have identical values, so you can also write:
$$ I_R^2 = 4 \iint\limits_{\substack{0 \leq x \leq R \\ |y| \leq R}} e^{i(x^2+y^2)} \, dxdy.$$
Now converting this integral using polar coordinates, we get
$$I_R^2 = 4 \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} \int_{0}^{R\sec\theta} e^{ir^2} \, rdrd\theta = 2i \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} (1 - e^{iR^2\sec^2\theta}) \, d\theta. $$
As $R \to\infty$, Riemann-Lebesgue lemma shows that this integral converges to
$$ I^2 = \lim_{R\to\infty} I_R^2 = 2i \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}} \, d\theta = i\pi. $$
This determines $I$ up to sign, but it is not hard to check that $\operatorname{Im}(I) > 0$. Thus the only possible choice is
$$I = \sqrt{i\pi} = (1+i)\sqrt{\frac{\pi}{2}}. $$
Method 2. Alternatively, you can use Gaussian regularization:
$$ I = \lim_{\epsilon \downarrow 0} I_{\epsilon} \quad \text{where} \quad I_{\epsilon} = \int_{-\infty}^{\infty} e^{ix^2}e^{-\epsilon x^2} \, dx. $$
Then $I_{\epsilon}^2$ is absolutely convergent and Fubini's therorem followed by polar coordinates change gives
$$ I_{\epsilon}^2 = \int_{0}^{2\pi} \int_{0}^{\infty} e^{-(\epsilon-i)r^2} \, rdrd\theta = \frac{\pi}{\epsilon - i}. $$
This converges to $\pi i$ as $\epsilon \downarrow 0$ and you can proceed from here as in Method 1.

Existence of $I$. So here is one way to establish the existence of $I$. A moment of thought tells us that it suffices to show the convergence of $\int_{1}^{\infty} e^{ix^2} \, dx$. Let $R > 1$. The usual trick is to improve the speed of convergence:
$$ \int_{1}^{R} e^{ix^2} \, dx \ \stackrel{u=x^2}{=} \int_{1}^{R^2} \frac{e^{iu}}{2\sqrt{u}} \, du. $$
Applying integration by parts,
$$ \int_{1}^{R} e^{ix^2} \, dx = \left[ \frac{e^{iu}}{2i\sqrt{u}} \right]_{1}^{R} + \int_{1}^{R} \frac{e^{iu}}{4iu^{3/2}} \, du. $$
Now the integral on the right-hand side is absolutely convergent and we are done.
Another method is as follows: Write
$$ \int_{1}^{R} e^{ix^2} \, dx = \bigg( \sum_{k = 0}^{\lfloor R^2/\pi \rfloor - 1} \int_{\sqrt{\pi k}}^{\sqrt{\smash[b]{\pi(k+1)}}} e^{ix^2} \, dx \bigg) + \int_{\sqrt{\pi \smash[b]{\lfloor R^2/\pi \rfloor}}}^{R} e^{ix^2} \, dx. $$
Then you can show that the sum converges by applying the alternating series test both to the real part and to the imaginary part. The error term can be shown to vanish as $R \to \infty$ as well.

Here we prove the following claim:

Proposition. Suppose that $f : \Bbb{R} \to \Bbb{C}$ is locally integrable on $\Bbb{R}$ and is improperly integrable on $\Bbb{R}$ in the sense that the limit
  $$ I(0) := \lim_{\substack{a \to -\infty \\ b \to \infty}} \int_{a}^{b} f(x) \, dx $$
  converges. Then for each $\epsilon > 0$, the integral
  $$ I(\epsilon) := \int_{-\infty}^{\infty} f(x)e^{-\epsilon x^2} \, dx $$
  is well-defined and $I(0) = \lim_{\epsilon \to 0^+} I(\epsilon)$.

The proof is quite standard and easy. Let $F : \Bbb{R} \to \Bbb{C}$ be defined by
$$ F(x) = \int_{0}^{x} f(t) \, dt. $$
Then the assumptions tells us the following things:


*

*Both $F(\infty) := \lim_{b\to\infty} F(b)$ and $F(-\infty) := \lim_{a\to-\infty} F(a)$ converge,

*$F$ is bounded, and

*$I(0) = F(\infty) - F(-\infty)$.


Now, from integration by parts,
$$ \int_{a}^{b} f(x) e^{-\epsilon x^2} \, dx
= \left[ F(x)e^{-\epsilon x^2} \right]_{a}^{b} + \int_{a}^{b} 2\epsilon x F(x) e^{-\epsilon x^2} \, dx. $$
Taking $(a, b) \to (-\infty, \infty)$, dominated convergence theorem shows the above integral converges and
\begin{align*}
I(\epsilon)
= \int_{-\infty}^{\infty} f(x) e^{-\epsilon x^2} \, dx
&= \int_{-\infty}^{\infty} 2\epsilon x F(x) e^{-\epsilon x^2} \, dx \\
&= \int_{-\infty}^{\infty} 2u F(\epsilon^{-1/2}u) e^{-u^2} \, du,
\end{align*}
where the substitution $u = \sqrt{\epsilon}x$ is used in the last line. Now we focus on the last integral and notice that the integrand is dominated by $C|u|e^{-u^2}$ for some absolute constant $C \geq 0$, which is integrable. (Here, $C = 2 \sup_{x\in\Bbb{R}} |F(x)| < \infty$ works for the proof.) Therefore, by the dominated convergence theorem,
\begin{align*}
\lim_{\epsilon \to 0^+} I(\epsilon)
&= \int_{-\infty}^{\infty} \lim_{\epsilon \to 0^+} 2u F(\epsilon^{-1/2}u) e^{-u^2} \, du \\
&= \int_{-\infty}^{0} 2u F(-\infty) e^{-u^2} \, du + \int_{0}^{\infty} 2u F(\infty) e^{-u^2} \, du \\
&= F(\infty) - F(-\infty) = I(0).
\end{align*}
A: This and related ones are known as Fresnel Integrals,  see HERE
to find that (improper Riemann integrals)
$$
\int_{-\infty}^\infty e^{ix^2}dx = 
\int_{-\infty}^\infty \cos(x^2)\;dx + i\int_{-\infty}^\infty \sin(x^2)\;dx
= (1+i)\sqrt\frac{\pi}{2}
$$
A: $\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

The integral is a Fresnel one. Usually, it's evaluated in a
  'pizza-slice' closed contour wich subtends a $\ds{\pi/4}$-angle in the complex plane first quadrant ( details can be seen elsewhere ). Since there are not any poles inside such contour, the integral along $\ds{\pars{0,\infty}}$
  satisfies:

\begin{align}
\int_{0}^{\infty}\expo{\ic x^{2}}\dd x & =
\lim_{r \to \infty}\bracks{-\int_{0}^{\pi/2}
\exp\pars{\ic\bracks{r\expo{\ic\theta}}^{2}}r\expo{\ic\theta}\ic\,\dd\theta -
\int_{r}^{0}\exp\pars{\ic\bracks{\xi\expo{\pi\ic/4}}^{2}}\expo{\pi\ic/4}\dd\xi}
\\[5mm] & =
-\ic\,\overbrace{\lim_{r \to \infty}\int_{0}^{\pi/2}\exp\pars{\ic r^{2}\cos\pars{2\theta}}
\exp\pars{-r^{2}\sin\pars{2\theta}}r\expo{\ic\theta}\dd\theta}^{\ds{=\ 0}}
\\[5mm] &
\mbox{} + \expo{\pi\ic/4}\
\underbrace{\int_{0}^{\infty}\expo{-\xi^{2}}\,\dd\xi}
_{\ds{=\ {\root{\pi} \over 2}}}\ =\
\bbox[8px,border:0.1em groove navy]{{\root{\pi} \over 2}\,\expo{\pi\ic/4}}
\end{align}

Note that

\begin{align}
0 & < \verts{\int_{0}^{\pi/2}\exp\pars{\ic r^{2}\cos\pars{2\theta}}
\exp\pars{-r^{2}\sin\pars{2\theta}}r\expo{\ic\theta}\dd\theta} <
\int_{0}^{\pi/2}\exp\pars{-r^{2}\sin\pars{2\theta}}r\,\dd\theta
\\[5mm] & =
{1 \over 2}\,r\int_{0}^{\pi}\exp\pars{-r^{2}\sin\pars{\theta}}\dd\theta =
r\int_{0}^{\pi/2}\exp\pars{-r^{2}\sin\pars{\theta}}\dd\theta <
r\int_{0}^{\pi/2}\exp\pars{-\,{2r^{2} \over \pi}\,\theta}\dd\theta
\\[5mm] & =
{\pi \over 2}\,{1 - \expo{-r^{2}} \over r}\,\,\,\stackrel{r\ \to\ \infty}{\to} 0
\end{align}
