Calculus
Derivative & integral the mathematics of change and area
The derivative tells you how fast something changes: the slope of a tangent line, a car’s speed, a growth rate. The integral adds up tiny pieces into a whole: the area under a curve, the distance traveled, even the number π. Newton and Leibniz discovered that these are two sides of the same coin.
Functions
2x^2 − 3, sin(x)/x, |x − 1|
Parameters
Gallery
Show
How to read a graph?
A function is a recipe: it assigns each number x exactly one number f(x). Its graph is the set of all points (x; f(x)).
A zero (root) is an x for which f(x) = 0. A local maximum is the “top of a hill” and a minimum the “bottom of a dip.” At both, the tangent is horizontal, i.e. f′(x) = 0 (provided the derivative exists; |x| has its minimum at a sharp “beak”).
An asymptote is a line that the graph approaches ever more closely. The hyperbola y = 1/x has two: the vertical x = 0 and the horizontal y = 0. We never connect the graph across a vertical asymptote.
The program finds special points numerically (sign changes and golden-section search) within the visible part of the axis.
Function
Difference quotient
Position, velocity, acceleration
Let x be time t in seconds and f(t) the car’s position in meters.
Differentiation rules
| constant, constant factor | (c)′ = 0, (c·f)′ = c·f′ |
| power | (xn)′ = nxn−1 |
| sum | (f ± g)′ = f′ ± g′ |
| sine | (sin x)′ = cos x |
| cosine | (cos x)′ = −sin x |
| exponential | (ex)′ = ex, (ax)′ = ax ln a |
| logarithm | (ln x)′ = 1x |
| product | (f g)′ = f′g + f g′ |
| quotient | (fg)′ = f′g − f g′g2 |
| chain (composite function) | (f(g(x)))′ = f′(g(x))·g′(x) |
Highlighted rules were used to compute the derivative of the current function.
What is a derivative?
Take two points on the graph: x and x + h. The line through them is a secant, and its slope is the difference quotient — “how much y grew per unit of x.”
ΔyΔx = f(x+h) − f(x)h
As h shrinks to zero, the second point “slides into” the first, and the secant turns until it becomes the tangent. Its slope is the derivative f′(x). Leibniz wrote it as dydx — a ratio of “infinitely small” increments.
When f′ > 0, the function is increasing (tangent green); when f′ < 0, it is decreasing (red). Where f′ = 0 lies a stationary point: a peak, a dip or a momentary “flattening.”
We compute the derivative symbolically (using the rules in the table) with light simplification; when that fails, the program switches to numerical quotients with a very small h.
Function
Method
Error vs. number of subintervals
Log-log scale: a line with slope −p means error ∝ 1/np.
Fundamental theorem of calculus
F(x) = ∫xaf(t) dt — the area accumulated from a to x.
What is an integral?
We split the area under the curve into n narrow strips and add up their areas. The narrower the strips, the better the approximation; the definite integral is the limit of these sums:
∫baf(x) dx = limn→∞ Σ f(xi) Δx
The sign ∫ is an elongated “S” from the Latin summa. Area below the x-axis counts with a minus sign (pink).
Order of a method: left and right rectangles have error ∝ 1/n, midpoint and trapezoids ∝ 1/n², Simpson (parabolas through three points) ∝ 1/n⁴. Doubling n cuts the error by a factor of 2, 4 and 16, respectively.
The Newton–Leibniz theorem: if F′ = f, then ∫baf dx = F(b) − F(a). Integration undoes differentiation.
We compute the exact value from an antiderivative (when the program can find one), and otherwise with adaptive Simpson’s method to an accuracy of about 10⁻¹². Improper integrals (e.g. across an asymptote) are not computed here.
Method of exhaustion
Archimedes started with hexagons and doubled the number of sides up to 96, obtaining 31071 < π < 317. We compute the perimeters with his recursion (harmonic and geometric means), without using π. This is the ancestor of the integral: a curved shape approximated by straight pieces. More methods: The number π.
Area of a quarter circle
∫10√1 − x2 dx = π4
Arctangent and a series
∫10dx1 + x2 = arctan 1 = π4
We expand 1/(1 + x²) = 1 − x² + x⁴ − … (a geometric series) and integrate term by term:
1 − 13 + 15 − 17 + … = π4
Newton’s binomial and a semicircle
π = 24 (∫¼0√x − x2 dx + √332)
How did Newton do it?
The curve y = √x − x2 is a semicircle with center (½; 0) and radius ½. The area under it from 0 to ¼ is a 60° sector (area π/24) minus a triangle of area √3/32 — hence the formula above.
Newton expanded √1 − x = 1 − ½x − ⅛x² − … with his generalized binomial formula, multiplied by √x and integrated each term separately. Successive terms shrink roughly 4-fold, so each one adds about 0.6 digits.
In the winter of 1665/66, when Cambridge was closed because of the plague, the young Newton got about 15 digits of π this way. Years later he wrote that he was ashamed to admit to how many digits he had carried these computations, having no other business at the time.
The Gaussian integral
∫∞−∞e−x² dx = √π
The polar-coordinates trick
Call the integral we want I. Then I² = ∬ e−(x²+y²) dx dy is the volume under a two-dimensional “bell.” We slice it into thin rings of radius r: I² = ∫∞0e−r²·2πr dr = π, so I = √π.
The function e−x² has no antiderivative expressible in elementary functions, and yet we know the area under the whole curve exactly. The trapezoidal rule is remarkably effective here because the function is smooth and vanishes quickly at the ends.
Digit counter
How many correct digits of π each method gives at the current settings, and how much work it costs (terms, samples or doublings).
| method | work | digits |
|---|
Horizontal axis: work on a logarithmic scale. Double-precision numbers hold about 16 digits, so that is our ceiling.
Hover over a step (or Tab to it) to highlight what it refers to on the graph.
How to analyze a function
This is how a function is analyzed in advanced high-school math and at university: domain → zeros and sign → parity → limits and asymptotes → first derivative (monotonicity, extrema) → second derivative (concavity, inflection points) → table → graph.
An extremum occurs where f′ changes sign, not everywhere that f′ = 0 (e.g. x³ at zero). Slant asymptote y = ax + b: a = lim f(x)/x, b = lim (f(x) − ax).
We compute exact results with fractions and roots (no rounding). When the exact method fails, the program says so and gives an approximation marked “≈”.
Signs: = < > ≤ ≥ ≠ (or <=, >=, !=). The interval [from; to] is used to search for numerical and periodic solutions, e.g. from 0 to 2π. Square brackets [ ] denote a closed interval.
MathematicsNewton, Leibniz and infinitesimals
Two discoverers
In 1665–1666 Isaac Newton developed his “method of fluxions”: he thought of quantities flowing in time and of their rates of change. Independently, around 1675, Gottfried Wilhelm Leibniz created differential and integral calculus with the notation we still use today, and was the first to publish it (1684 and 1686). A bitter priority dispute broke out; today both are recognized as the founders of calculus.
The notation dy/dx and ∫
Leibniz wrote dy/dx — a ratio of very small increments dy and dx — and ∫ y dx — a sum of the areas of infinitely thin strips of width dx. Newton put a dot over the letter (ẋ), and the notation f′(x) was popularized by Lagrange.
What is a limit?
A limit is a value that something gets arbitrarily close to. The quotient [f(x+h) − f(x)]/h makes no sense for h = 0 (0/0), but for smaller and smaller h its values cluster ever closer to a single number — and that is the derivative. The precise definition (“for every ε there exists a δ”) was given only in the 19th century, by Cauchy and Weierstrass.
Simplifications on this page
Computations use double-precision floating-point numbers (about 16 digits), so for very small h the difference quotient starts to jitter from rounding errors. Special points and discontinuities are detected numerically within the visible part of the graph. The parser understands only the listed set of functions, and symbolic integration covers only simple cases.
Did you know…?
- The ∫ sign first appeared in Leibniz’s notes dated October 29, 1675. It is an elongated letter “s” from the Latin summa.
- The series 1 − 1/3 + 1/5 − … was already known to the Indian mathematician Madhava of Sangamagrama around 1400, more than 250 years before Leibniz and Gregory.
- The 1712 Royal Society report that awarded Newton priority in the dispute with Leibniz was largely written by Newton himself, then the Society’s president.
Challenges
Challenges check themselves. Your progress is saved in this browser.