5. The Fundamental Theorem, part 2: evaluating a definite integral

📖 Reading · 14 min
💡 Every code box below is live — edit it and hit Run.

Part 1 said accumulating then differentiating gets you back where you started. Part 2 runs it the other way, and it is the single most useful formula in calculus.

If f is continuous on [a,b] and F is any antiderivative of f, then \int_a^bf(x)\,dx = F(b)-F(a)

To find an area, find an antiderivative and subtract. No sums, no partitions, no limits.

The notation

\int_a^bf(x)\,dx = \Big[F(x)\Big]_a^b = F(b)-F(a)

The bracket is bookkeeping for "evaluate at the top, subtract the value at the bottom".

Why it's true

Let g(x)=\int_a^xf(t)dt. By Part 1, g' = f.

F is also an antiderivative of f, so F' = g', and by the Mean Value Theorem (§3.4) they differ by a constant:

F(x) = g(x)+C

Now evaluate at both ends and subtract — the C cancels:

F(b)-F(a) = \left[g(b)+C\right] - \left[g(a)+C\right] = g(b)-g(a)

But g(a)=\int_a^af = 0, so this is g(b) = \int_a^bf. \blacksquare

The C cancelling is why "any antiderivative" works — you never need the "right" one, and you never need +C on a definite integral.

What it replaces

\int_0^1x^2dx

Before: partition [0,1] into n pieces, sum \sum(i/n)^2\cdot\frac1n, find a closed form for \sum i^2, take the limit. Half a page, and only tractable because \sum i^2 has a closed form.

Now:

\int_0^1x^2dx = \left[\frac{x^3}{3}\right]_0^1 = \frac13 - 0 = \frac13

One line. And it works for \sin, e^x, and everything else whose antiderivative you know — none of which have tractable Riemann sums.

Take a moment on this. Areas under curves were computed one at a time by ingenious ad-hoc arguments for two thousand years. Archimedes needed a brilliant exhaustion argument for the area under a parabola. Now it's a two-step recipe a student can apply in seconds. That's what Newton and Leibniz actually contributed — not the limits, not the areas, but the link between them.

Using it

\int_0^\pi\sin x\,dx = \Big[-\cos x\Big]_0^\pi = -\cos\pi + \cos 0 = 1+1 = 2

\int_1^e\frac{dx}{x} = \Big[\ln|x|\Big]_1^e = \ln e - \ln 1 = 1

\int_0^1e^xdx = \Big[e^x\Big]_0^1 = e - 1

The double-negative in the first one — subtracting -\cos 0 — is where sign errors live. Write the bracket out rather than doing it in your head.

Where it fails

The hypothesis "f continuous on [a,b]" is doing real work. Ignore it and you get confident nonsense:

\int_{-1}^{1}\frac{dx}{x^2} = \left[-\frac1x\right]_{-1}^1 = -1 - 1 = -2

A negative answer for a strictly positive integrand. The function is unbounded at 0, which is inside the interval, so it isn't continuous there and the theorem simply doesn't apply. §4.10 handles this properly (and the correct answer is that the integral diverges).

Always check the integrand is continuous across the whole interval. Look for denominators vanishing, logs of zero, and even roots of negatives — the same three exclusions as §0.2.

The two parts together

\frac{d}{dx}\int_a^xf(t)\,dt = f(x) \qquad\qquad \int_a^bF'(x)\,dx = F(b)-F(a)

Read the second one as: integrating a rate of change over an interval gives the total change. That's the version that generalises.

  • Integrate velocity, get displacement.
  • Integrate marginal cost, get total added cost.
  • Integrate a probability density, get a probability.

And it's the one-dimensional case of a pattern that recurs at every dimension in §12: Green's theorem, Stokes' theorem, and the divergence theorem all say the integral of a derivative over a region equals something evaluated on the boundary. Here the "region" is [a,b] and its "boundary" is the two endpoints, with signs + and -. §12.10 makes that precise.

Doing it in Python

The theorem, against brute-force sums:

import sympy as sp

x = sp.Symbol('x')

problems = [
    (x**2, 0, 3), (sp.sin(x), 0, sp.pi), (1/x, 1, sp.E), (sp.exp(x), 0, 1),
]

