Foundations to Frontier
Tests
A. Mathematical Foundations › A3 Calculus and Analysis › Single-variable calculus

Improper Integrals and the Gaussian Integral

Integrals over infinite ranges or through blow-ups. Some have finite areas, some don't, and the difference decides whether probability distributions have means, whether algorithms converge, and why √π appears in every normal distribution.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

An endless shape with a finite area

Eat half a cake, then half of what’s left, then half again, forever. You eat infinitely many pieces, but never more than one cake: 12+14+18+⋯=1\tfrac12 + \tfrac14 + \tfrac18 + \cdots = 1.

Areas work the same way. A shape that stretches forever can still have a finite area, if it gets thin fast enough. If it thins too slowly, the area is infinite. Integrals over endless ranges are called improper integrals.

Infinite region, finite area? Watch ∫ₐᴿ f as R → ∞
110100100010000
∫ from 1 to R = 0.989999 · limit as R → ∞: 1.000000 (converges)
Horizontal axis: R on a log scale. Dashed green = the limit. Converges exactly when p > 1 (the p-test). p = 1 grows like ln R.
Why engineers care

The famous bell curve (the Gaussian) stretches forever in both directions, yet its total area is exactly √π. That number sits inside the formula for the normal distribution, which describes sensor noise in every robot and every spacecraft navigation system.

📝 Quick check (Level 0)
0/3 answered
  1. 1. ½ + ¼ + ⅛ + … (forever) adds up to…
  2. 2. Can an infinitely long shape have a finite area?
  3. 3. 1 + 1 + 1 + … forever is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.

Definition: a limit of ordinary integrals

∫a∞f(x) dx=lim⁡R→∞∫aRf(x) dx\int_a^\infty f(x)\,dx = \lim_{R\to\infty}\int_a^Rf(x)\,dx

If the limit exists and is finite, the integral converges. Otherwise it diverges. Blow-ups inside the range are handled the same way, for example ∫01=lim⁡ϵ→0+∫ϵ1\int_0^1 = \lim_{\epsilon\to0^+}\int_\epsilon^1.

Integral Value
∫1∞dxx2=lim⁡(1−1R)\int_1^\infty\frac{dx}{x^2} = \lim\big(1 - \tfrac1R\big) 1
∫1∞dxx=lim⁡ln⁡R\int_1^\infty\frac{dx}x = \lim\ln R diverges
∫01dxx=lim⁡(2−2ϵ)\int_0^1\frac{dx}{\sqrt x} = \lim(2 - 2\sqrt\epsilon) 2
∫0∞e−xdx\int_0^\infty e^{-x}dx 1
📝 Quick check (Level 1)
0/3 answered
  1. 1. ∫₁^∞ dx/x² = ?
  2. 2. Does ∫₁^∞ dx/x converge?
  3. 3. ∫₀^∞ e^(−x) dx = ?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.

The p-test and comparison

∫1∞dxxp converges  ⟺  p>1 (=1p−1),∫01dxxp converges  ⟺  p<1 (=11−p)\int_1^\infty\frac{dx}{x^p}\ \text{converges}\iff p>1\ \Big(=\tfrac1{p-1}\Big), \qquad \int_0^1\frac{dx}{x^p}\ \text{converges}\iff p<1\ \Big(=\tfrac1{1-p}\Big)

Comparison: if 0≤f≤g0\le f\le g and ∫g\int g converges, so does ∫f\int f. If ∫f\int f diverges, so does ∫g\int g. For example, 1x2+1≤1x2\frac{1}{x^2 + 1}\le\frac1{x^2}, and in fact ∫0∞dx1+x2=π2\int_0^\infty\frac{dx}{1+x^2} = \frac\pi2.

🐍 Exercise 1: watching convergence and divergence
Integrate up to growing cutoffs R. 1/x² settles to 1, 1/x tracks ln R forever, and e^(−x²) reaches √π/2 almost immediately.

The Gaussian integral

∫−∞∞e−x2dx=π,∫−∞∞e−x2/(2σ2)dx=σ2π\int_{-\infty}^\infty e^{-x^2}dx = \sqrt\pi, \qquad \int_{-\infty}^\infty e^{-x^2/(2\sigma^2)}dx = \sigma\sqrt{2\pi}

This is why the normal density is 1σ2πe−(x−μ)2/(2σ2)\frac1{\sigma\sqrt{2\pi}}e^{-(x-\mu)^2/(2\sigma^2)}: the constant makes the total probability 1. Its moments are E[X2]=σ2\mathbb E[X^2] = \sigma^2 and E[X4]=3σ4\mathbb E[X^4] = 3\sigma^4 (for μ=0\mu = 0).

Conditional convergence

∫0∞sin⁡xxdx=π2\int_0^\infty\frac{\sin x}xdx = \frac\pi2 converges because the positive and negative lobes cancel. But ∫0∞∣sin⁡xx∣dx\int_0^\infty\left\lvert\frac{\sin x}x\right\rvert dx diverges (it grows like 2πln⁡R\frac2\pi\ln R). This kind of fragile convergence needs care in numerical work and in Fourier analysis.

📝 Quick check (Level 2)
0/3 answered
  1. 1. ∫_{−∞}^{∞} e^(−x²) dx = ?
  2. 2. ∫₀¹ x^(−1/3) dx = ?
  3. 3. ∫₀^∞ sin x / x dx converges…

Level 3: Advanced

★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.

Proof of the Gaussian integral (Poisson’s trick)

Let I=∫−∞∞e−x2dxI = \int_{-\infty}^\infty e^{-x^2}dx. Square it and switch to polar coordinates:

