Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Inspired by this recently closed question, I'm curious whether there's a way to do the Gaussian integral using techniques in complex analysis such as contour integrals.

I am aware of the calculation using polar coordinates and have seen other derivations. But I don't think I've ever seen it done with methods from complex analysis. I am ignorant enough about complex analysis to believe it can somehow be done without knowing how it would be done.

share|cite|improve this question
up vote 127 down vote accepted

What follows is a list of solutions that I enjoy, and use complex analysis either implicitly or explicitly. I will update the list as I come up with more. (Note: Solution 4 is my favorite, and is completely complex analysis oriented. I also quite like Solution 6.)

First, let $u=x^{2}$, $du=2xdx$. Then our integral becomes $$\int_{-\infty}^\infty e^{-x^2}dx=\int_{0}^{\infty}u^{-\frac{1}{2}}e^{-u}du=\Gamma\left(\frac{1}{2}\right).$$ where $\Gamma(s)$ is the Gamma function.

Solution 1: Since $$\Gamma(1-s)\Gamma(s)=\frac{\pi}{\sin\pi s}$$ for all complex $s$, we conclude $$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$

Solution 2: Recall the Beta function, $$\text{B}(x,y)=\int_{0}^{1}t^{x-1}(1-t)^{y-1}dt=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}.$$ Setting $x=y=\frac{1}{2}$ we have

$$ \left(\Gamma\left(\frac{1}{2}\right)\right)^{2}=\int_{0}^{1}\frac{1}{\sqrt{t(1-t)}}dt.$$

To evaluate this, set $t=\sin^{2}(x)$ to find $$\left(\Gamma\left(\frac{1}{2}\right)\right)^{2}=\int_{0}^{\frac{\pi}{2}}\frac{2\sin x\cos x}{\sin x\cos x}dt=\pi.$$ Alternatively, we could evaluate the last integral by choosing branch's such that the integrand is analytic on $\mathbb{C}-[0,1]$ and then integrating around this cut. (The residue then comes from the residue at infinity)

Solution 3: Setting $s=\frac{1}{2}$ in the duplication formula, $$\Gamma(s)\Gamma\left(s+\frac{1}{2}\right)=\sqrt{\pi}2^{1-2s}\Gamma(2s),$$ yields $$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$

Solution 4: My personal favorite: Recall the functional equation for the zeta function, namely that $$\pi^{-\frac{z}{2}}\Gamma\left(\frac{z}{2}\right)\zeta(z)=\pi^{-\frac{1-z}{2}}\Gamma\left(\frac{1-z}{2}\right)\zeta(1-z).$$ Taking the limit as $z\rightarrow1$, we know that $\zeta(z)\sim\frac{1}{z-1}$ and $\Gamma\left(\frac{1-z}{2}\right)\sim2\frac{1}{\left(z-1\right)}$ so that we must have the equality $$\pi^{-\frac{1}{2}}\Gamma\left(\frac{1}{2}\right)=2\zeta(0).$$ By taking the limit in the right half plane as $s\rightarrow0$ using the identity $$\zeta(s)=\frac{s}{s-1}-s\int_{1}^{\infty}\{u\}u^{-s}du,$$ which holds for $\sigma>0$, we can find that $\zeta(0)=\frac{1}{2}.$ (notice the pole/zero cancellation). Consequently $$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$

Solution 5: From complex integration, for $a,b>0$ we have the identity $$\int_{-\infty}^{\infty}(1-ix)^{-a}(1+ix)^{-b}dx=\frac{2^{2-a-b}\pi\Gamma(a+b-1)}{\Gamma(a)\Gamma(b)}.$$ Set $a=\frac{1}{2},b=\frac{3}{2}$ to find that $$ \int_{-\infty}^{\infty}\frac{1-ix}{\left(1+x^{2}\right)^{\frac{3}{2}}}dx=\frac{2\pi}{\Gamma\left(\frac{1}{2}\right)^{2}}.$$ Hence $$\int_{0}^{\infty}\frac{1}{\left(1+x^{2}\right)^{\frac{3}{2}}}dx=\frac{\pi}{\Gamma\left(\frac{1}{2}\right)^{2}}.$$ Since the integrand on left hand side has anti derivative $\frac{x}{\sqrt{x^{2}+1}}+C$, it follows that the integral is $1$ and hence$$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$

