Skip to content
The Lumenary
Grades 9–12Ages 16–18 90 min

Introductory calculus

Speed at an instant and the area under a curve look like two unrelated problems. Limits solve both — and the fundamental theorem of calculus shows that they undo each other.

Formally verified · 16 LeanComputationally tested · 2 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review

Your guides: Chloe, Margaret, Gideon

MotivationH

Two questions about motion

A stone is dropped from a bridge. Ignoring air resistance, after tt seconds it has fallen about s(t)=4.9 t2s(t) = 4.9\,t^2 metres. How fast is it falling at exactly t=1t = 1?

Speed is distance divided by time — but at a single instant no time passes and no distance is covered, so "distance ÷ time" reads 00\tfrac00. What we can compute is the average speed over a short interval from t=1t = 1 to t=1+ht = 1 + h:

s(1+h)−s(1)h=4.9(1+2h+h2)−4.9h=9.8h+4.9h2h=9.8+4.9h(h≠0).\frac{s(1 + h) - s(1)}{h} = \frac{4.9(1 + 2h + h^2) - 4.9}{h} = \frac{9.8h + 4.9h^2}{h} = 9.8 + 4.9h \qquad (h \ne 0).

Over 0.10.1 s this is 10.2910.29 m/s; over 0.0010.001 s it is 9.80499.8049 m/s. As hh shrinks, the averages close in on 9.89.8 m/s. That number — the value the averages approach — is the speed at the instant t=1t = 1.

The opposite question is just as old: a car's speedometer is recorded every moment of a journey from Accra to Kumasi. How far did the car travel? If the speed were constant, distance would be speed × time, the area of a rectangle under the speed–time graph. When the speed varies, the distance is the area under the graph — and computing areas under curves again means adding up more and more, thinner and thinner pieces.

Calculus is the mathematics of these two limits: the derivative (instantaneous rate of change) and the integral (accumulated total). Its central surprise, the fundamental theorem of calculus, is that each undoes the other.

IntuitionH

Zooming in and slicing up

Zoom in on the graph of a smooth function, such as y=x2y = x^2 near the point (1,1)(1, 1). The more you magnify, the straighter the curve looks; under a strong enough microscope it is indistinguishable from a straight line, the tangent line. The slope of that line is the derivative: how fast yy changes per unit change of xx, right at that point.

To find an area, do the opposite: cut the region under the curve into thin vertical strips, replace each strip by a rectangle, and add up the rectangles. Thinner strips give better approximations, and the area is what these sums approach.

Both ideas rest on a single notion: the limit, the value that approximations approach as some quantity (hh, or the strip width) shrinks to 00 — without ever being 00.

DefinitionsH

Definitions

Definition— limit (informal)

We write lim⁡x→af(x)=L\displaystyle\lim_{x \to a} f(x) = L ("the limit of f(x)f(x) as xx tends to aa is LL") if f(x)f(x) can be made as close to LL as we like by taking xx close enough to aa, but not equal to aa. The value f(a)f(a) — if it exists at all — plays no part.

The precise version ("for every ε>0\varepsilon > 0 there is a δ>0\delta > 0 such that 0<∣x−a∣<δ0 < |x - a| < \delta implies ∣f(x)−L∣<ε|f(x) - L| < \varepsilon") took mathematicians until the 19th century to find; it is the starting point of real analysis. In this lesson we use the following limit laws, which can be proved from that definition: if lim⁡x→af(x)=L\lim_{x \to a} f(x) = L and lim⁡x→ag(x)=M\lim_{x \to a} g(x) = M, then f+g→L+Mf + g \to L + M, fg→LMf g \to L M, cf→cLcf \to cL, and f/g→L/Mf/g \to L/M provided M≠0M \ne 0; also lim⁡x→ac=c\lim_{x \to a} c = c and lim⁡x→ax=a\lim_{x \to a} x = a. Consequently lim⁡x→ap(x)=p(a)\lim_{x \to a} p(x) = p(a) for every polynomial pp. Limits also respect inequalities: if f(x)≤g(x)f(x) \le g(x) near aa, then L≤ML \le M.

A function is continuous at aa if lim⁡x→af(x)=f(a)\lim_{x \to a} f(x) = f(a): the value is what the nearby values predict.

Definition— derivative

The derivative of ff at aa is

f′(a)=lim⁡h→0f(a+h)−f(a)h,f'(a) = \lim_{h \to 0} \frac{f(a + h) - f(a)}{h},

when this limit exists; then ff is differentiable at aa. The fraction is the slope of the secant line through (a,f(a))(a, f(a)) and (a+h,f(a+h))(a + h, f(a + h)), and f′(a)f'(a) is the slope of the tangent line y=f(a)+f′(a)(x−a)y = f(a) + f'(a)(x - a). The function x↦f′(x)x \mapsto f'(x) is the derivative function f′f', also written dydx\dfrac{dy}{dx} or ddxf(x)\dfrac{d}{dx} f(x).

Definition— Riemann sum and definite integral

Divide [a,b][a, b] into nn strips of width Δx=b−an\Delta x = \tfrac{b - a}{n} and choose a point xk∗x_k^* in the kk-th strip (its left end, right end or midpoint). The Riemann sum is ∑kf(xk∗) Δx\sum_{k} f(x_k^*)\,\Delta x. If these sums approach a single number as n→∞n \to \infty (for every way of choosing the points), that number is the definite integral ∫abf(x) dx\displaystyle\int_a^b f(x)\,dx. Strips where f<0f < 0 contribute negatively: the integral is a signed area. Continuous functions on [a,b][a, b] always have integrals (a theorem of real analysis).

Definition— antiderivative

A function FF is an antiderivative of ff on an interval if F′(x)=f(x)F'(x) = f(x) for every xx in it. For example x33\tfrac{x^3}{3}, and also x33+7\tfrac{x^3}{3} + 7, are antiderivatives of x2x^2.

Worked examplesH

Worked examples

