C.W.K.
Stream
Lesson 03 of 05 · published

Integration: Differentiation's Mirror Twin

~8 min · integration, accumulation, antiderivative

Level 0Math Novice
0 XP0/59 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete

The Other Half

If differentiation pulls slopes out of curves, integration pushes accumulated change back into a quantity. Differentiation answers "how fast?"; integration answers "how much, over time?"

The Fundamental Theorem of Calculus says these two are inverse operations. Integrate a derivative and you get the original function back (up to a constant). They unwind each other.

The Area-Under-the-Curve Picture

The integral equals the area under the curve from to . Why? Because integration is "accumulating tiny rectangles of width and height and summing them up." Take the limit as and you get exact area.

Why AI Cares Less About Integration

Most ML loss functions are sums (already discrete) or already-averaged. We rarely need to compute symbolic integrals. Where integration shows up:

  • Probability distributions — a continuous probability density integrates to 1.
  • Variational inference — approximating intractable integrals over latent variables.
  • Continuous-time models — neural ODEs, diffusion models. These do involve real integration.
  • Reward accumulation in reinforcement learning — discounted sum of future rewards, the discrete version of an integral.
Differentiation tells you the rate; integration tells you the total. They're inverses. AI uses the first constantly, the second occasionally.

Code

Riemann sum approximation·python
import numpy as np

# Numerical integration: area under f(x) = x^2 from 0 to 1
# True answer: 1/3

def f(x): return x ** 2

# Approximate with rectangles (Riemann sum)
n = 1000
x = np.linspace(0, 1, n)
dx = 1.0 / n
area = np.sum(f(x) * dx)
print(area)         # ~0.333  (≈ 1/3)

External links

Exercise

Numerically integrate f(x) = sin(x) from 0 to π. The exact answer is 2. Use the trapezoidal rule (np.trapz) for a tighter approximation than rectangles.
Hint
x = np.linspace(0, np.pi, 1000); y = np.sin(x); area = np.trapz(y, x). Should give ~2.0.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.