Solution 6: More with the Beta function. Consider the Mellin Transform $$\mathcal{M}\left(\frac{1}{\left(1+t\right)^{a}}\right)(z):=\int_{0}^{\infty}\frac{t^{z-1}}{(1+t)^{a}}dt=\text{B}(a-z,z).$$ The last equality follows by substituting $v=\frac{1}{1+t}$, and then rewriting the integral as $\int_{0}^{1}v^{a-z-1}(1-v)^{z-1}dv.$ Now, plug in $a=1$ and $z=\frac{1}{2}$ to get $$\int_{0}^{\infty}\frac{1}{\sqrt{t}(1+t)}dt=\Gamma\left(\frac{1}{2}\right)^{2}$$ and then let $t=x^{2}$ to find $$ 2\int_{0}^{\infty}\frac{1}{1+x^{2}}dx=\pi=\Gamma\left(\frac{1}{2}\right)^{2}. $$

Solution 7: We can also prove the result by using Stirling's formula. Admittedly, this isn't really using complex analysis, but I find it interesting.

Since $z\Gamma(z)=\Gamma(z+1)$ we see that $$ \Gamma\left(n+\frac{1}{2}\right)=\Gamma\left(\frac{1}{2}\right)\cdot\left(\frac{1}{2}\right)\left(\frac{3}{2}\right)\cdots\left(\frac{2n-1}{2}\right)=\Gamma\left(\frac{1}{2}\right)\left(\frac{(2n)!}{n!4^{n}}\right)=\Gamma\left(\frac{1}{2}\right)\binom{2n}{n}\frac{n!}{4^{n}}. $$ By Stirling's formula, $$ \binom{2n}{n}\frac{1}{4^{n}}\sim\frac{1}{\sqrt{\pi n}}\ \text{as}\ n\rightarrow\infty $$ and $$ \frac{\Gamma\left(n+\frac{1}{2}\right)}{n!}\sim\frac{1}{\sqrt{ne}}\frac{\left(n+\frac{1}{2}\right)^{n}}{n^{n}}. $$ Using the fact that $\lim_{n\rightarrow\infty}\left(1+\frac{a}{n}\right)^{n}=e^{a}$, it then follows that $$ \frac{\Gamma\left(n+\frac{1}{2}\right)}{n!}\sim\frac{1}{\sqrt{n}}. $$ Consequently, taking the limit as $n\rightarrow\infty$ in the formula $$\Gamma\left(\frac{1}{2}\right)=\frac{\Gamma\left(n+\frac{1}{2}\right)}{n!}\frac{4^{n}}{\binom{2n}{n}}$$ yields $$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$

Hope that helps,

Remark: All of the formulas used here can be proven without use the fact that $\Gamma(1/2)=\sqrt{\pi}$, so that none of these are cyclic. This is mainly worth pointing out for $4$.

Edit: I put what were solutions 2 and 3 together since they were not different.

share|cite|improve this answer
Wow! What an answer... – t.b. Apr 23 '11 at 20:21
I will update the list as I think of more interesting solutions. – Eric Naslund Apr 23 '11 at 21:46
That's extraordinary. Well said. – mixedmath Apr 24 '11 at 6:38
There are also some ways to do it using the Fourier transform of the $\vartheta$-function (which is of course also a natural place to look for the desired identity). These are also given in the book of Remmert I linked to. Is there a reason you didn't include such calculations? (Of course, this I don't mean to imply that this great answer needs any improvement whatsoever). – t.b. Apr 24 '11 at 9:26
@user1952009 You shouldn't critize my answer just because you don't know how to prove the identities I used nicely. For (1) The functions $\Gamma(s)\Gamma(1-s)$ and $1/\sin(\pi s)$ both have no zeros and poles at every integer, so the first identity follows directly from the Weierstrass Factorization Theorem. It in no way relies on $\Gamma(1/2)$ as you incorrectly state. As for (4), the functional equation comes from an application of the Poisson summation on $\psi(x)=\sum_{n=1}^\infty e^{-\pi n^2 x}$, and (5) has little to do with (2). – Eric Naslund Apr 20 at 15:57

This needs some trickery since $e^{-z^2}$ has no poles.