Example— Limits from tables, and limits by algebra

  • A table. For f(x)=sin⁡xxf(x) = \tfrac{\sin x}{x} (with xx in radians): f(0.1)≈0.99833f(0.1) \approx 0.99833, f(0.01)≈0.9999833f(0.01) \approx 0.9999833, f(−0.01)≈0.9999833f(-0.01) \approx 0.9999833. The table suggests lim⁡x→0sin⁡xx=1\lim_{x \to 0} \tfrac{\sin x}{x} = 1, which is true — but a table is evidence, not proof (a table can be fooled by a function that misbehaves between the sample points).
  • Algebra. lim⁡x→1x2−1x−1\displaystyle\lim_{x \to 1}\frac{x^2 - 1}{x - 1}: for x≠1x \ne 1, x2−1x−1=(x−1)(x+1)x−1=x+1\tfrac{x^2 - 1}{x - 1} = \tfrac{(x - 1)(x + 1)}{x - 1} = x + 1, so the limit is 1+1=21 + 1 = 2. The function is not even defined at x=1x = 1; the limit exists anyway.
  • No limit. 1x\tfrac1x has no limit at 00 (it grows without bound), and the sign function, −1-1 for x<0x < 0 and 11 for x>0x > 0, has none either: from the left it is near −1-1, from the right near 11.

Example— Derivatives from the definition

For f(x)=x2f(x) = x^2 and h≠0h \ne 0:   (a+h)2−a2h=2ah+h2h=2a+h→2a\;\dfrac{(a + h)^2 - a^2}{h} = \dfrac{2ah + h^2}{h} = 2a + h \to 2a. So f′(a)=2af'(a) = 2a: the slope of the parabola doubles as aa doubles.

For f(x)=1xf(x) = \tfrac1x and a≠0a \ne 0:   1a+h−1ah=a−(a+h)h a(a+h)=−1a(a+h)→−1a2\;\dfrac{\frac{1}{a + h} - \frac1a}{h} = \dfrac{a - (a + h)}{h\,a(a + h)} = \dfrac{-1}{a(a + h)} \to -\dfrac{1}{a^2}.

The tangent line to y=x2y = x^2 at a=3a = 3 has slope 66 and passes through (3,9)(3, 9): y=9+6(x−3)=6x−9y = 9 + 6(x - 3) = 6x - 9.

Example— Finding the turning points

Let f(x)=x3−3xf(x) = x^3 - 3x. Then f′(x)=3x2−3=3(x−1)(x+1)f'(x) = 3x^2 - 3 = 3(x - 1)(x + 1), which is 00 at x=±1x = \pm 1. For x<−1x < -1, f′>0f' > 0 (rising); for −1<x<1-1 < x < 1, f′<0f' < 0 (falling); for x>1x > 1, f′>0f' > 0 again. So ff has a local maximum f(−1)=2f(-1) = 2 and a local minimum f(1)=−2f(1) = -2.

Example— An optimisation

A farmer in Malawi has 2020 m of fencing for a rectangular goat pen. With sides xx and 10−x10 - x, the area is A(x)=x(10−x)=10x−x2A(x) = x(10 - x) = 10x - x^2 for 0≤x≤100 \le x \le 10. Then A′(x)=10−2x=0A'(x) = 10 - 2x = 0 at x=5x = 5, where A=25A = 25; at the ends A(0)=A(10)=0A(0) = A(10) = 0. The best pen is a 5×55 \times 5 square.

Explore

Explore: secants, tangents and strips

Shrink hh and watch the secant through PP and QQ turn into the tangent. For f(x)=x2f(x) = x^2 at x0=1x_0 = 1 the table of slopes should approach 22 — and you know exactly why, since the slope is 2+h2 + h.

From secant to tangent

The slope of the secant is exactly 2 + h. What happens as h shrinks? Then try fn = abs(x - 1).

PQ
  • f(x) = x²
  • secant through P and Q
  • tangent line (numerical slope)

Slope of the secant PQ

(f(x₀ + h) − f(x₀)) / h = (4 − 1) / 1 = 3

Slope of the tangent at P

f′(1) ≈ 2

Numerical estimate (central difference with a tiny step).

Difference quotients as h shrinks

h(f(x₀ + h) − f(x₀)) / h
13
0.12.1
0.012.01
0.0012.001

As h shrinks, Q slides towards P, the secant turns into the tangent, and its slope settles on the derivative f′(x₀).

Now the area under y=x2y = x^2 from 00 to 11, which we will prove is exactly 13\tfrac13. Compare left, right and midpoint sums, and watch the errors shrink as the strips multiply.

Riemann sums for the parabola

Right sums overestimate and left sums underestimate an increasing function. Which rule is most accurate?

  • f(x) = x²

Right sum with 8 strips

R8 = 0.398438

Exact value of the integral

∫01 f(x) dx = 0.333333

Error (sum − integral)

0.065104

All four rules with n = 8

RuleSumError
Left (L8)0.273438−0.059896
Right (R8)0.3984380.065104
Midpoint (M8)0.332031−0.001302
Trapezoid (T8)0.3359380.002604

Double n and watch the error: left and right sums roughly halve it, midpoint and trapezoid sums cut it to about a quarter.

Finally, x3x^3 at 00: the tangent is horizontal, yet the graph keeps climbing through it.

Horizontal tangents

Move the sliders and trace along the curves to read off values.

f′(0) = 0, no extremumlocal maxlocal min
  • y = x³
  • tangent to x³ at 0
  • y = x³ − 3x
  • y = x³: y = 1
  • tangent to x³ at 0: y = 0
  • y = x³ − 3x: y = −2
ProofH

The rules of differentiation

Theorem— Theorem 1 (differentiable implies continuous)

If ff is differentiable at aa, then lim⁡h→0f(a+h)=f(a)\lim_{h \to 0} f(a + h) = f(a).

Proof

For h≠0h \ne 0,   f(a+h)−f(a)=f(a+h)−f(a)h⋅h\;f(a + h) - f(a) = \dfrac{f(a + h) - f(a)}{h}\cdot h. As h→0h \to 0 the first factor tends to f′(a)f'(a) and the second to 00, so by the product law the difference tends to f′(a)⋅0=0f'(a)\cdot 0 = 0.

∎

The converse is false: ∣x∣|x| is continuous at 00, but its difference quotient ∣h∣h\tfrac{|h|}{h} is 11 for h>0h > 0 and −1-1 for h<0h < 0, so it has no limit. A graph with a corner has no tangent there.

Theorem— Theorem 2 (sums and constant multiples)

If ff and gg are differentiable at aa and cc is a constant, then (f+g)′(a)=f′(a)+g′(a)(f + g)'(a) = f'(a) + g'(a) and (cf)′(a)=cf′(a)(cf)'(a) = c f'(a).

Proof

The difference quotient of f+gf + g is the sum of the difference quotients of ff and gg, and that of cfcf is cc times that of ff; apply the limit laws.