I2=∬R2e−(x2+y2)dx dy=∫02π ⁣ ⁣∫0∞e−r2r dr dθ=2π⋅[−12e−r2]0∞=πI^2 = \iint_{\mathbb R^2}e^{-(x^2+y^2)}dx\,dy = \int_0^{2\pi}\!\!\int_0^\infty e^{-r^2}r\,dr\,d\theta = 2\pi\cdot\Big[-\tfrac12e^{-r^2}\Big]_0^\infty = \pi

So I=πI = \sqrt\pi. ∎ The extra rr from the polar area element r dr dθr\,dr\,d\theta (A3.2) is exactly what makes the inner integral elementary. As a bonus, Γ(12)=∫0∞x−1/2e−xdx=π\Gamma(\tfrac12) = \int_0^\infty x^{-1/2}e^{-x}dx = \sqrt\pi (substitute x=t2x = t^2).

Why comparison works

For f≥0f\ge0, R↦∫aRfR\mapsto\int_a^Rf is non-decreasing. A non-decreasing function converges iff it is bounded (completeness of ℝ, A3.1-1). If f≤gf\le g, then ∫aRf≤∫a∞g<∞\int_a^Rf\le\int_a^\infty g<\infty. ∎

Absolute vs conditional convergence

If ∫∣f∣\int\lvert f\rvert converges, so does ∫f\int f (absolute convergence). The reverse fails, as sin⁡x/x\sin x/x shows. Lebesgue integration (A3.1-6) only accepts absolutely integrable functions. That’s why sin⁡x/x\sin x/x is an “improper Riemann” but not a Lebesgue integral on [0,∞)[0,\infty).

Exercise 3.1: Compute ∫₀^∞ x e^(−x²) dx

Substitute u=x2u = x^2, du=2x dxdu = 2x\,dx: 12∫0∞e−udu=12\frac12\int_0^\infty e^{-u}du = \frac12.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Γ(½) = ?
  2. 2. The polar trick works because the area element is…
  3. 3. For which p do both ∫₁^∞ x^(−p) and ∫₀¹ x^(−p) diverge?

Level 4: Expert

★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.

Laplace’s method: integrals dominated by a peak

For large nn, ∫enh(x)dx\int e^{nh(x)}dx is dominated by the maximum x∗x^* of hh. Expand hh to second order and use the Gaussian integral:

∫enh(x)dx≈enh(x∗)2πn∣h′′(x∗)∣\int e^{nh(x)}dx\approx e^{nh(x^*)}\sqrt{\frac{2\pi}{n\lvert h''(x^*)\rvert}}

Applied to n!=∫0∞enln⁡x−xdxn! = \int_0^\infty e^{n\ln x - x}dx, it gives Stirling’s formula n!≈2πn(n/e)nn!\approx\sqrt{2\pi n}(n/e)^n, with relative error about 1/(12n)1/(12n). In statistics and ML, the Laplace approximation fits a Gaussian at a posterior’s mode (MacKay, 1992). It approximates Bayesian evidence, and it is used for uncertainty in neural networks (Daxberger et al., 2021) and in robot localization.

🐍 Exercise 2 (research): Stirling's formula from Laplace's method
Approximate n! by a Gaussian integral around the peak of n ln x − x. Check that the relative error matches 1/(12n) for n = 1 to 100.

Why convergence matters in practice

  • Gaussians everywhere. The multivariate version ∫Rne−12x⊤Axdx=(2π)n/2det⁡A\int_{\mathbb R^n}e^{-\frac12\mathbf x^\top A\mathbf x}d\mathbf x = \frac{(2\pi)^{n/2}}{\sqrt{\det A}} (Practice Code 5) normalizes every Gaussian belief. These include Kalman filters, Gaussian processes (I2) and factor-graph SLAM, where log⁡det⁡\log\det terms appear in likelihoods.
  • Heavy tails. The Cauchy distribution’s mean integral ∫∣x∣π(1+x2)dx\int\frac{\lvert x\rvert}{\pi(1+x^2)}dx diverges, so sample averages never settle (Practice Code 4). Sensor data with heavy-tailed outliers (lidar on glass, GPS multipath) breaks least squares. Robust losses and Student-t models are the fix (A3.1-5).
  • Probability of collision. For a robot with a Gaussian position belief, the collision probability is the integral of that Gaussian over the obstacle region. Chance-constrained planners bound it (Blackmore, Ono and Williams, 2011).
  • Discounting in RL. ∫0∞e−ρtr(t) dt\int_0^\infty e^{-\rho t}r(t)\,dt converges for bounded rewards because of the exponential discount. This is the continuous-time analogue of ∑γtrt\sum\gamma^tr_t.

References

  1. P.-S. Laplace (1774). “Mémoire sur la probabilité des causes par les événements.” (Laplace’s method and the Gaussian integral.)
  2. J. Stirling (1730). Methodus Differentialis.
  3. C. F. Gauss (1809). Theoria motus corporum coelestium. (The normal distribution for astronomical errors.)
  4. D. MacKay (1992). “A practical Bayesian framework for backpropagation networks.” Neural Computation, 4(3).
  5. L. Blackmore, M. Ono, B. Williams (2011). “Chance-constrained optimal path planning with obstacles.” IEEE Transactions on Robotics, 27(6).
  6. E. Daxberger, A. Kristiadi, A. Immer, R. Eschenhagen, M. Bauer, P. Hennig (2021). “Laplace redux: effortless Bayesian deep learning.” NeurIPS.
  7. N. Bleistein, R. Handelsman (1986). Asymptotic Expansions of Integrals. Dover.