TExcelTAD
Home › Calculus in Depth › The Definite Integral

The Definite Integral

The limit of Riemann sums appeared twice in the previous lesson, once for area and once for distance. It deserves a name and a symbol of its own: the definite integral. This lesson gives the precise definition (allowing negative values and unequal strips), says which functions are integrable, and derives the properties used in every later computation. For a first look see The Definite Integral.

Definition

A partition PP of [a,b][a, b] is a list a=x0<x1<⋯<xn=ba = x_0 < x_1 < \cdots < x_n = b, with widths Δxi=xi−xi−1\Delta x_i = x_i - x_{i-1} and norm ∥P∥=max⁡Δxi\lVert P \rVert = \max \Delta x_i. Choose sample points xi∗x_i^* in [xi−1,xi][x_{i-1}, x_i].

Definition. ff is integrable on [a,b][a, b] if there is a number II such that for every ε>0\varepsilon > 0 there is a δ>0\delta > 0 with

∣∑if(xi∗) Δxi−I∣<ε\left\lvert \sum_i f(x_i^*)\,\Delta x_i - I \right\rvert < \varepsilon

for every partition with ∥P∥<δ\lVert P \rVert < \delta and every choice of sample points. Then ∫abf(x) dx=I\int_a^b f(x)\,dx = I.

The ∫\int is an elongated S for "sum", f(x)f(x) is the integrand, a,ba, b are the limits of integration, and dxdx names the variable. The variable is a dummy: ∫abf(x) dx=∫abf(t) dt\int_a^b f(x)\,dx = \int_a^b f(t)\,dt.

Theorem. If ff is continuous on [a,b][a, b], or bounded with only finitely many jump discontinuities, then ff is integrable on [a,b][a, b].

