# Generalizing the trick for integrating $\int_{-\infty}^\infty e^{-x^2}dx$?

There is a well-known trick for integrating $\int_{-\infty}^\infty e^{-x^2}dx$, which is to write it as $\sqrt{\int_{-\infty}^\infty e^{-x^2}dx\int_{-\infty}^\infty e^{-y^2}dy}$, which can then be reexpressed in polar coordinates as an easy integral. Is this trick a one-hit wonder, or are there other cases where this trick works and is also necessary? It seems to depend on the defining property of the exponential function that $f(a+b)=f(a)f(b)$, which would make me think that it would only allow fairly trivial generalizations, e.g., to $\int_{-\infty}^\infty 7^{-x^2}dx$ or $\int_{-\infty}^\infty a^{bx^2+cx+d}dx$.

Can it be adapted through rotation in the complex plane to do integrals like $\int_{-\infty}^\infty \sin(x^2)dx$? Here I find myself confused by trying to simultaneously visualize both the complex plane and the $(x,y)$ plane.

WP http://en.wikipedia.org/wiki/Gaussian_integral discusses integrals that have a similar form and seem to require different methods, but I'd be more interested in integrals that have different forms but can be conquered by the same trick.

The trick involves expanding from 1 dimension to 2. Is there a useful generalization where you expand from $m$ dimensions to $n$?

This is not homework.

-
Once you know the answer for that gaussian integral, you can use differentiation under integral sign (en.wikipedia.org/wiki/Differentiation_under_the_integral_sign) to solve very similar and much more complicated ones. –  Robert Smith Feb 3 '12 at 5:28
Robert Dawson wrote about the limits of this method: cs.smu.ca/~dawson/Poisson.pdf –  Byron Schmuland Feb 3 '12 at 5:29
@ByronSchmuland: If you make this an answer, I'll accept it. The only thing I'm slightly vague on is what Dawson means by "of the form." E.g., does he consider $e^{ax^2+bx+c}$ to be "of the form" $ke^{ax^2}$? He also only considers the reals, which makes me wonder about the complex rotation issue, which might lead to integrals like $\int_{-\infty}^\infty \sin(x^2)dx$. –  Ben Crowell Feb 3 '12 at 5:42
@Ben: If you rewrite $ax^2+bx+c$ as $a(x-b)^2+h$ and $k=e^h$, then it's an obvious translate of the function $ke^{ax^2}$. –  anon Feb 3 '12 at 5:45
@BenCrowell Well, the Wikipedia article I linked before has plenty of examples but taking your Gaussian integral as a starting point, take a look at math.uconn.edu/~kconrad/blurbs/analysis/diffunderint.pdf (page 6, higher moments of the Gaussian). However, the point being that this "technique" works fine in a wide variety of situations. –  Robert Smith Feb 3 '12 at 5:55

I would like to answer to your question about Fresnel integral as I did this in my undergraduate studies. So, let us consider the integrals

$$S_1=\int_{-\infty}^\infty dx\sin(x^2) \qquad C_1=\int_{-\infty}^\infty dx\cos(x^2).$$

We want to apply the same technique used for Gauss integral in this case and consider the two-dimensional integrals

$$S_2=\int_{-\infty}^\infty\int_{-\infty}^\infty dxdy\sin(x^2+y^2) \qquad C_2=\int_{-\infty}^\infty\int_{-\infty}^\infty dxdy\cos(x^2+y^2).$$

If you go to polar coordinates, these integrals doe not converge. So, we introduce a convergence factor in the following way

$$S_2(\epsilon)=\int_{-\infty}^\infty\int_{-\infty}^\infty dxdy e^{-\epsilon(x^2+y^2)}\sin(x^2+y^2)$$ $$C_2(\epsilon)=\int_{-\infty}^\infty\int_{-\infty}^\infty dxdy e^{-\epsilon(x^2+y^2)}\cos(x^2+y^2).$$

Then one has, moving to polar coordinates,

$$S_2(\epsilon)=2\pi\int_0^\infty \rho d\rho e^{-\epsilon\rho^2}\sin(\rho^2) \qquad C_2(\epsilon)=2\pi\int_0^\infty \rho d\rho e^{-\epsilon\rho^2}\cos(\rho^2)$$

that is