for f, a, b in problems:
    F = sp.integrate(f, x)
    value = sp.integrate(f, (x, a, b))
    print(f"int of {str(f):<8} from {str(a):<3} to {str(b):<4}: "
          f"F = {str(F):<10} -> {str(value):<8} = {float(value):.6f}")

The old way and the new way, side by side:

from math import sin, pi

def riemann(f, a, b, n):
    w = (b - a) / n
    return sum(f(a + (i + 0.5) * w) for i in range(n)) * w

print(f"{'n':>10} {'Riemann sum':>16} {'error vs 2':>14}")
for n in (10, 100, 10_000, 1_000_000):
    s = riemann(sin, 0, pi, n)
    print(f"{n:>10} {s:>16.10f} {abs(s - 2):>14.2e}")

print("\nthe Fundamental Theorem, in one line:")
print("  [-cos x] from 0 to pi = -cos(pi) + cos(0) = 1 + 1 = 2   exactly")

Any antiderivative works — the constant cancels:

import sympy as sp

x = sp.Symbol('x')
f = 2*x

for C in (0, 7, -100):
    F = x**2 + C
    print(f"F = x^2 + {C:<5}  F(3) - F(1) = {F.subs(x,3)} - {F.subs(x,1)} "
          f"= {F.subs(x,3) - F.subs(x,1)}")

print("\nsame answer every time. that is why definite integrals need no +C.")

The failure when continuity is dropped:

import sympy as sp

x = sp.Symbol('x')

print("blindly applying the formula to int_{-1}^{1} dx/x^2:")
F = -1/x
print(f"  F = {F},  F(1) - F(-1) = {F.subs(x,1)} - {F.subs(x,-1)} "
      f"= {F.subs(x,1) - F.subs(x,-1)}")
print("  a NEGATIVE answer for a function that is positive everywhere.\n")

print("what sympy says when asked properly:")
print(f"  {sp.integrate(1/x**2, (x, -1, 1))}")
print("\nthe integrand blows up at x=0, inside the interval. no continuity,")
print("no theorem. section 4.10 handles this as an improper integral.")

The "integral of a rate is the total change" reading:

def integrate(f, a, b, n=200000):
    w = (b - a) / n
    return sum(f(a + (i + 0.5) * w) for i in range(n)) * w

# velocity of something that speeds up then slows
v = lambda t: 3*t**2 - 12*t + 9          # = 3(t-1)(t-3)
s = lambda t: t**3 - 6*t**2 + 9*t        # an antiderivative

print(f"displacement over [0,4] by integrating v : {integrate(v, 0, 4):.8f}")
print(f"                          by s(4) - s(0) : {s(4) - s(0):.8f}\n")

print(f"total DISTANCE, integrating |v|          : "
      f"{integrate(lambda t: abs(v(t)), 0, 4):.8f}")
print("\nthe signed integral gives displacement; |v| gives distance travelled.")

Worked example

Evaluate \displaystyle\int_1^4\left(\frac{3}{\sqrt x} - 2x\right)dx.

Rewrite the root as a power first — the recurring §2.2 discipline:

\frac{3}{\sqrt x} = 3x^{-1/2}

Antidifferentiate term by term:

\int3x^{-1/2}dx = 3\cdot\frac{x^{1/2}}{1/2} = 6\sqrt x, \qquad \int-2x\,dx = -x^2

F(x) = 6\sqrt x - x^2

Evaluate:

\Big[6\sqrt x - x^2\Big]_1^4 = \left(6\cdot2 - 16\right) - \left(6\cdot1 - 1\right) = (12-16)-(6-1) = -4-5 = \boxed{-9}

Is a negative answer sensible? On [1,4], \frac{3}{\sqrt x} falls from 3 to 1.5 while 2x climbs from 2 to 8 — so the integrand starts positive and turns negative, and the negative part is much larger. A negative total is right.

Check the continuity hypothesis: x^{-1/2} needs x>0, and [1,4] is comfortably inside. ✓ Had the interval been [0,4] the integrand would be unbounded at the left endpoint and this would be an improper integral.

Verify by differentiating F: $6\cdot\frac{1}{2\sqrt x} - 2x = \frac{3}{\sqrt x}-2x$ ✓. That check costs seconds and catches nearly every error.

