Definite integral

Level FundamentalDifficulty ★★★★★Concept⌖ Open in the map

What is it?

∫abf(x) dx\int_a^b f(x)\,\dd x is the limit of Riemann sums: the signed area between the graph and the axis, or, more generally, the total accumulated by a rate ff over [a,b][a, b].

Why does it exist?

Many quantities are "rate × amount" only when the rate is constant: distance = speed × time, mass = density × volume, work = force × distance. When the rate varies, chop the domain into pieces where it is nearly constant, add up, and take the limit. The integral is that procedure, and it solves the problem of accumulating a varying quantity.

Intuition

Geometrically: area under the curve, counting area below the axis as negative. Statistically: 1b−a∫abf\frac{1}{b-a}\int_a^b f is the average value of ff on [a,b][a,b] — which is why an integral can be estimated by averaging ff at random points (Monte Carlo). Physically: the total change produced by a rate.

Formal definition

ff is Riemann integrable on [a,b][a,b] if the Riemann sums ∑f(xi∗)Δxi\sum f(x_i^\ast)\Delta x_i converge to the same number II for every choice of sample points as the mesh max⁡Δxi→0\max\Delta x_i \to 0; then ∫abf=I\int_a^b f = I. Every continuous function (and every bounded function with finitely many discontinuities) is integrable. Properties: linearity, additivity over intervals, monotonicity (f≤g⇒∫f≤∫gf \le g \Rightarrow \int f \le \int g).

Formulas

∫abf(x) dx=lim⁡n→∞∑i=1nf(xi∗) Δx\int_a^b f(x)\,\dd x = \lim_{n\to\infty}\sum_{i=1}^{n} f(x_i^\ast)\,\Delta x
fˉ=1b−a∫abf(x) dx\bar f = \frac{1}{b - a}\int_a^b f(x)\,\dd x
average value
P(a≤X≤b)=∫abp(x) dxP(a \le X \le b) = \int_a^b p(x)\,\dd x
probability as an integral of a density

How is it computed?

Exactly, when an antiderivative is known: Barrow's rule F(b)−F(a)F(b) - F(a) (fundamental theorem). Otherwise numerically: Riemann/trapezoid/Simpson/Gaussian quadrature in low dimension, Monte Carlo in high dimension.

Example

Energy of a signal x(t)=sin⁡(2πt)x(t) = \sin(2\pi t) over one second: ∫01sin⁡2(2πt) dt=12\int_0^1 \sin^2(2\pi t)\,\dd t = \frac12. The same integral, as a sum over samples 1N∑x[n]2\frac1N\sum x[n]^2, is how audio software measures loudness (RMS).

Why does it matter?

Probabilities, expectations, energies, masses, light arriving at a pixel, the expected loss of a model: all are integrals. Most cannot be computed exactly, and a large part of computational science is about approximating them well — quadrature in low dimensions, Monte Carlo in high ones.

Where it shows up in computing

  • Monte Carlo methods★★★★★fundamentalScientific computing and algorithms

    Monte Carlo estimates ∫f\int f as an average of ff at random points; error O(N−1/2)O(N^{-1/2}) in any dimension.

  • The rendering equation★★★★★fundamentalComputer graphics

    The colour of a pixel is an integral of incoming light over directions.

  • Signal processing★★★★★frequentSignals, media and vision

    Signal energy, correlation and convolution are integrals (sums, once sampled).

  • Physics engines★★★★★frequentPhysics and simulation

    Positions are integrals of velocities, velocities integrals of accelerations.

Where it shows up in AI

  • Loss function★★★★★frequentAI and machine learning

    The true risk 𝔼[ℓ]=∫ℓ dP\E[\ell] = \int \ell\,\dd P is an integral; the training loss is its sample average.

Where is it used?

Computing topics reachable from here, through the chain of ideas that leads to them:

What depends on it

Exercises

1Computation

Compute ∫02(3x2−2x) dx\int_0^2 (3x^2 - 2x)\,\dd x and interpret the sign.

Solution

[x3−x2]02=8−4=4[x^3 - x^2]_0^2 = 8 - 4 = 4. Positive: the area above the axis (for x>2/3x > 2/3) exceeds the small negative part on (0,2/3)(0, 2/3).

2Computing

Estimate π\pi with an integral and random numbers. How many samples for 3 correct decimals?

Solution

π=4∫011−x2 dx≈4N∑1−ui2\pi = 4\int_0^1\sqrt{1 - x^2}\,\dd x \approx \frac4N\sum\sqrt{1 - u_i^2} with uiu_i uniform. The standard error is about 0.9/N0.9/\sqrt N; for ±0.0005\pm 0.0005 you need N≈3⋅106N \approx 3\cdot10^6. Monte Carlo is simple but slow.

↑ ↓ to navigate · ↵ · Esc