$$S_2(\epsilon)=\pi\int_0^\infty dx e^{-\epsilon x}\sin(x) \qquad C_2(\epsilon)=\pi\int_0^\infty dx e^{-\epsilon x}\cos(x).$$

These integrals are well known and give

$$S_2(\epsilon)=\frac{\pi}{1+\epsilon^2} \qquad C_2(\epsilon)=\frac{\epsilon\pi}{1+\epsilon^2}$$

noting that integration variables are dummy. Now, in this case one can take the limit for $\epsilon\rightarrow 0$ producing

$$S_2=\int_{-\infty}^\infty\int_{-\infty}^\infty dxdy\sin(x^2+y^2)=\pi \qquad C_2=\int_{-\infty}^\infty\int_{-\infty}^\infty dxdy\cos(x^2+y^2)=0$$

By applying simple trigonometric formulas you will get back the value of the Fresnel integrals. But now, as a bonus, you have got the value of these integrals in two dimensions.

-
Great answer! Are you sure the $S_2=\pi$ at the end shouldn't be $S_2=\pi/4$? Let $S_1=\int_0^\infty \sin(x^2)dx$ and similarly for $C_1$. Then $C_2=0$ tells us that $S_1=\pm C_1$, so that with $S_2=2C_1S_1$ I get $C_1=S_1=\sqrt{S_2/2}$, which would seem to require $S_2=\pi/4$ in order to produce the correct result $S_1=C_1=\sqrt{\pi/8}$. Is it possible that your value of $\pi$ is for $\int_{-\infty}^\infty \int_{-\infty}^\infty$? –  Ben Crowell Feb 3 '12 at 16:30
@BenCrowell: Of course you are right. I fix it. –  Jon Feb 3 '12 at 17:38

Robert Dawson wrote about the limitations of this method in this article in the American Mathematical Monthly.

-

The distance metric that we use is quadratic in nature. No matter what dimensional $\mathbb{R}^n$ we are working in, the distance between two points is given by $r^2=\sum(\Delta x_i)^2$. It's the ability to swap out $\sum(\Delta x_i)^2$ with $r^2$ that helps compute $\int_{-\infty}^{\infty}e^{-x^2}\,dx$. No higher dimensional space will make this particular exchange any nicer. So this helps explain why the property you mention ($f(x^2)f(y^2)=f(x^2+y^2)$) is important.

On the other hand, what happens here is an exchange between Cartesian coordinates for $\mathbb{R}^2$ and polar coordinates. So could we do something similar in $\mathbb{R}^3$ with spherical coordinates?

$$\left(\int_{\mathbb{R}}f(x)\,dx\right)^3=\iiint_{\mathbb{R}^3} f(x)f(y)f(z)\,dxdydz=\iiint_{\mathbb{R}^3} F(\rho,\theta,\varphi)\,d\rho d\theta d\varphi$$

If $F$ breaks up as $g(\rho)h(\theta)k(\varphi)$, then you might have a slick way to compute $\int_{\mathbb{R}}f(x)\,dx$.

-
To answer the question in the first paragraph: Yes the exact same trick works for both $\int_{-\infty}^\infty 7^{-x^2}dx$ and $\int_{-\infty}^\infty a^{bx^2+cx+d}dx$, provided $b<0$. (The second generalizes the first, so we need only consider it). First, complete the square for the quadratic, and write $$bx^2+cx+d=b\left(x^2+\frac{c}{b}x+\frac{d}{b}\right)=b\left(x+\frac{c}{2b}\right)^2-\frac{c}{4b}+d.$$ Then our integral is $$a^{d-\frac{c}{4b}} \int_{-\infty}^\infty e^{\log(a)b\left(x+\frac{c}{2b}\right)^2}dx.$$ Since we are integrating over the real line, we may shift by $\frac{c}{2b}$ and then let $u=\sqrt{-b\log a}x$ (remember, $b<0$) to get $$a^{d-\frac{c}{4b}} \int_{-\infty}^\infty e^{\log(a)bx^2}dx=\frac{a^{d-\frac{c}{4b}}}{\sqrt{-b\log a}} \int_{-\infty}^\infty e^{-u^2}dx$$
$$=\frac{a^{d-\frac{c}{4b}}}{\sqrt{-b\log a}}\sqrt{\pi}.$$