From the Gaussian Integral to the Gamma Function

The Gaussian integral ∫−∞∞e−t2 dt\int_{-\infty}^{\infty} e^{-t^2}\,dt is usually solved with one trick: square it and switch to polar coordinates. My goal was to see how far the same trick goes if the integrand gets a power of tt in front. What comes out is a relation between Γ(x+1)\Gamma(x+1) and Γ(x+12)\Gamma\left(\frac{x+1}{2}\right), and Γ(12)=π\Gamma\left(\frac{1}{2}\right) = \sqrt{\pi} as a special case.

y=e^{-x^{2}}
The bell curve

Why This Integral

Quick recap for those who may not be familiar with the topic. Let XX be a random variable that follows an unknown distribution D\mathcal{D} with mean μ\mu and variance σ2\sigma^2.

X∼D(μ,σ2)X \sim \mathcal{D}(\mu, \sigma^2)

Take nn samples of XX and average them. Whatever D\mathcal{D} is, the sample mean is normally distributed:

Xˉ∼N(μ,σ2n)\bar{X} \sim \mathcal{N}\left(\mu, \frac{\sigma^2}{n}\right)

This is the central limit theorem. Strictly, it is true as nn goes to infinity; in practice n>30n > 30 is considered enough. The normal distribution is built out of e−t2e^{-t^2}, so this integral sits under a large part of statistics.

Adding a Power of tt

I(k)=∫0∞tke−t2 dt,k∈(−1,∞)I(k) = \int_0^\infty t^k e^{-t^2}\,dt, \qquad k \in (-1, \infty)

The lower bound is 00 because tkt^k is not real for negative tt and non-integer kk. The bound on kk comes from the behaviour near 00: there e−t2≈1e^{-t^2} \approx 1, so the integrand behaves like tkt^k. For k=−1k = -1 that is 1t\frac{1}{t}, and the integral diverges.

k=1
y=x^{k}e^{-x^{2}}\left\{x>0\right\}
Drag k. At k = -1 the area near zero blows up.

Squaring It

Square the integral and write it as a product of two copies with different variables. Two single integrals become one double integral over the first quadrant.

I(k)2=∫0∞xke−x2 dx⋅∫0∞yke−y2 dy=∫0∞∫0∞(xy)ke−(x2+y2) dx dyI(k)^2 = \int_0^\infty x^k e^{-x^2}\,dx \cdot \int_0^\infty y^k e^{-y^2}\,dy = \int_0^\infty \int_0^\infty (xy)^k e^{-(x^2+y^2)}\,dx\,dy

Now switch to polar coordinates: x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\theta. The first quadrant is r∈[0,∞)r \in [0, \infty), θ∈[0,π2]\theta \in [0, \frac{\pi}{2}], and x2+y2=r2x^2 + y^2 = r^2.

I(k)2=∫0π/2∫0∞[r2cos⁡θsin⁡θ]ke−r2 r dr dθI(k)^2 = \int_0^{\pi/2} \int_0^\infty \left[r^2 \cos\theta \sin\theta\right]^k e^{-r^2}\, r\,dr\,d\theta

The extra rr before drdr is the Jacobian of the change of variables. It is easy to forget, and the whole result is wrong without it.

Splitting It

The integrand is a product of a function of θ\theta and a function of rr, so the double integral splits into two single ones.

I(k)2=∫0π/2(cos⁡θsin⁡θ)k dθ⋅∫0∞r2k+1e−r2 drI(k)^2 = \int_0^{\pi/2} (\cos\theta \sin\theta)^k\,d\theta \cdot \int_0^\infty r^{2k+1} e^{-r^2}\,dr

The angular part. cos⁡θsin⁡θ=12sin⁡2θ\cos\theta \sin\theta = \frac{1}{2}\sin 2\theta, then substitute φ=2θ\varphi = 2\theta:

∫0π/2(cos⁡θsin⁡θ)k dθ=2−k∫0π/2sin⁡k(2θ) dθ=2−(k+1)∫0πsin⁡kθ dθ\int_0^{\pi/2} (\cos\theta \sin\theta)^k\,d\theta = 2^{-k} \int_0^{\pi/2} \sin^k(2\theta)\,d\theta = 2^{-(k+1)} \int_0^\pi \sin^k\theta\,d\theta

