2
Part Zero · Foundations

Calculus refresher

Type sin 0.3 into a calculator and it answers 0.2955202067 at once. But the chip inside can only add, subtract, multiply and divide. It has no little triangle to measure. So how does it know?

The answer is the most useful idea in this chapter: almost any smooth curve can be imitated, as closely as you like, by a polynomial, and a polynomial needs nothing but arithmetic. To build that polynomial we need derivatives, and to trust it we need to know how wrong it is. That is the whole of calculus you will need for a long while.

Zooming in

Pick a point on the sine curve and a second point a short distance hh further along. The straight line through them, the secant, has a slope you can work out with arithmetic. Now shrink the gap: hh = 1.00.

As hh shrinks, the secant swings into the tangent, the line that just touches the curve, and its slope settles on a single number. That number is the derivative:

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

For the sine curve the slope always comes out as the height of the cosine curve at the same point. Watch the readout: the secant slope closes in on cos⁡x\cos x.

Two rules that do most of the work

You rarely need the limit itself. Two rules, both proved from it, handle almost every case. The product rule says that if two quantities are multiplied, a small change in the product comes from changing each in turn: (fg)′=f′g+fg′(fg)' = f'g + fg'. The chain rule says that if one quantity depends on another, the rates multiply: ddxf(g(x))=f′(g(x)) g′(x)\frac{d}{dx}f(g(x)) = f'(g(x))\,g'(x).

Deeper

For the product rule, write f(x+h)g(x+h)−f(x)g(x)=[f(x+h)−f(x)] g(x+h)+f(x) [g(x+h)−g(x)]f(x+h)g(x+h) - f(x)g(x) = [f(x+h)-f(x)]\,g(x+h) + f(x)\,[g(x+h)-g(x)]. Divide by hh and let h→0h\to0; g(x+h)→g(x)g(x+h)\to g(x) because a differentiable function is continuous.

For the chain rule, the change in gg is Δg≈g′(x) h\Delta g \approx g'(x)\,h, and the change in ff is Δf≈f′(g) Δg\Delta f \approx f'(g)\,\Delta g. Multiply. (A careful proof handles the case Δg=0\Delta g = 0 separately.)

Building sine out of arithmetic

Here is the calculator’s trick. Choose a polynomial that matches sine at 0: same height, same slope, same curvature, same rate of change of curvature, and so on. Each match fixes one coefficient, and the result is the Taylor series:

sin⁡x=x−x33!+x55!−x77!+⋯\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots

Use 1 terms and watch the amber polynomial wrap itself around the sine curve. At x=0.3x = 0.3 it gives 0.3, against the true 0.2955202067.

With three terms the answer is already right to seven decimal places, using only multiplication and division. That is, roughly, what the chip does.

How wrong is it?

A series you cannot trust is useless, so we need an error bound. For a series like this one, whose terms alternate in sign and shrink, the error is smaller than the first term you left out. With three terms at x=0.3x = 0.3, that next term is 0.37/7!≈4×10−80.3^7/7! \approx 4\times10^{-8}, and the true error is 4.3×10−84.3\times10^{-8}.

Now move away from zero: evaluate at xx = 0.3. With few terms the polynomial peels away from the curve and the error explodes.

So a real calculator first uses the symmetries of sine to bring any angle into a small range near zero, and only then runs a short series. Knowing where an approximation fails is as important as the approximation.

Adding up

The other half of calculus runs the other way. Instead of a slope, ask for an accumulated total: the area under a curve from 0 up to some point xx. The fundamental theorem of calculus says that the rate at which this area grows is just the height of the curve at the edge. So areas and slopes undo each other:

ddx∫0xf(t) dt=f(x)\frac{d}{dx}\int_0^x f(t)\,dt = f(x)

The plate shades the area under the cosine curve, and the area traces out the sine curve. Slide the edge to 1.5. Area below the axis counts as negative.

The bell curve’s secret

One integral appears so often in quantum mechanics that it deserves a name. The bell curve e−x2e^{-x^2} has no antiderivative made of ordinary functions, yet its total area is known exactly:

∫−∞∞e−x2 dx=π≈1.7725\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi} \approx 1.7725

The plate adds up the area between −R-R and RR, with RR = 1.0. By R=3R = 3 you already have π\sqrt\pi to four decimal places: the tails are tiny.

Deeper

Call the integral II. Then I2=∫ ⁣ ⁣∫e−(x2+y2) dx dyI^2 = \int\!\!\int e^{-(x^2+y^2)}\,dx\,dy over the whole plane. In polar coordinates dx dy=r dr dθdx\,dy = r\,dr\,d\theta, so I2=∫02π ⁣dθ∫0∞e−r2r dr=2π⋅12=πI^2 = \int_0^{2\pi}\!d\theta\int_0^\infty e^{-r^2} r\,dr = 2\pi\cdot\tfrac12 = \pi. The extra rr is what makes the radial integral easy.

A preview of relativity

Taylor series also explain why old physics still works. Einstein’s energy of a moving body contains the factor 1/1−v2/c21/\sqrt{1-v^2/c^2}. Expand it for speeds far below light:

11−u=1+u2+3u28+⋯\frac{1}{\sqrt{1-u}} = 1 + \frac{u}{2} + \frac{3u^2}{8} + \cdots

With u=v2/c2u = v^2/c^2, the energy mc2/1−v2/c2mc^2/\sqrt{1-v^2/c^2} becomes mc2+12mv2+⋯mc^2 + \tfrac12 mv^2 + \cdots. Newton’s kinetic energy is the second term of a series. Many of the classical laws you learned are the first terms of something deeper, and this book will keep showing you which.

What you now have

Derivatives as limits, two rules that compute almost any of them, integrals as accumulated totals, and Taylor series with an honest error bound. That kit carries you through the next hundred chapters.

· · ·

Three questions to carry with you.

Why can a chip that only does arithmetic compute sin x?tap
It evaluates a polynomial, a Taylor series cut off after a few terms, after first using symmetry to move the angle close to zero.
For an alternating series with shrinking terms, how big is the error after stopping?tap
Smaller than the first term you left out.
What does the fundamental theorem of calculus connect?tap
Slopes and areas: differentiating the accumulated area under a curve gives back the curve.

And one to work out. Using 1+x≈1+x/2\sqrt{1+x}\approx 1 + x/2, estimate 1.02\sqrt{1.02}.

≈

Sources: S. P. Thompson, Calculus Made Easy (1910). M. Spivak, Calculus. J. Stewart, Calculus. Values checked by code: sin 0.3 = 0.2955202067; three-term error 4.3×10⁻⁸; ∫e^(−x²)dx = √π (SymPy).

Next · Chapter 3
Multivariable calculus and vector fields

Can you know how much water leaves a region just by watching its boundary?

Turn the page