Not every bounded function is integrable. The function that is 1 on rationals and 0 on irrationals has every upper sum equal to b−ab - a and every lower sum equal to 0, so the Riemann sums have no single limit. (Lebesgue's theory, used in probability, does integrate it, to 0.)

Net signed area

When ff takes negative values, the terms f(xi∗) Δxif(x_i^*)\,\Delta x_i below the axis are negative. The integral is the net area: area above the axis minus area below.

python · try it yourself
import numpy as np
import sympy as sp

x = sp.symbols('x')
f = x**3 - 4*x
print("∫_{-1}^{3} (x^3 - 4x) dx =", sp.integrate(f, (x, -1, 3)))
print("total (unsigned) area    =", sp.integrate(sp.Abs(f), (x, -1, 3)))

# Riemann sums with random partitions and random sample points converge to the same value
rng = np.random.default_rng(3)
g = sp.lambdify(x, f)
for n in (10, 100, 10_000):
    cuts = np.sort(np.concatenate(([-1.0, 3.0], rng.uniform(-1, 3, n - 1))))
    widths = np.diff(cuts)
    tags = cuts[:-1] + rng.uniform(0, 1, n) * widths
    print(f"n = {n:5}: norm = {widths.max():.4f}  sum = {float(np.sum(g(tags) * widths)):.5f}")
∫_{-1}^{3} (x^3 - 4x) dx = 4
total (unsigned) area    = 12
n =    10: norm = 0.7949  sum = 5.44637
n =   100: norm = 0.2266  sum = 4.14740
n = 10000: norm = 0.0042  sum = 4.00023

The net value is 4: the part of [−1,3][-1, 3] where the cubic is negative (0<x<20 < x < 2) cancels part of the positive area. The random sums approach it as the norm shrinks, exactly as the definition demands.

Evaluating from the definition

With equal widths and right endpoints, Δx=b−an\Delta x = \frac{b - a}{n} and xi=a+i Δxx_i = a + i\,\Delta x:

∫abf(x) dx=lim⁡n→∞∑i=1nf(a+i Δx) Δx\int_a^b f(x)\,dx = \lim_{n \to \infty} \sum_{i=1}^{n} f(a + i\,\Delta x)\,\Delta x

For ∫03(2x−x2) dx\int_0^3 (2x - x^2)\,dx: Δx=3/n\Delta x = 3/n, xi=3i/nx_i = 3i/n,

∑[2(3in)−(3in)2]3n=18n2∑i−27n3∑i2=9(1+1n)−92(1+1n)(2+1n)→9−9=0\begin{aligned} \sum \left[2\left(\frac{3i}{n}\right) - \left(\frac{3i}{n}\right)^2\right] \frac{3}{n} &= \frac{18}{n^2} \sum i - \frac{27}{n^3} \sum i^2 \\ &= 9\left(1 + \frac{1}{n}\right) - \frac{9}{2}\left(1 + \frac{1}{n}\right)\left(2 + \frac{1}{n}\right) \quad \to \quad 9 - 9 = 0 \end{aligned}

Positive area on [0,2][0, 2] and negative area on [2,3][2, 3] cancel exactly. In practice we rarely use the definition: the Fundamental Theorem makes this a one-line computation.

Properties

For integrable f,gf, g and a constant cc:

Property Statement
reversed limits ∫baf=−∫abf\int_b^a f = -\int_a^b f, and ∫aaf=0\int_a^a f = 0
constant ∫abc dx=c(b−a)\int_a^b c\,dx = c(b - a)
linearity ∫ab(cf+g)=c∫abf+∫abg\int_a^b (cf + g) = c\int_a^b f + \int_a^b g
additivity ∫acf+∫cbf=∫abf\int_a^c f + \int_c^b f = \int_a^b f (any order of a,b,ca, b, c)
positivity f≥0f \ge 0 on [a,b][a, b] ⇒∫abf≥0\Rightarrow \int_a^b f \ge 0
comparison f≥g⇒∫abf≥∫abgf \ge g \Rightarrow \int_a^b f \ge \int_a^b g
bounds m≤f≤M⇒m(b−a)≤∫abf≤M(b−a)m \le f \le M \Rightarrow m(b - a) \le \int_a^b f \le M(b - a)
triangle inequality ∣∫abf∣≤∫ab∣f∣\left\lvert \int_a^b f \right\rvert \le \int_a^b \lvert f \rvert (for a<ba < b)

Each follows from the same fact about Riemann sums, then passing to the limit. Linearity, for instance: ∑(cf+g)(xi∗) Δxi=c∑f(xi∗) Δxi+∑g(xi∗) Δxi\sum (cf + g)(x_i^*)\,\Delta x_i = c\sum f(x_i^*)\,\Delta x_i + \sum g(x_i^*)\,\Delta x_i.

The bounds property estimates integrals you cannot compute. On [0,1][0, 1], e−x2e^{-x^2} is decreasing from 1 to 1/e1/e, so

python · try it yourself
import math
from scipy.integrate import quad

value, _ = quad(lambda x: math.exp(-x * x), 0, 1)
print(f"lower bound 1/e = {1 / math.e:.4f}")
print(f"quad value      = {value:.4f}")
print(f"upper bound 1   = 1.0000")
lower bound 1/e = 0.3679
quad value      = 0.7468
upper bound 1   = 1.0000

In software

  • Integration is a reduction. ∫f dx\int f\,dx is a weighted sum, so integrals parallelise like sum(): GPU kernels, MapReduce jobs and NumPy all compute them as reductions. Additivity is what lets you split the interval across workers.
  • Signed versus unsigned area. Integrating a signal (audio, accelerometer) gives net area, where positive and negative parts cancel; energy-type quantities integrate f2f^2 or ∣f∣\lvert f \rvert. Mixing these up is a common bug.
  • Lebesgue in ML. Probability theory, expectations and loss functions are defined with Lebesgue integrals, but for every continuous density you will meet, they agree with the Riemann integral defined here.

Exercises

Exercise 1: Net versus total area

Compute ∫02πsin⁡x dx\int_0^{2\pi} \sin x\,dx and the total area between sin⁡x\sin x and the axis on [0,2π][0, 2\pi].

Answer

Net 0, total 4.

Solution

By symmetry the areas on [0,π][0, \pi] and [π,2π][\pi, 2\pi] are equal with opposite sign. Each is ∫0πsin⁡x dx=2\int_0^{\pi} \sin x\,dx = 2, so the total area is 4.

Exercise 2: Using properties

Given ∫05f=7\int_0^5 f = 7 and ∫02f=3\int_0^2 f = 3, find ∫25f\int_2^5 f and ∫52(2f(x)−1) dx\int_5^2 (2f(x) - 1)\,dx.

Answer

∫25f=4\int_2^5 f = 4; ∫52(2f−1)=−5\int_5^2 (2f - 1) = -5.

Solution
∫25f=∫05f−∫02f=7−3=4∫52(2f−1)=−∫25(2f−1)=−(2⋅4−3)=−5\begin{aligned} \int_2^5 f &= \int_0^5 f - \int_0^2 f = 7 - 3 = 4 \\ \int_5^2 (2f - 1) &= -\int_2^5 (2f - 1) = -(2 \cdot 4 - 3) = -5 \end{aligned}

Exercise 3: From the definition

Use right-endpoint sums to compute ∫13(4−x) dx\int_1^3 (4 - x)\,dx.

Answer
Solution
Δx=2/n,xi=1+2i/n,f(xi)=3−2i/nRn=∑(3−2in)2n=6−4n2⋅n(n+1)2=6−2(1+1n)→4\begin{aligned} &\Delta x = 2/n, \quad x_i = 1 + 2i/n, \quad f(x_i) = 3 - 2i/n \\ &R_n = \sum \left(3 - \frac{2i}{n}\right)\frac{2}{n} = 6 - \frac{4}{n^2} \cdot \frac{n(n + 1)}{2} = 6 - 2\left(1 + \frac{1}{n}\right) \to 4 \end{aligned}
python · try it yourself
import sympy as sp
i, n = sp.symbols('i n', positive=True, integer=True)
Rn = sp.summation((3 - 2*i/n) * 2/n, (i, 1, n))
print(sp.simplify(Rn), sp.limit(Rn, n, sp.oo))
4 - 2/n 4

Exercise 4: Bounding an integral

Show that 2≤∫021+x3 dx≤62 \le \int_0^2 \sqrt{1 + x^3}\,dx \le 6.

Answer

On [0,2][0, 2], 1≤1+x3≤31 \le \sqrt{1 + x^3} \le 3.

Solution

1+x3\sqrt{1 + x^3} is increasing on [0,2][0, 2], from 1=1\sqrt{1} = 1 to 9=3\sqrt{9} = 3. The bounds property gives 1⋅2≤∫≤3⋅21 \cdot 2 \le \int \le 3 \cdot 2. (The true value is about 3.24.)

Test yourself

What is ∫2−1f(x) dx\int_2^{-1} f(x)\,dx in terms of ∫−12f(x) dx=6\int_{-1}^2 f(x)\,dx = 6?

  1. 6
  2. 0
  3. It cannot be determined
  4. −6

Which function is NOT Riemann integrable on [0,1][0, 1]?

  1. x2x^2
  2. 1 on rationals, 0 on irrationals
  3. a step function with three jumps
  4. sin⁡(1/x)\sin(1/x) for x>0x > 0 with f(0)=0f(0) = 0

If ∫abf(x) dx=0\int_a^b f(x)\,dx = 0, which must be true?

  1. The areas above and below the axis are equal
  2. f=0f = 0 on [a,b][a, b]
  3. ff is odd
  4. a=ba = b