∎

Theorem— Theorem 3 (product rule)

If ff and gg are differentiable at aa, then (fg)′(a)=f′(a)g(a)+f(a)g′(a)(fg)'(a) = f'(a)g(a) + f(a)g'(a).

Proof

Add and subtract f(a+h)g(a)f(a + h)g(a):

f(a+h)g(a+h)−f(a)g(a)h=f(a+h) g(a+h)−g(a)h+g(a) f(a+h)−f(a)h.\frac{f(a + h)g(a + h) - f(a)g(a)}{h} = f(a + h)\,\frac{g(a + h) - g(a)}{h} + g(a)\,\frac{f(a + h) - f(a)}{h}.

As h→0h \to 0: f(a+h)→f(a)f(a + h) \to f(a) by Theorem 1, and the two quotients tend to g′(a)g'(a) and f′(a)f'(a). By the limit laws the whole expression tends to f(a)g′(a)+g(a)f′(a)f(a)g'(a) + g(a)f'(a).

∎

Theorem— Theorem 4 (power rule)

For every integer n≥1n \ge 1:   ddxxn=nxn−1\;\dfrac{d}{dx} x^n = n x^{n-1}.

Proof

Induction on nn. For n=1n = 1, the difference quotient of xx is (a+h)−ah=1\tfrac{(a + h) - a}{h} = 1, so the derivative is 1=1⋅x01 = 1 \cdot x^0. Suppose ddxxn=nxn−1\tfrac{d}{dx}x^n = nx^{n-1}. Writing xn+1=xn⋅xx^{n+1} = x^n \cdot x, the product rule gives

ddxxn+1=nxn−1⋅x+xn⋅1=(n+1)xn.\frac{d}{dx}x^{n+1} = nx^{n-1}\cdot x + x^n \cdot 1 = (n + 1)x^n.

∎

With Theorem 2, every polynomial can now be differentiated term by term: ddx(4x3−5x+2)=12x2−5\tfrac{d}{dx}(4x^3 - 5x + 2) = 12x^2 - 5. (The constant 22 has derivative 00: its difference quotient is 2−2h=0\tfrac{2 - 2}{h} = 0.)