The radial part. Substitute u=r2u = r^2, du=2r drdu = 2r\,dr. Then r2k+1 dr=r2k⋅r dr=uk⋅du2r^{2k+1}\,dr = r^{2k} \cdot r\,dr = u^k \cdot \frac{du}{2}:

∫0∞r2k+1e−r2 dr=2−1∫0∞uke−u du\int_0^\infty r^{2k+1} e^{-r^2}\,dr = 2^{-1} \int_0^\infty u^k e^{-u}\,du

The integral on the right is the Gamma function:

Γ(s)=∫0∞us−1e−u du\Gamma(s) = \int_0^\infty u^{s-1} e^{-u}\,du

so the radial part is 2−1 Γ(k+1)2^{-1}\,\Gamma(k+1). For natural nn, Γ(n+1)=n!\Gamma(n+1) = n!.

Putting It Together

I(k)2=2−(k+1)∫0πsin⁡kθ dθ⋅2−1 Γ(k+1)=2−(k+2) Γ(k+1)∫0πsin⁡kθ dθI(k)^2 = 2^{-(k+1)} \int_0^\pi \sin^k\theta\,d\theta \cdot 2^{-1}\,\Gamma(k+1) = 2^{-(k+2)}\,\Gamma(k+1) \int_0^\pi \sin^k\theta\,d\theta

Take the square root:

I(k)=2−(k2+1)Γ(k+1)∫0πsin⁡kθ dθ,k∈(−1,∞)I(k) = 2^{-\left(\frac{k}{2}+1\right)} \sqrt{\Gamma(k+1)} \sqrt{\int_0^\pi \sin^k\theta\,d\theta}, \qquad k \in (-1, \infty)

For k∈N0k \in \mathbb{N}_0 the Gamma function becomes a factorial:

I(k)=2−(k2+1)k!∫0πsin⁡kθ dθI(k) = 2^{-\left(\frac{k}{2}+1\right)} \sqrt{k!} \sqrt{\int_0^\pi \sin^k\theta\,d\theta}

The Direct Route

There is a shorter way to the same integral. Substitute u=t2u = t^2 straight away, du=2t dtdu = 2t\,dt, dt=du2tdt = \frac{du}{2t}:

I(k)=12∫0∞uk−12e−u du=12 Γ(k+12)I(k) = \frac{1}{2} \int_0^\infty u^{\frac{k-1}{2}} e^{-u}\,du = \frac{1}{2}\,\Gamma\left(\frac{k+1}{2}\right)

Setting Them Equal

Both are I(k)I(k), so the two results are equal. Write xx for kk:

2−1 Γ(x+12)=2−(x2+1)Γ(x+1)∫0πsin⁡xθ dθ2^{-1}\,\Gamma\left(\frac{x+1}{2}\right) = 2^{-\left(\frac{x}{2}+1\right)} \sqrt{\Gamma(x+1)} \sqrt{\int_0^\pi \sin^x\theta\,d\theta}

Multiply both sides by 22:

Γ(x+12)=2−x2Γ(x+1)∫0πsin⁡xθ dθ\Gamma\left(\frac{x+1}{2}\right) = 2^{-\frac{x}{2}} \sqrt{\Gamma(x+1)} \sqrt{\int_0^\pi \sin^x\theta\,d\theta}

A quick check with x=1x = 1: ∫0πsin⁡θ dθ=2\int_0^\pi \sin\theta\,d\theta = 2, so the right side is 2−12⋅1⋅2=1=Γ(1)2^{-\frac{1}{2}} \cdot \sqrt{1} \cdot \sqrt{2} = 1 = \Gamma(1).

Now set x=0x = 0. The power of two disappears, sin⁡0θ=1\sin^0\theta = 1, and Γ(1)=0!=1\Gamma(1) = 0! = 1:

Γ(12)=Γ(1)∫0πdθ=0! π=π\Gamma\left(\frac{1}{2}\right) = \sqrt{\Gamma(1)} \sqrt{\int_0^\pi d\theta} = \sqrt{0!}\,\sqrt{\pi} = \sqrt{\pi}

The same value closes the loop: I(0)=12Γ(12)=π2I(0) = \frac{1}{2}\Gamma\left(\frac{1}{2}\right) = \frac{\sqrt{\pi}}{2}, and since e−t2e^{-t^2} is even, the Gaussian integral we started with is π\sqrt{\pi}.