Your turn

1. \displaystyle\int_0^2(x^3-4x)\,dx

2. \displaystyle\int_0^{\pi/2}\cos x\,dx

3. \displaystyle\int_1^2\frac{x^2+1}{x}\,dx

4. What's wrong with \displaystyle\int_{-1}^{1}\frac{dx}{x}=\Big[\ln|x|\Big]_{-1}^1 = 0?

Solutions

1.

\left[\frac{x^4}{4}-2x^2\right]_0^2 = \left(4 - 8\right) - 0 = \boxed{-4}

Negative because x^3 < 4x on most of [0,2] — the two curves cross at x=2, so the integrand is negative throughout the open interval.

2.

\Big[\sin x\Big]_0^{\pi/2} = 1 - 0 = \boxed{1}

3. Divide first:

\frac{x^2+1}{x} = x + \frac1x

\left[\frac{x^2}{2}+\ln|x|\right]_1^2 = \left(2+\ln2\right)-\left(\tfrac12+0\right) = \boxed{\frac32+\ln2 \approx 2.193}

4. The integrand \frac1x is not continuous on [-1,1] — it's undefined at 0 and unbounded on both sides of it. The theorem's hypothesis fails, so its conclusion carries no weight.

The answer 0 is wrong. Splitting properly:

\int_{-1}^1\frac{dx}{x} = \int_{-1}^0\frac{dx}{x} + \int_0^1\frac{dx}{x}

and both halves diverge — the first to -\infty, the second to +\infty (§4.10). "-\infty+\infty" is indeterminate, so the integral does not exist.

The 0 comes from the symmetry of the two infinite pieces, and there is a meaningful quantity that captures it — the Cauchy principal value, which takes a symmetric limit and does equal 0 here. But that's a different and weaker object than the integral, and calling it "the integral" is exactly the error.

The lesson generalises: check for discontinuities inside the interval before applying the theorem, every time. Antiderivative formulas are cheerfully happy to produce a number for an integral that doesn't exist.

Check yourself in code

Evaluate four definite integrals via antiderivatives.

For \int_0^3x^2, \int_0^\pi\sin x, \int_1^e\frac1x, and \int_0^1e^x, print the antiderivative SymPy finds, the exact value, and the value as a float to 6 decimals.

Print exactly this:

x**2 on [0,3]      F=x**3/3       value=9 = 9.000000
sin(x) on [0,pi]   F=-cos(x)      value=2 = 2.000000
1/x on [1,e]       F=log(x)       value=1 = 1.000000
e**x on [0,1]      F=exp(x)       value=-1 + E = 1.718282
import sympy as sp

x = sp.Symbol('x')

problems = [
    ("x**2 on [0,3]", x**2, 0, 3),
    ("sin(x) on [0,pi]", sp.sin(x), 0, sp.pi),
    ("1/x on [1,e]", 1/x, 1, sp.E),
    ("e**x on [0,1]", sp.exp(x), 0, 1),
]

for name, f, a, b in problems:
    # the indefinite integral, then the definite one, then its float value
    print(f"{name:<18} ...")
import sympy as sp

x = sp.Symbol('x')

problems = [
    ("x**2 on [0,3]", x**2, 0, 3),
    ("sin(x) on [0,pi]", sp.sin(x), 0, sp.pi),
    ("1/x on [1,e]", 1/x, 1, sp.E),
    ("e**x on [0,1]", sp.exp(x), 0, 1),
]

for name, f, a, b in problems:
    F = sp.integrate(f, x)
    val = sp.integrate(f, (x, a, b))
    print(f"{name:<18} F={str(F):<12} value={val} = {float(val):.6f}")

\int_a^bf = F(b)-F(a) for any antiderivative F — the constant cancels, so definite integrals never carry a +C. This converts every area problem from a limit of sums into a lookup and a subtraction, and it is the contribution that made Newton and Leibniz the inventors of calculus rather than Archimedes. Read the other way, \int_a^bF' = F(b)-F(a) says integrating a rate gives the total change — the one-dimensional ancestor of every theorem in §12. And the continuity hypothesis is not optional: a discontinuity inside the interval produces confident, wrong numbers.

Next: the techniques, starting with the one that reverses the chain rule.