The easiest proof I know can be found in Remmert's book (it's in §14.3.3 on page 330 of the German edition, but, as usual, Google doesn't let me look at the page I'm interested in) and seems to be to be due to H. Kneser (since Remmert doesn't give any other source).

So here's the deal:

Put $$g(z) = \frac{e^{-z^2}}{1+ e^{-2az}}\quad \text{with }\quad a = (1+i)\sqrt{\frac{\pi}{2}}.$$ From $a^2 = i\pi$ it is easy to see that $$g(z) - g(z+a) = e^{-z^2}$$ and that the poles of $g$ are simple and located precisely at the points $-\frac{1}{2}a + na$ with $n \in \mathbb{Z}$.

Now integrate the function $g$ over the rectangle with corners $-r,s, s+i\operatorname{Im}(a),-r+i\operatorname{Im}(a)$ with $r,s \gt 0$ real numbers. Observe that the only pole of $g$ inside this rectangle is the one located at $\frac{a}{2}$, and its residue is $$\operatorname{res}_{\frac{a}{2}} g = \frac{e^{-\frac{1}{4}a^2}}{-2ae^{-a^2}} = \frac{-i}{2\sqrt{\pi}},$$ using the usual formula $\operatorname{res}_{x} \frac{f}{h} = \frac{f(x)}{h'(x)}$ if $h$ has a simple zero at $x$ and $f(x) \neq 0$.

Using the residue theorem and the periodicity $g(z) - g(z+a) = e^{-z^2}$ one then easily verifies that $$\int_{-\infty}^{\infty} e^{-x^2}\,dx = \lim_{r,s \to \infty} \int_{-r}^{s} e^{-x^2}\,dx = 2\pi i \, \operatorname{res}_{\frac{a}{2}} g = \sqrt{\pi}$$ since the integrals along the vertical sides of the rectangles converge to zero as $r,s \to \infty$.

Remmert also mentions that it was often claimed in the older literature that it was impossible to obtain this formula from the calculus of residues.


Remmert also refers to G. Pólya's article Remarks on Computing the Probability Integral in One and Two Dimensions, Proc. [First] Berkeley Symp. on Math. Statist. and Prob. (Univ. of Calif. Press, 1949), 63-78, where another method is shown: In section 5 of that article (on p. 68f) Pólya integrates the function $e^{i\pi z^2} \tan{(\pi z)}$ over the parallelogram with corners $R+iR$, $-R-iR$, $-R+1-iR$, $R+1+iR$ to derive the desired formula.

share|cite|improve this answer
Should that be $a= \frac{1}{2}\sqrt2(1+i)\sqrt\pi$ ? – John Bentin Apr 23 '11 at 20:28
@John: Yes, thank you for paying attention! Fixed. – t.b. Apr 23 '11 at 20:31
+1 for the solution and the reference. Thanks! – JasonMond Apr 24 '11 at 18:43
Tricky Boy! I was trying to think of a good way to introduce a singularity that could be removed to give the answer. Nicely done. – robjohn Mar 5 '12 at 17:01

$\text{MR}1641980\, (99\text{h}:26002)$

Desbrow, Darrell.

On Evaluating $\displaystyle\int_{-\infty}^\infty e^{ax(x-2b)}\, dx$ by Contour Integration Round a Parallelogram.

Amer. Math. Monthly $105\, (1998)$, no. $8,\, 726–731$.

share|cite|improve this answer
The paper. – J. M. Apr 24 '11 at 13:47

An other way would be:

we know that $$\frac{1}{\sqrt{2\pi}}\int_{-\infty }^\infty e^{-\frac{x^2}{2}}dx=1$$ (normale distribution). Then

$$\int_{-\infty }^\infty e^{-x^2}dx\underset{x=\frac{u}{\sqrt{2}}}{=}\frac{1}{\sqrt{2}}\int_{-\infty }^\infty e^{-\frac{u^2}{2}}du=\sqrt{\pi}\underbrace{\frac{1}{\sqrt{2\pi}}\int_{-\infty }^\infty e^{-\frac{u^2}{2}}du}_{=1}=\sqrt\pi$$

share|cite|improve this answer
if the person who put a downvote could explain why, it would be more constructive !! – idm Sep 2 '14 at 14:36
This is a compensatory upvote – user266519 Dec 21 '15 at 19:23
I'm guessing the downvote was in view of the obvious question: how do we know that fact about the normal distribution? Well, often it's proved starting from the fact that the OP is asking about, in effect running the very elementary calculus manipulations in your answer in reverse order. Meanwhile, there are various ways we know this fact, as mentioned by the OP, but he's asking specifically for a reason based on contour integration. So it seems you are not answering the question that was asked. – user43208 Jan 21 at 18:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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