The Gaussian integral ∫ − ∞ ∞ e − t 2 d t \int_{-\infty}^{\infty} e^{-t^2}\,dt ∫ − ∞ ∞ e − t 2 d t 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 t t t in front. What comes out is a relation between Γ ( x + 1 ) \Gamma(x+1) Γ ( x + 1 ) and Γ ( x + 1 2 ) \Gamma\left(\frac{x+1}{2}\right) Γ ( 2 x + 1 ) , and Γ ( 1 2 ) = π \Gamma\left(\frac{1}{2}\right) = \sqrt{\pi} Γ ( 2 1 ) = π as a special case.
The bell curve
Why This Integral
Quick recap for those who may not be familiar with the topic. Let X X X be a random variable that follows an unknown distribution D \mathcal{D} D with mean μ \mu μ and variance σ 2 \sigma^2 σ 2 .
X ∼ D ( μ , σ 2 ) X \sim \mathcal{D}(\mu, \sigma^2) X ∼ D ( μ , σ 2 )
Take n n n samples of X X X and average them. Whatever D \mathcal{D} D is, the sample mean is normally distributed:
X ˉ ∼ N ( μ , σ 2 n ) \bar{X} \sim \mathcal{N}\left(\mu, \frac{\sigma^2}{n}\right) X ˉ ∼ N ( μ , n σ 2 )
This is the central limit theorem. Strictly, it is true as n n n goes to infinity; in practice n > 30 n > 30 n > 30 is considered enough. The normal distribution is built out of e − t 2 e^{-t^2} e − t 2 , so this integral sits under a large part of statistics.
Adding a Power of t t t
I ( k ) = ∫ 0 ∞ t k e − t 2 d t , k ∈ ( − 1 , ∞ ) I(k) = \int_0^\infty t^k e^{-t^2}\,dt, \qquad k \in (-1, \infty) I ( k ) = ∫ 0 ∞ t k e − t 2 d t , k ∈ ( − 1 , ∞ )
The lower bound is 0 0 0 because t k t^k t k is not real for negative t t t and non-integer k k k . The bound on k k k comes from the behaviour near 0 0 0 : there e − t 2 ≈ 1 e^{-t^2} \approx 1 e − t 2 ≈ 1 , so the integrand behaves like t k t^k t k . For k = − 1 k = -1 k = − 1 that is 1 t \frac{1}{t} t 1 , 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 ∞ x k e − x 2 d x ⋅ ∫ 0 ∞ y k e − y 2 d y = ∫ 0 ∞ ∫ 0 ∞ ( x y ) k e − ( x 2 + y 2 ) d x d y I(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 I ( k ) 2 = ∫ 0 ∞ x k e − x 2 d x ⋅ ∫ 0 ∞ y k e − y 2 d y = ∫ 0 ∞ ∫ 0 ∞ ( x y ) k e − ( x 2 + y 2 ) d x d y
Now switch to polar coordinates: x = r cos θ x = r\cos\theta x = r cos θ , y = r sin θ y = r\sin\theta y = r sin θ . The first quadrant is r ∈ [ 0 , ∞ ) r \in [0, \infty) r ∈ [ 0 , ∞ ) , θ ∈ [ 0 , π 2 ] \theta \in [0, \frac{\pi}{2}] θ ∈ [ 0 , 2 π ] , and x 2 + y 2 = r 2 x^2 + y^2 = r^2 x 2 + y 2 = r 2 .
I ( k ) 2 = ∫ 0 π / 2 ∫ 0 ∞ [ r 2 cos θ sin θ ] k e − r 2 r d r 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 I ( k ) 2 = ∫ 0 π /2 ∫ 0 ∞ [ r 2 cos θ sin θ ] k e − r 2 r d r d θ
The extra r r r before d r dr d r 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 r r r , so the double integral splits into two single ones.
I ( k ) 2 = ∫ 0 π / 2 ( cos θ sin θ ) k d θ ⋅ ∫ 0 ∞ r 2 k + 1 e − r 2 d r I(k)^2 = \int_0^{\pi/2} (\cos\theta \sin\theta)^k\,d\theta \cdot \int_0^\infty r^{2k+1} e^{-r^2}\,dr I ( k ) 2 = ∫ 0 π /2 ( cos θ sin θ ) k d θ ⋅ ∫ 0 ∞ r 2 k + 1 e − r 2 d r
The angular part. cos θ sin θ = 1 2 sin 2 θ \cos\theta \sin\theta = \frac{1}{2}\sin 2\theta cos θ sin θ = 2 1 sin 2 θ , then substitute φ = 2 θ \varphi = 2\theta φ = 2 θ :
∫ 0 π / 2 ( cos θ sin θ ) k d θ = 2 − k ∫ 0 π / 2 sin 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 ∫ 0 π /2 ( cos θ sin θ ) k d θ = 2 − k ∫ 0 π /2 sin k ( 2 θ ) d θ = 2 − ( k + 1 ) ∫ 0 π sin k θ d θ
The radial part. Substitute u = r 2 u = r^2 u = r 2 , d u = 2 r d r du = 2r\,dr d u = 2 r d r . Then r 2 k + 1 d r = r 2 k ⋅ r d r = u k ⋅ d u 2 r^{2k+1}\,dr = r^{2k} \cdot r\,dr = u^k \cdot \frac{du}{2} r 2 k + 1 d r = r 2 k ⋅ r d r = u k ⋅ 2 d u :
∫ 0 ∞ r 2 k + 1 e − r 2 d r = 2 − 1 ∫ 0 ∞ u k e − u d u \int_0^\infty r^{2k+1} e^{-r^2}\,dr = 2^{-1} \int_0^\infty u^k e^{-u}\,du ∫ 0 ∞ r 2 k + 1 e − r 2 d r = 2 − 1 ∫ 0 ∞ u k e − u d u
The integral on the right is the Gamma function:
Γ ( s ) = ∫ 0 ∞ u s − 1 e − u d u \Gamma(s) = \int_0^\infty u^{s-1} e^{-u}\,du Γ ( s ) = ∫ 0 ∞ u s − 1 e − u d u
so the radial part is 2 − 1 Γ ( k + 1 ) 2^{-1}\,\Gamma(k+1) 2 − 1 Γ ( k + 1 ) . For natural n n n , Γ ( n + 1 ) = n ! \Gamma(n+1) = n! Γ ( 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 I ( k ) 2 = 2 − ( k + 1 ) ∫ 0 π sin k θ d θ ⋅ 2 − 1 Γ ( k + 1 ) = 2 − ( k + 2 ) Γ ( k + 1 ) ∫ 0 π sin k θ d θ
Take the square root:
I ( k ) = 2 − ( k 2 + 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) I ( k ) = 2 − ( 2 k + 1 ) Γ ( k + 1 ) ∫ 0 π sin k θ d θ , k ∈ ( − 1 , ∞ )
For k ∈ N 0 k \in \mathbb{N}_0 k ∈ N 0 the Gamma function becomes a factorial:
I ( k ) = 2 − ( k 2 + 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} I ( k ) = 2 − ( 2 k + 1 ) k ! ∫ 0 π sin k θ d θ
The Direct Route
There is a shorter way to the same integral. Substitute u = t 2 u = t^2 u = t 2 straight away, d u = 2 t d t du = 2t\,dt d u = 2 t d t , d t = d u 2 t dt = \frac{du}{2t} d t = 2 t d u :
I ( k ) = 1 2 ∫ 0 ∞ u k − 1 2 e − u d u = 1 2 Γ ( k + 1 2 ) 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) I ( k ) = 2 1 ∫ 0 ∞ u 2 k − 1 e − u d u = 2 1 Γ ( 2 k + 1 )
Setting Them Equal
Both are I ( k ) I(k) I ( k ) , so the two results are equal. Write x x x for k k k :
2 − 1 Γ ( x + 1 2 ) = 2 − ( x 2 + 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} 2 − 1 Γ ( 2 x + 1 ) = 2 − ( 2 x + 1 ) Γ ( x + 1 ) ∫ 0 π sin x θ d θ
Multiply both sides by 2 2 2 :
Γ ( x + 1 2 ) = 2 − x 2 Γ ( 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} Γ ( 2 x + 1 ) = 2 − 2 x Γ ( x + 1 ) ∫ 0 π sin x θ d θ
A quick check with x = 1 x = 1 x = 1 : ∫ 0 π sin θ d θ = 2 \int_0^\pi \sin\theta\,d\theta = 2 ∫ 0 π sin θ d θ = 2 , so the right side is 2 − 1 2 ⋅ 1 ⋅ 2 = 1 = Γ ( 1 ) 2^{-\frac{1}{2}} \cdot \sqrt{1} \cdot \sqrt{2} = 1 = \Gamma(1) 2 − 2 1 ⋅ 1 ⋅ 2 = 1 = Γ ( 1 ) .
Now set x = 0 x = 0 x = 0 . The power of two disappears, sin 0 θ = 1 \sin^0\theta = 1 sin 0 θ = 1 , and Γ ( 1 ) = 0 ! = 1 \Gamma(1) = 0! = 1 Γ ( 1 ) = 0 ! = 1 :
Γ ( 1 2 ) = Γ ( 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} Γ ( 2 1 ) = Γ ( 1 ) ∫ 0 π d θ = 0 ! π = π
The same value closes the loop: I ( 0 ) = 1 2 Γ ( 1 2 ) = π 2 I(0) = \frac{1}{2}\Gamma\left(\frac{1}{2}\right) = \frac{\sqrt{\pi}}{2} I ( 0 ) = 2 1 Γ ( 2 1 ) = 2 π , and since e − t 2 e^{-t^2} e − t 2 is even, the Gaussian integral we started with is π \sqrt{\pi} π .
Leave a comment on Hacker News