CALCULUS / 8. INTEGRATION
Integration
Accumulation and area — connecting to probability and expectation
EXPLANATION
Integration is the inverse of differentiation (Fundamental Theorem of Calculus) and also computes the area under a curve. Indefinite integral: ∫f(x)dx = F(x) + C where F'(x) = f(x) Definite integral: ∫[a,b]f(x)dx = F(b) - F(a) = area from a to b Fundamental Theorem of Calculus: If F'(x) = f(x), then ∫[a,b]f(x)dx = F(b) - F(a) Differentiation and integration are inverse operations. Why integration matters for ML: • Probability: P(a ≤ X ≤ b) = ∫[a,b]f(x)dx — the PDF integrates to probability • Expected value: E[X] = ∫x·f(x)dx • Normalization: ∫[−∞,+∞]f(x)dx = 1 for any valid PDF • KL divergence, entropy, and many other ML quantities involve integrals • Gaussian integrals appear constantly in probabilistic ML Key integrals to know: • ∫xⁿdx = xⁿ⁺¹/(n+1) + C • ∫eˣdx = eˣ + C • ∫(1/x)dx = log|x| + C • ∫[−∞,+∞]e^(−x²)dx = √π (Gaussian integral)
DIAGRAM
Definite integral = area under curve:
f(x) = x²
∫[0,3] x² dx = [x³/3]₀³ = 27/3 - 0 = 9
████
██████
█████████
████████████
──────────────── x
0 3
Area = 9
PDF must integrate to 1:
Normal: ∫[-∞,+∞] (1/√2πσ²) e^(-(x-μ)²/2σ²) dx = 1
Expected value = ∫ x · f(x) dx
"weighted average of x, weighted by probability"CODE