Theorem— Theorem 5 (Fermat's theorem on interior extrema)

Suppose ff is defined on an open interval containing aa, has a local maximum or minimum at aa, and is differentiable at aa. Then f′(a)=0f'(a) = 0.

Proof

Take a local maximum: f(a+h)≤f(a)f(a + h) \le f(a) for all small hh. For small h>0h > 0 the difference quotient f(a+h)−f(a)h\tfrac{f(a + h) - f(a)}{h} has numerator ≤0\le 0 and denominator >0> 0, so it is ≤0\le 0; since limits respect inequalities, f′(a)≤0f'(a) \le 0. For small h<0h < 0 the numerator is ≤0\le 0 and the denominator <0< 0, so the quotient is ≥0\ge 0, giving f′(a)≥0f'(a) \ge 0. Hence f′(a)=0f'(a) = 0. For a minimum, apply this to −f-f.

∎

The converse is false. For f(x)=x3f(x) = x^3, f′(0)=3⋅02=0f'(0) = 3 \cdot 0^2 = 0, but 00 is neither a maximum nor a minimum: t3>0t^3 > 0 for every t>0t > 0 and (−t)3<0(-t)^3 < 0, however small tt is. A zero derivative only marks a candidate; to decide, look at the sign of f′f' on each side (as in the worked example) or compare values.

ProofH

Area under a parabola, and the fundamental theorem

Archimedes found the area of a parabolic segment more than 2,200 years ago. Here is the modern version of that result, by Riemann sums.

Theorem— Lemma 6 (sum of squares)

For every n≥0n \ge 0:   02+12+22+⋯+n2=n(n+1)(2n+1)6\;0^2 + 1^2 + 2^2 + \dots + n^2 = \dfrac{n(n + 1)(2n + 1)}{6}.

Proof

Induction on nn. For n=0n = 0 both sides are 00. If the formula holds for nn, then

n(n+1)(2n+1)6+(n+1)2=(n+1)(2n2+n+6n+6)6=(n+1)(n+2)(2n+3)6,\frac{n(n + 1)(2n + 1)}{6} + (n + 1)^2 = \frac{(n + 1)\big(2n^2 + n + 6n + 6\big)}{6} = \frac{(n + 1)(n + 2)(2n + 3)}{6},

which is the formula for n+1n + 1, because 2n2+7n+6=(n+2)(2n+3)2n^2 + 7n + 6 = (n + 2)(2n + 3).

∎

Theorem— Theorem 7 (the area under y = x² on [0, 1] is 1/3)

The right and left Riemann sums of f(x)=x2f(x) = x^2 on [0,1][0, 1] with nn strips are

Rn=(n+1)(2n+1)6n2,Ln=(n−1)(2n−1)6n2,R_n = \frac{(n + 1)(2n + 1)}{6n^2}, \qquad L_n = \frac{(n - 1)(2n - 1)}{6n^2},

and both tend to 13\tfrac13 as n→∞n \to \infty. Hence ∫01x2 dx=13\displaystyle\int_0^1 x^2\,dx = \frac13.

Proof

The kk-th strip is [k−1n,kn]\big[\tfrac{k - 1}{n}, \tfrac kn\big], of width 1n\tfrac1n. Using right endpoints and Lemma 6,

Rn=∑k=1n(kn)21n=12+⋯+n2n3=n(n+1)(2n+1)6n3=(n+1)(2n+1)6n2.R_n = \sum_{k=1}^{n} \Big(\frac kn\Big)^2 \frac1n = \frac{1^2 + \dots + n^2}{n^3} = \frac{n(n + 1)(2n + 1)}{6n^3} = \frac{(n + 1)(2n + 1)}{6n^2}.

With left endpoints we get 02+⋯+(n−1)2n3=(n−1)(2n−1)6n2\tfrac{0^2 + \dots + (n - 1)^2}{n^3} = \tfrac{(n - 1)(2n - 1)}{6n^2} in the same way. Dividing top and bottom by n2n^2,

Rn=(1+1n)(2+1n)6→1⋅26=13,Ln=(1−1n)(2−1n)6→13.R_n = \frac{\big(1 + \frac1n\big)\big(2 + \frac1n\big)}{6} \to \frac{1 \cdot 2}{6} = \frac13, \qquad L_n = \frac{\big(1 - \frac1n\big)\big(2 - \frac1n\big)}{6} \to \frac13.

Since x2x^2 is increasing on [0,1][0, 1], every Riemann sum with nn strips lies between LnL_n and RnR_n (each strip's height lies between the heights at its two ends), so every Riemann sum tends to 13\tfrac13.

∎

Computing every area this way would be exhausting. The fundamental theorem gives a shortcut.

Theorem— Fundamental theorem of calculus

If ff is continuous on [a,b][a, b] and FF is an antiderivative of ff there, then

∫abf(x) dx=F(b)−F(a).\int_a^b f(x)\,dx = F(b) - F(a).

We give the idea rather than a complete proof (which belongs to real analysis). Let A(x)=∫axf(t) dtA(x) = \int_a^x f(t)\,dt be the area accumulated from aa up to xx. Increasing xx by a small hh adds a thin strip of width hh and height about f(x)f(x), so A(x+h)−A(x)≈f(x) hA(x + h) - A(x) \approx f(x)\,h, and dividing by hh suggests A′(x)=f(x)A'(x) = f(x) — making this precise uses the continuity of ff. So AA and FF have the same derivative, and two functions with the same derivative on an interval differ by a constant (a consequence of the mean value theorem). Hence A(x)=F(x)+CA(x) = F(x) + C; putting x=ax = a gives 0=F(a)+C0 = F(a) + C, and putting x=bx = b gives ∫abf=F(b)−F(a)\int_a^b f = F(b) - F(a).

Example— Integrals by antiderivatives

  • ∫01x2 dx=[x33]01=13\displaystyle\int_0^1 x^2\,dx = \Big[\tfrac{x^3}{3}\Big]_0^1 = \tfrac13, matching Theorem 7 — two very different routes to the same number.
  • ∫02x2 dx=83−0=83\displaystyle\int_0^2 x^2\,dx = \tfrac83 - 0 = \tfrac83.
  • ∫0πsin⁡x dx=[−cos⁡x]0π=1+1=2\displaystyle\int_0^{\pi} \sin x\,dx = \big[-\cos x\big]_0^{\pi} = 1 + 1 = 2, but ∫02πsin⁡x dx=−cos⁡2π+cos⁡0=0\displaystyle\int_0^{2\pi} \sin x\,dx = -\cos 2\pi + \cos 0 = 0: the area below the axis on [π,2π][\pi, 2\pi] counts negatively and cancels the area above.
Formal mathematicsF

Calculus in Lean

Mathlib states that ff has derivative f′f' at aa as HasDerivAt f f' a, and writes limits with filters: Tendsto g (𝓝[≠] 0) (𝓝 L) says "g(h)→Lg(h) \to L as h→0h \to 0 with h≠0h \ne 0". First the derivative of x2x^2 straight from the definition, in three steps that mirror the human computation:

diff_quotient_sqLean 4Proved here from basic factsFormally verified
/-- **The difference quotient of `x²`.** For `h ≠ 0`,
`((a + h)² − a²)/h = (2ah + h²)/h = 2a + h`. -/
theorem diff_quotient_sq (a h : ℝ) (hh : h ≠ 0) : ((a + h) ^ 2 - a ^ 2) / h = 2 * a + h := by
  field_simp
  ring
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
tendsto_diff_quotient_sqLean 4Proved here from basic factsFormally verified
/-- **Its limit is `2a`.** As `h → 0` with `h ≠ 0`, the quotient equals `2a + h`, and
`2a + h → 2a`. The value at `h = 0` itself is never used. -/
theorem tendsto_diff_quotient_sq (a : ℝ) :
    Tendsto (fun h => ((a + h) ^ 2 - a ^ 2) / h) (𝓝[≠] 0) (𝓝 (2 * a)) := by
  have hlin : Tendsto (fun h : ℝ => 2 * a + h) (𝓝[≠] 0) (𝓝 (2 * a)) := by
    have : Tendsto (fun h : ℝ => 2 * a + h) (𝓝 0) (𝓝 (2 * a + 0)) :=
      tendsto_const_nhds.add tendsto_id
    rw [add_zero] at this
    exact tendsto_nhdsWithin_of_tendsto_nhds this
  refine tendsto_nhdsWithin_congr (fun h hh => ?_) hlin
  exact (diff_quotient_sq a h hh).symm
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
hasDerivAt_sqLean 4Proved here from basic factsFormally verified
/-- **`(x²)′ = 2a` at every point `a`**, from the limit definition: Mathlib's `HasDerivAt` is
equivalent (`hasDerivAt_iff_tendsto_slope_zero`) to the difference quotients tending to the
derivative, and we computed that limit above. -/
theorem hasDerivAt_sq (a : ℝ) : HasDerivAt (fun x : ℝ => x ^ 2) (2 * a) a := by
  rw [hasDerivAt_iff_tendsto_slope_zero]
  refine (tendsto_diff_quotient_sq a).congr (fun t => ?_)
  simp [smul_eq_mul, div_eq_inv_mul]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor

The power rule, by induction with Mathlib's product rule HasDerivAt.mul — the proof of Theorem 4 — and Mathlib's own version:

power_ruleLean 4Proved here from basic factsFormally verified
/-- **The power rule** `(xⁿ⁺¹)′ = (n + 1) xⁿ`, by induction on `n`.
For `n = 0`, `(x¹)′ = 1`. For the step write `x^(n+2) = x^(n+1) · x` and use the product rule
`(uv)′ = u′v + uv′`: the derivative is `(n + 1)xⁿ · x + x^(n+1) · 1 = (n + 2) x^(n+1)`.
(We write the exponent as `n + 1` so that the rule never needs `n − 1`.) -/
theorem power_rule (n : ℕ) (x : ℝ) :
    HasDerivAt (fun y : ℝ => y ^ (n + 1)) ((n + 1) * x ^ n) x := by
  induction n with
  | zero => simpa using hasDerivAt_id' x
  | succ k ih =>
    have h := ih.mul (hasDerivAt_id x)
    have hf : (fun y : ℝ => y ^ (k + 1 + 1)) = (fun y : ℝ => y ^ (k + 1)) * id := by
      funext y
      simp [pow_succ]
    rw [hf]
    convert h using 1
    push_cast
    simp only [id]
    ring
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
power_rule_libraryLean 4Applies a library theoremFormally verified
/-- The power rule from Mathlib, `hasDerivAt_pow`: `(xⁿ)′ = n xⁿ⁻¹` (with natural-number
subtraction, so for `n = 0` it reads `(x⁰)′ = 0 · x^0 = 0`, which is still correct). -/
theorem power_rule_library (n : ℕ) (x : ℝ) :
    HasDerivAt (fun y : ℝ => y ^ n) (n * x ^ (n - 1)) x :=
  hasDerivAt_pow n x
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor

Fermat's theorem from Mathlib, and the counterexample to its converse, proved here:

fermatLean 4Applies a library theoremFormally verified
/-- **Fermat's theorem on interior extrema:** if `f` has a local maximum or minimum at `a` and is
differentiable there, then `f′(a) = 0`. This applies Mathlib's
`IsLocalExtr.hasDerivAt_eq_zero`. -/
theorem fermat {f : ℝ → ℝ} {a f' : ℝ} (hext : IsLocalExtr f a) (hd : HasDerivAt f f' a) :
    f' = 0 :=
  hext.hasDerivAt_eq_zero hd
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
cube_deriv_zeroLean 4Proved here from basic factsFormally verified
/-- `x³` has derivative `3 · 0² = 0` at `0` (the power rule with `n = 2`). -/
theorem cube_deriv_zero : HasDerivAt (fun x : ℝ => x ^ 3) 0 0 := by
  have h := power_rule 2 0
  norm_num at h
  exact h
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
cube_not_extremumLean 4Proved here from basic factsFormally verified
/-- **The converse of Fermat's theorem is false.** `x³` has `f′(0) = 0`, but `0` is neither a
local maximum nor a local minimum: however small an interval around `0` we take, it contains a
point `t > 0` with `t³ > 0 = f(0)` and the point `−t` with `(−t)³ < 0`. -/
theorem cube_not_extremum : ¬ IsLocalExtr (fun x : ℝ => x ^ 3) 0 := by
  rintro (hmin | hmax)
  · -- A local minimum would need `x³ ≥ 0` near `0`; `x = −ε/2` breaks it.
    obtain ⟨ε, hε, h⟩ := Metric.eventually_nhds_iff.mp hmin
    have hd : dist (-(ε / 2)) 0 < ε := by
      rw [Real.dist_eq, sub_zero, abs_neg, abs_of_pos (by linarith)]
      linarith
    have := h hd
    simp only at this
    nlinarith [pow_pos (half_pos hε) 3]
  · -- A local maximum would need `x³ ≤ 0` near `0`; `x = ε/2` breaks it.
    obtain ⟨ε, hε, h⟩ := Metric.eventually_nhds_iff.mp hmax
    have hd : dist (ε / 2) 0 < ε := by
      rw [Real.dist_eq, sub_zero, abs_of_pos (by linarith)]
      linarith
    have := h hd
    simp only at this
    nlinarith [pow_pos (half_pos hε) 3]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
limit_not_valueLean 4Proved here from basic factsFormally verified
/-- **The limit at a point need not be the value there.** `f(x) = (x² − 1)/(x − 1)` tends to `2`
as `x → 1`, because `f(x) = x + 1` for `x ≠ 1`. At `x = 1` the formula reads `0/0`, which is
meaningless on paper; Lean's convention `0/0 = 0` gives `f(1) = 0` — a value that has nothing to
do with the limit `2`. -/
theorem limit_not_value :
    Tendsto (fun x : ℝ => (x ^ 2 - 1) / (x - 1)) (𝓝[≠] 1) (𝓝 2) ∧
      (fun x : ℝ => (x ^ 2 - 1) / (x - 1)) 1 = 0 := by
  constructor
  · have hlin : Tendsto (fun x : ℝ => x + 1) (𝓝[≠] 1) (𝓝 2) := by
      have : Tendsto (fun x : ℝ => x + 1) (𝓝 1) (𝓝 (1 + 1)) :=
        tendsto_id.add tendsto_const_nhds
      norm_num at this
      exact tendsto_nhdsWithin_of_tendsto_nhds this
    refine tendsto_nhdsWithin_congr (fun x hx => ?_) hlin
    have hx1 : x - 1 ≠ 0 := sub_ne_zero.mpr hx
    field_simp
    ring
  · norm_num
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor

Theorem 7, with the right Riemann sums as a Lean definition:

sum_squaresLean 4Proved here from basic factsFormally verified
/-- `0² + 1² + ⋯ + n² = n(n + 1)(2n + 1)/6`, by induction on `n`. -/
theorem sum_squares (n : ℕ) :
    ∑ k ∈ range (n + 1), (k : ℝ) ^ 2 = n * (n + 1) * (2 * n + 1) / 6 := by
  induction n with
  | zero => simp
  | succ m ih =>
    rw [sum_range_succ, ih]
    push_cast
    ring
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
rightSumLean 4Formally verified
/-- The **right Riemann sum** of `f(x) = x²` on `[0, 1]` with `n` strips of width `1/n`: the
strip over `[k/n, (k + 1)/n]` has height `f((k + 1)/n)`. -/
noncomputable def rightSum (n : ℕ) : ℝ :=
  ∑ k ∈ range n, (((k : ℝ) + 1) / n) ^ 2 * (1 / n)
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
rightSum_formulaLean 4Proved here from basic factsFormally verified
/-- **A closed form for the Riemann sum:** for `n ≥ 1`,
`rightSum n = (1² + 2² + ⋯ + n²)/n³ = (n + 1)(2n + 1)/(6n²)`. -/
theorem rightSum_formula (n : ℕ) (hn : n ≠ 0) :
    rightSum n = ((n : ℝ) + 1) * (2 * n + 1) / (6 * (n : ℝ) ^ 2) := by
  have hn' : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hn
  have key : ∑ k ∈ range n, ((k : ℝ) + 1) ^ 2 = (n : ℝ) * (n + 1) * (2 * n + 1) / 6 := by
    have h := sum_squares n
    rw [sum_range_succ'] at h
    simpa using h
  have hsum : rightSum n = (∑ k ∈ range n, ((k : ℝ) + 1) ^ 2) / (n : ℝ) ^ 3 := by
    rw [rightSum, sum_div]
    refine sum_congr rfl (fun k _ => ?_)
    field_simp
  rw [hsum, key]
  field_simp
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
rightSum_tendstoLean 4Proved here from basic factsFormally verified
/-- **The Riemann sums converge to `1/3`.** For `n ≥ 1`,
`(n + 1)(2n + 1)/(6n²) = (1 + 1/n)(2 + 1/n)/6`, and `1/n → 0`, so the limit is
`(1 · 2)/6 = 1/3`: the area under `y = x²` from `0` to `1`. -/
theorem rightSum_tendsto : Tendsto rightSum atTop (𝓝 (1 / 3)) := by
  have hlim : Tendsto (fun n : ℕ => (1 + 1 / (n : ℝ)) * (2 + 1 / (n : ℝ)) / 6) atTop
      (𝓝 ((1 + 0) * (2 + 0) / 6)) :=
    ((tendsto_const_nhds.add tendsto_one_div_atTop_nhds_zero_nat).mul
      (tendsto_const_nhds.add tendsto_one_div_atTop_nhds_zero_nat)).div_const 6
  norm_num at hlim
  refine hlim.congr' ?_
  filter_upwards [eventually_ne_atTop 0] with n hn
  have hn' : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hn
  rw [rightSum_formula n hn]
  field_simp
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor

Mathlib's integral is not defined by Riemann sums but by a more general construction (the Lebesgue, or Bochner, integral), which agrees with the Riemann integral for continuous functions. We did not formalise that agreement for this example; instead we compute the integral with Mathlib's fundamental theorem of calculus and with its table of integrals:

ftc_squareLean 4Applies a library theoremFormally verified
/-- **The fundamental theorem in action:** `∫₀² x² dx = 8/3`. Since `F(x) = x³/3` has
`F′(x) = x²`, the integral is `F(2) − F(0) = 8/3`. This applies Mathlib's fundamental theorem
`intervalIntegral.integral_eq_sub_of_hasDerivAt`. -/
theorem ftc_square : ∫ x in (0 : ℝ)..2, x ^ 2 = 8 / 3 := by
  have hF : ∀ x ∈ Set.uIcc (0 : ℝ) 2, HasDerivAt (fun y : ℝ => y ^ 3 / 3) (x ^ 2) x := by
    intro x _
    have h := (hasDerivAt_pow 3 x).div_const 3
    convert h using 1
    norm_num
  have hint : IntervalIntegrable (fun x : ℝ => x ^ 2) MeasureTheory.volume 0 2 :=
    (continuous_pow 2).intervalIntegrable 0 2
  rw [intervalIntegral.integral_eq_sub_of_hasDerivAt hF hint]
  norm_num
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
integral_sq_unitLean 4Applies a library theoremFormally verified
/-- `∫₀¹ x² dx = 1/3`, the limit of the Riemann sums above, from Mathlib's `integral_pow`. -/
theorem integral_sq_unit : ∫ x in (0 : ℝ)..1, x ^ 2 = 1 / 3 := by
  rw [integral_pow]
  norm_num
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
integral_sin_signedLean 4Applies a library theoremFormally verified
/-- **Integrals are signed.** `∫₀^{2π} sin x dx = cos 0 − cos 2π = 0`: the area above the axis
on `[0, π]` cancels the area below it on `[π, 2π]`. This applies Mathlib's `integral_sin`. -/
theorem integral_sin_signed : ∫ x in (0 : ℝ)..(2 * Real.pi), Real.sin x = 0 := by
  rw [integral_sin]
  simp
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/IntroCalculus.leanTry it in the Lean web editor
ComputationC

Exact, numerical and symbolic calculus

Difference quotients: exact, numerical and symbolicPythonExact computationNumerical approximationSymbolic computationComputationally tested
"""Derivatives as limits of difference quotients - and the limits of floats.

For f(x) = x^2 the difference quotient ((a + h)^2 - a^2)/h equals 2a + h
exactly (checked with fractions), so it tends to 2a. For f = sin at a = 1 the
quotient tends to cos 1, but in floating point the error first shrinks like h
(the mathematics) and then grows again like 1e-16/h (rounding: subtracting two
nearly equal numbers). SymPy computes the limit and the power rule exactly.
"""

import math
from fractions import Fraction

import sympy

def forward_quotient(f, a, h):
    """(f(a + h) - f(a)) / h, the slope of a secant line."""
    if h == 0:
        raise ValueError("h must be non-zero")
    return (f(a + h) - f(a)) / h

def central_quotient(f, a, h):
    """(f(a + h) - f(a - h)) / (2h), a symmetric secant slope."""
    if h == 0:
        raise ValueError("h must be non-zero")
    return (f(a + h) - f(a - h)) / (2 * h)

def square(x):
    """f(x) = x^2."""
    return x * x

def quotient_errors(exponents):
    """Rows (h, forward error, central error) for sin at 1 against cos 1."""
    exact = math.cos(1.0)
    rows = []
    for k in exponents:
        h = 10.0 ** (-k)
        fwd = abs(forward_quotient(math.sin, 1.0, h) - exact)
        cen = abs(central_quotient(math.sin, 1.0, h) - exact)
        rows.append((h, fwd, cen))
    return rows

def symbolic_results():
    """SymPy's limit of the sine quotient and derivative of x^n."""
    x, h = sympy.symbols("x h")
    n = sympy.symbols("n", positive=True, integer=True)
    lim = sympy.limit((sympy.sin(1 + h) - sympy.sin(1)) / h, h, 0)
    deriv = sympy.simplify(sympy.diff(x ** n, x))
    return lim, deriv

def main():
    print("Exact fractions: ((a + h)^2 - a^2)/h for a = 3")
    for h in [Fraction(1, 10), Fraction(1, 1000), Fraction(-1, 10 ** 6)]:
        q = forward_quotient(square, Fraction(3), h)
        print(f"  h = {str(h):>10}:  quotient = {q}  (= 2a + h)")
    print()
    print("Floats: sin at a = 1, compared with cos 1")
    print("      h      forward error   central error")
    for h, fwd, cen in quotient_errors(range(1, 14, 2)):
        print(f"  {h:8.0e}     {fwd:.2e}        {cen:.2e}")
    print("The forward error falls like h, the central one like h^2, until")
    print("rounding (about 1e-16 / h) takes over for tiny h.")
    print()
    lim, deriv = symbolic_results()
    print(f"SymPy: limit of (sin(1 + h) - sin 1)/h as h -> 0 is {lim}")
    print(f"SymPy: d/dx x^n = {deriv}")
    print()
    print("Epistemic status: the fraction rows are exact; the float table is")
    print("numerical evidence affected by rounding, so it can suggest but")
    print("never prove a limit; the SymPy results are symbolic computations.")
    print("The lesson's proofs establish the derivatives for every a and n.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The float table holds a lesson. Making hh smaller first improves the estimate of cos⁡1\cos 1, as the mathematics predicts; but below about h=10−8h = 10^{-8} the error grows again. The computer stores sin⁡(1+h)\sin(1 + h) and sin⁡1\sin 1 with about 16 significant digits, and subtracting two nearly equal numbers wipes out most of them. A limit is an idea about exact numbers; numerical methods must balance the two kinds of error (see Numerical methods).

Riemann sums for the parabola, exactlyPythonExact computationExhaustive finite checkSymbolic computationNumerical approximationComputationally tested
"""Riemann sums for the area under y = x^2, computed exactly.

With fractions there is no rounding at all: the right Riemann sum of x^2 on
[0, 1] with n strips is exactly (n + 1)(2n + 1)/(6n^2), its error is exactly
1/(2n) + 1/(6n^2), and the midpoint sum misses 1/3 by exactly 1/(12n^2). The
fundamental theorem (via SymPy) gives the limit 1/3 at once. A last check
shows that integrals are signed: midpoint sums of sin on [0, 2 pi] tend to 0.
"""

import math
from fractions import Fraction

import sympy

def riemann_sum(f, a, b, n, rule="right"):
    """Sum of n strips of width (b - a)/n; heights at the left end, right
    end or midpoint of each strip. Exact when f, a, b are rational."""
    if n < 1:
        raise ValueError("n must be at least 1")
    offset = {"left": Fraction(0), "right": Fraction(1), "midpoint": Fraction(1, 2)}
    if rule not in offset:
        raise ValueError("rule must be left, right or midpoint")
    width = (b - a) / n
    return sum(f(a + (k + offset[rule]) * width) for k in range(n)) * width

def square(x):
    """f(x) = x^2."""
    return x * x

def right_closed_form(n):
    """(n + 1)(2n + 1) / (6 n^2), the right sum of x^2 on [0, 1]."""
    return Fraction((n + 1) * (2 * n + 1), 6 * n * n)

def antiderivative_check():
    """SymPy: an antiderivative of x^2 and the integral over [0, 1]."""
    x = sympy.symbols("x")
    return sympy.integrate(x ** 2, x), sympy.integrate(x ** 2, (x, 0, 1))

def main():
    zero, one = Fraction(0), Fraction(1)
    third = Fraction(1, 3)
    agree = all(
        riemann_sum(square, zero, one, n) == right_closed_form(n)
        for n in range(1, 201)
    )
    print(f"Right sum = (n+1)(2n+1)/(6n^2) exactly for n = 1..200: {agree}")
    print()
    print("   n   left sum      right sum     midpoint      right - 1/3")
    for n in [1, 2, 4, 10, 100]:
        left = riemann_sum(square, zero, one, n, "left")
        right = riemann_sum(square, zero, one, n, "right")
        mid = riemann_sum(square, zero, one, n, "midpoint")
        print(f"{n:4d}   {float(left):.8f}    {float(right):.8f}    "
              f"{float(mid):.8f}    {str(right - third)}")
    n = 100
    err_right = riemann_sum(square, zero, one, n) - third
    err_mid = riemann_sum(square, zero, one, n, "midpoint") - third
    print(f"n = 100: right error = 1/(2n) + 1/(6n^2)? "
          f"{err_right == Fraction(1, 2 * n) + Fraction(1, 6 * n * n)}")
    print(f"n = 100: midpoint error = -1/(12n^2)? "
          f"{err_mid == Fraction(-1, 12 * n * n)}")
    print()
    anti, area = antiderivative_check()
    print(f"SymPy: antiderivative {anti}, so the area is F(1) - F(0) = {area}")
    print()
    signed = riemann_sum(math.sin, 0.0, 2 * math.pi, 1000, "midpoint")
    above = riemann_sum(math.sin, 0.0, math.pi, 1000, "midpoint")
    print(f"sin on [0, 2pi], 1000 strips: |midpoint sum| < 1e-12? "
          f"{abs(signed) < 1e-12}")
    print(f"Signed area cancels: the part above the axis alone is {above:.6f}")
    print("(the exact value of that part is 2).")
    print()
    print("Epistemic status: the fraction sums are exact and the closed form")
    print("is checked for n = 1..200 only (the lesson proves it for all n);")
    print("SymPy's integral is symbolic; the sine sums are floating point.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

With fractions there is no rounding at all, and the experiment confirms the closed form of Theorem 7 for every nn up to 200200 — evidence for those cases, while the induction proves it for all nn. It also measures the errors exactly: the right sum is off by 12n+16n2\tfrac{1}{2n} + \tfrac{1}{6n^2}, the midpoint sum by only 112n2\tfrac{1}{12n^2}.

Exercises

Exercises

1. Introductory calculus

Warm-upHuman

Find lim⁡x→3x2−9x−3\displaystyle\lim_{x \to 3} \frac{x^2 - 9}{x - 3}.

2. Introductory calculus

Warm-upHuman

Let f(x)=4x3−5x+2f(x) = 4x^3 - 5x + 2. Compute f′(1)f'(1).

3. Introductory calculus

CoreHuman

The tangent line to y=x2−4xy = x^2 - 4x at x=3x = 3 has equation y=mx+cy = mx + c. Find cc.

4. Introductory calculus

CoreHuman

For f(x)=x3−12xf(x) = x^3 - 12x, which statement is correct?

Choose one

5. Introductory calculus

CoreHuman

Which function is a counterexample to the claim "if f′(0)=0f'(0) = 0 then ff has a local maximum or minimum at 00"?

Choose one

6. Introductory calculus

CoreHuman

Compute ∫03(x2−2x) dx\displaystyle\int_0^3 (x^2 - 2x)\,dx.

7. Introductory calculus

StretchHuman

In the proof of Fermat's theorem, ff has a local maximum at aa. Why is f(a+h)−f(a)h≥0\dfrac{f(a + h) - f(a)}{h} \ge 0 for small negative hh?

Choose one

8. Introductory calculus

CoreFormal

In Lean, with f := fun x : ℝ => (x ^ 2 - 1) / (x - 1), the lesson proves both Tendsto f (𝓝[≠] 1) (𝓝 2) and f 1 = 0. What is the right conclusion?

Choose one

9. Introductory calculus

StretchComputational

Write right_sum(f, a, b, n) returning the right Riemann sum ∑k=1nf ⁣(a+k b−an)b−an\sum_{k=1}^{n} f\!\left(a + k\,\tfrac{b - a}{n}\right)\tfrac{b - a}{n}. Use Fraction so that the sums are exact when a, b are fractions and f is a polynomial. Then check Theorem 7: for f(x)=x2f(x) = x^2 on [0,1][0, 1] it should equal (n+1)(2n+1)6n2\tfrac{(n + 1)(2n + 1)}{6n^2}.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

Common misconceptions

Misconception

"If f′(a)=0f'(a) = 0, then ff has a maximum or minimum at aa." Fermat's theorem only goes one way. f(x)=x3f(x) = x^3 has f′(0)=0f'(0) = 0 and no extremum at 00. Conversely, an extremum can occur where f′f' does not exist (∣x∣|x| at 00) or at an endpoint of the interval.

Misconception

"The limit at a point is the value there." Only for continuous functions. x2−1x−1\tfrac{x^2 - 1}{x - 1} has limit 22 at 11 but no value there; a function that is 00 everywhere except f(0)=5f(0) = 5 has limit 00 at 00 but value 55. The definition of lim⁡x→a\lim_{x \to a} explicitly ignores x=ax = a.

Misconception

"An integral always gives a (positive) area." Integrals are signed: ∫02πsin⁡x dx=0\int_0^{2\pi}\sin x\,dx = 0. To get the total geometric area between a graph and the axis, integrate ∣f∣|f| — in practice, split the interval where ff changes sign.

Misconception

"To find the derivative, put h=0h = 0 in the difference quotient." At h=0h = 0 the quotient is 00\tfrac00, which is meaningless. You must first simplify for h≠0h \ne 0 (as in 2ah+h2h=2a+h\tfrac{2ah + h^2}{h} = 2a + h) and then take the limit.

Misconception

"ddxxn=xn−1\tfrac{d}{dx}x^n = x^{n-1}." The exponent comes down as a factor: ddxxn=nxn−1\tfrac{d}{dx}x^n = nx^{n-1}. Check with x2x^2: the slope at 33 is 66, not 33.

ViewpointsH

Other ways of seeing

Geometry— The best straight-line approximation

The derivative is the slope of the line that fits the graph best near aa: f(a+h)=f(a)+f′(a)h+E(h)f(a + h) = f(a) + f'(a)h + E(h), where the error E(h)E(h) is small compared with hh (E(h)/h→0E(h)/h \to 0). For x2x^2, E(h)=h2E(h) = h^2 exactly. This "linearisation" view is the one that generalises: in several variables the derivative becomes a linear map (a matrix), and on curved spaces it becomes a map between tangent planes. See Multivariable and vector calculus.

Physics— Velocity, acceleration and Newton

Newton invented his "method of fluxions" to describe motion: velocity is the derivative of position, acceleration the derivative of velocity, and his second law F=maF = ma says force determines the second derivative of position. For the falling stone, s(t)=4.9t2s(t) = 4.9t^2 gives v(t)=9.8tv(t) = 9.8t and a(t)=9.8a(t) = 9.8 m/s², the constant acceleration due to gravity near the Earth's surface. Reading the integral backwards, the distance travelled is the area under the velocity graph: ∫029.8t dt=19.6\int_0^2 9.8t\,dt = 19.6 m in the first two seconds. (The model ignores air resistance — physics, not mathematics, decides when that is acceptable.)

Analysis— Making 'close' precise

Newton and Leibniz could compute brilliantly but could not say exactly what a limit is; Bishop Berkeley mocked their vanishing increments as "ghosts of departed quantities". Cauchy (1821) and Weierstrass made it precise with inequalities (ε\varepsilon and δ\delta), and the subject became rigorous enough to handle shocks: Weierstrass (1872) published a function that is continuous everywhere and differentiable nowhere, and the theorems quoted here — limit laws, the integrability of continuous functions, the mean value theorem — all rest on the completeness of the real numbers (see Real numbers).

Computation— When there is no formula

Most integrals cannot be written with familiar functions — ∫01e−x2 dx\int_0^1 e^{-x^2}\,dx is a famous example — so they are computed numerically. The midpoint and trapezoid rules have errors proportional to 1n2\tfrac{1}{n^2} for smooth functions, and Simpson's rule to 1n4\tfrac{1}{n^4}; derivatives are estimated by difference quotients whose step hh must balance truncation error against rounding error, as the experiment shows. See Numerical methods.

Wonder Trails

Wonder Trails

History & global context

History and global context

  • Ancient areas and volumes. Archimedes (3rd century BCE) proved in Quadrature of the Parabola that a parabolic segment has 43\tfrac43 the area of an inscribed triangle, by the "method of exhaustion". In China, Liu Hui (3rd century CE) approximated the circle by polygons with ever more sides, and Zu Chongzhi and his son Zu Geng (5th–6th centuries) found the volume of a sphere using a principle of comparing cross-sections later rediscovered by Cavalieri.
  • Medieval advances. Ibn al-Haytham (about 1000 CE, in Cairo) found formulas for sums of fourth powers and used them to compute the volume of a solid of revolution of a parabola. In Kerala, Mādhava of Saṅgamagrāma (14th century) and his school found infinite series for sine, cosine and the arctangent, centuries before they appeared in Europe.
  • The invention of calculus. Pierre de Fermat (1630s) found tangents and maxima with methods close to our difference quotients. Isaac Newton (from the 1660s) and Gottfried Wilhelm Leibniz (published from 1684) independently created calculus and recognised the fundamental theorem; Leibniz's notations dydx\tfrac{dy}{dx} and ∫\int are still used. A bitter priority dispute followed. Maria Gaetana Agnesi's Instituzioni analitiche (1748) was one of the first comprehensive calculus textbooks and was widely translated.
  • Rigour. Augustin-Louis Cauchy (1821) based calculus on limits, Bernhard Riemann (1854) defined the integral by the sums named after him, and Karl Weierstrass gave limits their ε\varepsilon–δ\delta form.
Further reading

Further reading

  • Silvanus P. Thompson, Calculus Made Easy (1910) — still a friendly first read ("what one fool can do, another can").
  • Gilbert Strang, Calculus (1991) — a complete course with many applications.
  • Michael Spivak, Calculus (1967) — the rigorous next step, proving everything this lesson states.
  • Tom M. Apostol, Calculus, Volume 1 (1961) — integration before differentiation, as in history.
  • C. H. Edwards, The Historical Development of the Calculus (1979).