The Definite Integral and the Fundamental Theorem
The definite integral turns the limit of Riemann sums into a single number: the signed area under a curve between two points. The Fundamental Theorem of Calculus says you can compute that number with an antiderivative instead of an infinite sum, which links the two halves of calculus.
Definition and notation
and are the limits of integration, is the integrand. Unlike the indefinite integral, the result is a number, not a family of functions. It is a signed area: regions above the x-axis count positive and regions below count negative.
The Fundamental Theorem
Part 2 (the evaluation theorem). If is any antiderivative of a continuous , then
So the area under from 0 to 2 is , exactly the number the Riemann sums in the previous lesson were creeping towards. The cancels in the subtraction, which is why it never appears in definite integrals.
Part 1 (the accumulation theorem). Define an area-so-far function . Then
The rate at which accumulated area grows is the height of the curve at the moving edge. Integration builds up, differentiation reads off the rate: they are inverse operations.
import sympy as sp
x, t = sp.symbols("x t")
print("∫_0^2 x^2 dx =", sp.integrate(x**2, (x, 0, 2)))
print("∫_0^pi sin x dx =", sp.integrate(sp.sin(x), (x, 0, sp.pi)))
print("∫_0^2pi sin x dx =", sp.integrate(sp.sin(x), (x, 0, 2 * sp.pi)), " (the lobes cancel)")
G = sp.integrate(sp.cos(t) * t**2, (t, 0, x)) # area-so-far function
print("G(x) =", G)
print("G'(x) =", sp.simplify(sp.diff(G, x))) # FTC part 1: the integrand again∫_0^2 x^2 dx = 8/3
∫_0^pi sin x dx = 2
∫_0^2pi sin x dx = 0 (the lobes cancel)
G(x) = x**2*sin(x) + 2*x*cos(x) - 2*sin(x)
G'(x) = x**2*cos(x)
Properties
| Property | Formula |
|---|---|
| Zero width | |
| Reversing limits | |
| Splitting the interval | |
| Linearity | |
| Comparison | on |
| Average value |
The average value is the height of the rectangle with the same area as the region under the curve.
Checking Part 1 numerically
You can watch the theorem work without any algebra: accumulate area with a running sum and take its slope with a finite difference.
import numpy as np
x = np.linspace(0, 3, 3001)
f = np.exp(-x) * np.sin(3 * x)
dx = x[1] - x[0]
G = np.concatenate([[0], np.cumsum((f[1:] + f[:-1]) / 2 * dx)]) # running area
slope = np.gradient(G, dx) # dG/dx
for xv in [0.5, 1.0, 2.0]:
i = int(round(xv / dx))
print(f"x={xv}: dG/dx = {slope[i]:.5f} f(x) = {f[i]:.5f}")x=0.5: dG/dx = 0.60501 f(x) = 0.60501
x=1.0: dG/dx = 0.05192 f(x) = 0.05192
x=2.0: dG/dx = -0.03781 f(x) = -0.03781
In software: probability is area
In statistics and machine learning a continuous random variable is described by a probability density function (PDF) . Probabilities are areas under it:
The CDF is exactly the area-so-far function, and Part 1 says the PDF is the derivative of the CDF.
import math
from scipy.integrate import quad
from scipy.stats import norm
pdf = lambda x: math.exp(-x * x / 2) / math.sqrt(2 * math.pi)
area, _ = quad(pdf, -1, 1)
print(f"P(-1 <= Z <= 1) by integration = {area:.6f}")
print(f"same from the CDF = {norm.cdf(1) - norm.cdf(-1):.6f}")
total, _ = quad(pdf, -math.inf, math.inf)
print(f"total area = {total:.6f}")P(-1 <= Z <= 1) by integration = 0.682689
same from the CDF = 0.682689
total area = 1.000000
That is the "68%" of the 68–95–99.7 rule from Standard Deviation.
Exercises
Exercise 1: Evaluate
Compute .
Answer
10
Solution
Exercise 2: Average value
Find the average value of on .
Answer
3
Solution
Exercise 3: Part 1 without integrating
Let . Find .
Answer
3
Solution
No antiderivative of in elementary functions is needed.
Exercise 4: A probability from a density
A server's response time (seconds) has density for . Find exactly and check it with quad.
Answer
Solution
import math
from scipy.integrate import quad
value, _ = quad(lambda x: 2 * math.exp(-2 * x), 0, 1)
print(f"{value:.6f} {1 - math.exp(-2):.6f}")0.864665 0.864665
Test yourself
What is ?
- 12
- 6
- 8
- 4
If , what is ?
Why does equal 0?
- is zero everywhere
- The positive lobe and the negative lobe have equal size and cancel
- The integral does not exist
- Because is a multiple of