Chapter 09

Integral

Integration is the inverse of differentiation. It is used for area under a curve, cumulative quantities, and for probability and expectation.

Math diagram by chapter

Select a chapter to see its diagram below. View the flow of basic math at a glance.

The gap between the rectangles and the curve shrinks as you use more slices; in the limit you get the exact area (the integral).

The definite integral represents the area under the curve. Find an antiderivative and plug in the upper and lower limits.

What is the integral?

In short, the integral is the inverse of differentiation — it “undoes” the derivative. We use the symbol \int, and the definite integral over an interval [a,b][a,b] is written abf(x)dx\int_a^b f(x)\,dx.
It is tied to area: the area between the curve, the xx-axis, and the lines x=ax=a and x=bx=b is defined by the definite integral. For a positive function, that value is the “area under the curve”.
A definite integral is computed by finding the “undo” function (one whose derivative is the integrand), then plugging in the upper and lower limits and subtracting. Core formula: when F(x)=f(x)F'(x)=f(x), abf(x)dx=F(b)F(a)\int_a^b f(x)\,dx = F(b)-F(a). We call FF an antiderivative of ff — you can just think of it as the function we substitute into.
We use it in daily life too. When speed varies, total distance is the integral of speed. Total quantity over time (e.g. logistics, power consumption) is also found by integrating over an interval.
In probability, the chance that a continuous variable falls in some range is the integral of the probability density over that range — e.g. “temperature between 20–25°C”, or “dimension within tolerance” in quality control.
In artificial intelligence and deep learning, integration is essential. Models that use continuous probability distributions (image generation, speech, prediction) compute interval probabilities and expectations via integration. Distribution-based models like VAE, normalizing flows, and Bayesian neural networks cannot be fully described without integrals, and in reinforcement learning the expected cumulative reward is an integral. Ch10–Ch12 on probability and distributions use integration naturally.
In physics, distance, work, charge, and flow are often “cumulative” quantities obtained by integration. Integrating acceleration gives velocity; integrating velocity gives distance.
In economics, demand or cost over time is sometimes aggregated using integration when the flow is continuous.
In AI, integration is used in these ways: (1) Generative models — VAE, diffusion models, etc. compute expectations and log-likelihood of continuous distributions by integration. (2) Bayesian inference — posterior means and probabilities are integrals. (3) Reinforcement learning — a policy’s expected reward is the integral of the reward function. (4) Continuous outputs — when a prediction is an interval, “probability of falling in that interval” is also an integral. Learning definite integrals and antiderivatives here makes Ch10+ probability and AI chapters much easier.
For a definite integral, follow ① identify lower and upper limits → ② find the “undo” function → ③ (value at upper limit) − (value at lower limit).
What is an “antiderivative”? — It’s the function you get when you undo the derivative of the expression inside the integral. Example: the derivative of 2x2x is 22, so if we “undo” that, the antiderivative of 22 is 2x2x. You can just think of it as the function we plug the limits into and subtract — no need to worry about the name.
Step 1: Identify lower and upper limits — In abf(x)dx\int_a^b f(x)\,dx, aa is the lower limit and bb is the upper limit. If you see 13\int_1^3, then lower is 1 and upper is 3.
Step 2: Find the “undo” function (antiderivative) — Find a function that, when differentiated, gives the expression inside the integral. Common rules: xnx^nxn+1/(n+1)x^{n+1}/(n+1), constant cccxcx, xxx2/2x^2/2. For a sum, find the “undo” for each term and add them.
Step 3: Substitute and subtract — Plug the upper limit bb into F(x)F(x), plug the lower limit aa, and subtract: F(b)F(a)F(b)-F(a). That’s the answer.
Check and tips — Differentiate your F(x)F(x) to make sure you get the integrand back. Always use F(upper)F(lower)F(\text{upper})-F(\text{lower}).
What is an "indefinite integral"? — When there are no upper/lower limits, we write the antiderivative + C only. Example: 2xdx=x2+C\int 2x\,dx = x^2 + C. Here CC is any constant. If a problem later asks "what is the value at x=2x=2?", you just plug 2 into x2+Cx^2+C; in this course we take C=0C=0, so the answer is 22=42^2=4. Think of the indefinite integral as the antiderivative with +C+C used in definite integrals.
“Find the value of the antiderivative at a given point” — When the problem gives you the antiderivative (e.g. 2xdx=x2+C\int 2x\,dx = x^2+C) and asks “what is the value at x=2x=2?”, substitute 2 into that expression. With C=0C=0, 22=42^2=4 is the answer.
Example problems and step-by-step solutions. (Steps ①·②·③ for definite integrals; ①·② only for the substitution example.)
Ex 1. 023dx\int_0^2 3\,dx
① Lower 0, upper 2.
② "Undo" of 33 is 3x3x.
3230=63\cdot 2 - 3\cdot 0 = 66
Ex 2. 132xdx\int_1^3 2x\,dx
① Lower 1, upper 3.
② "Undo" of 2x2x is x2x^2.
3212=83^2 - 1^2 = 88
Ex 3. 02(1+x)dx\int_0^2 (1+x)\,dx
① Lower 0, upper 2.
11xx, xxx2/2x^2/2 so x+x2/2x + x^2/2.
(2+2)(0+0)=4(2+2)-(0+0)=44
Ex 4. 2xdx=x2+C\int 2x\,dx = x^2+C, value at x=2x=2?
① Substitute into x2+Cx^2+C.
x=2x=2, C=0C=022=42^2 = 44