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.


3 Answers 3


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.

  • 27
    $\begingroup$ Wow! What an answer... $\endgroup$
    – t.b.
    Apr 23, 2011 at 20:21
  • 5
    $\begingroup$ I will update the list as I think of more interesting solutions. $\endgroup$ Apr 23, 2011 at 21:46
  • 3
    $\begingroup$ That's extraordinary. Well said. $\endgroup$
    – davidlowryduda
    Apr 24, 2011 at 6:38
  • 2
    $\begingroup$ 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). $\endgroup$
    – t.b.
    Apr 24, 2011 at 9:26
  • 4
    $\begingroup$ @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). $\endgroup$ Apr 20, 2016 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.

  • 3
    $\begingroup$ Should that be $a= \frac{1}{2}\sqrt2(1+i)\sqrt\pi$ ? $\endgroup$ Apr 23, 2011 at 20:28
  • 1
    $\begingroup$ @John: Yes, thank you for paying attention! Fixed. $\endgroup$
    – t.b.
    Apr 23, 2011 at 20:31
  • 1
    $\begingroup$ 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. $\endgroup$
    – robjohn
    Mar 5, 2012 at 17:01
  • $\begingroup$ I've got the same question at homework now and just for the final answer do i have to take the real part of the residue of g? $\endgroup$
    – convxy
    Jun 12, 2020 at 12:27

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


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .