mathphile

mathphile

I

Where it began

Before there were numerals, there were notches.

God made the integers; all else is the work of man.
Leopold Kronecker
I.1 · Where it began

Ways of counting

Every culture found a way to write a number. Type one and see how six of them would have written it.

try · type a number or drag the slider, from 1 to almost a billion, and see six civilisations write it

Before there were numerals there were notches. Then someone noticed that where a mark sits can matter as much as what it is.

The tally is the oldest: one mark for one thing. The Babylonians, about four thousand years ago, wrote in base 60 with two wedges, one for ones and one for tens, and we still divide hours and degrees by 60. The Romans had no place value at all, which made arithmetic hard enough that merchants used a counting board. In China, from about the fourth century BC, calculators laid bamboo counting rods on a board in columns, vertical rods in one place and horizontal in the next, with an empty space for zero. In India, by the seventh century, the same idea gained a written zero, and the Indian mathematician Brahmagupta gave rules for arithmetic with it. The Persian scholar Muhammad al-Khwarizmi's ninth-century book carried those numerals into the Arabic-speaking world, and the Italian mathematician Leonardo of Pisa, known as Fibonacci, carried them to Europe in 1202. The ten digits you are reading now are that long relay. Binary, the last row, is what every computer in this exhibit speaks.

Go deeper
365 = 3 × 10² + 6 × 10¹ + 5 × 10⁰ = 6 × 60 + 5

Place value is a polynomial in disguise: each digit multiplies a power of the base. Change the base and you change only the bookkeeping. 365 is 6 sixties and 5 in base 60, and 101101101 in base 2. The idea that an empty place needs a symbol of its own took a long time to settle: the Babylonians left a gap, later a mark that was not yet a number, and only in India did zero become something that could be added, subtracted and multiplied.

There is no royal road to geometry.
Euclid
I.2 · Where it began

Squares on a triangle

Drag a corner. The two small squares always add up to the big one. That is a theorem, and a theorem is something you cannot make fail.

try · drag either end of the two short sides and watch the squares follow

a² + b² = c². Babylonian scribes knew it, Chinese and Indian geometers drew it, and Euclid proved it for every right triangle there will ever be.

A clay tablet called Plimpton 322, from about 1800 BC, lists whole-number triples such as 3-4-5 and 5-12-13. The Chinese Zhoubi Suanjing, compiled in the centuries around the turn of the era, shows the same relation in a diagram, and Indian geometers wrote it into the Sulba Sutras. What Euclid added, in Book I of the Elements around 300 BC, was something different: not a case, not a picture, but an argument that works for every right triangle at once. That is what the word proof has meant ever since, a chain of steps each forced by the last, ending somewhere you did not know you could go. Look for a right triangle where the squares disagree. Nobody has found one, and the reason is not that people stopped looking.

Go deeper
a = m² − n²,   b = 2mn,   c = m² + n²

That is Euclid's recipe for whole-number right triangles: choose any m > n and it gives a triple, 3-4-5 from m = 2, n = 1 and 5-12-13 from m = 3, n = 2. More than three hundred separate proofs of the theorem have been collected, one by James Garfield in 1876, five years before he became US president. The theorem is also the root of distance itself: the length between two points on a map, and the straight-line distance a self-driving car estimates to a cyclist, are both its hypotenuse.

I.3 · Where it began

A short history of certainty

Forty moments. Not the most important, since a list of those would start arguments, but the ones that changed what counted as knowing.

II

Pattern

The same few shapes keep turning up.

II.1 · Pattern

π The circle, unrolled

Take any circle. Walk around it, and you have gone a little more than three times across it. That little more has no end.

try · tap the square to drop points · press Rain to pour them · type your birthday as six digits to find it in π

Throw darts at a square with a circle inside. The share that lands in the circle approaches π⁄4. Chance, patiently counted, measures a shape.

π is the ratio of a circle's circumference to its diameter. It is the same for every circle that has ever been drawn, which is why it deserves a name. It is irrational, so its decimal expansion never repeats; it is transcendental, so no finite equation with whole-number coefficients can pin it down. Archimedes trapped it between 3 ¹⁰⁄₇₁ and 3 ¹⁄₇ by squeezing a circle between polygons of 96 sides. We now know over a hundred trillion digits, and still nobody knows whether every digit appears equally often.

Go deeper
π = 4 (1 − ⅓ + ⅕ − ⅐ + ⅑ − …)

Leibniz's series is beautiful and hopeless: it needs about 10 billion terms for ten correct digits. The digits below are computed live in your browser from the English astronomer John Machin's 1706 formula, π = 16 arctan(1⁄5) − 4 arctan(1⁄239), which converges fast enough to be useful. Type a string of digits in the box above and the site will find where it first occurs. Every birthday has been found; so has every phone number, if you wait long enough, assuming, as everyone believes but no one has proved, that π is normal.

II.2 · Pattern

φ The sunflower's angle

A plant places each new seed one turn of the golden angle after the last. Move the slider a fraction of a degree and watch order collapse.

try · slide the angle a fraction of a degree away from 137.508° and watch the order collapse

φ = 1.6180339887… is the most irrational number: the hardest to approximate by fractions. That is exactly why a plant uses it.

Divide a line so that the whole is to the larger part as the larger is to the smaller, and you have the golden ratio. Its continued fraction is all ones, 1 + 1⁄(1 + 1⁄(1 + …)), so it stays as far as possible from every rational number. A seed head that turns by a rational fraction of a circle would stack its seeds into spokes and waste the space between. Turning by 360°⁄φ² ≈ 137.5° fills the disc most evenly, and the spirals you count are consecutive Fibonacci numbers: 34 one way, 55 the other.

Go deeper
φ = (1 + √5) ⁄ 2,   φ² = φ + 1,   1⁄φ = φ − 1

The Fibonacci sequence 1, 1, 2, 3, 5, 8, 13, 21… has ratios of neighbours that close in on φ from both sides. The Swiss-French architect Le Corbusier built his Modulor around it; the composers Béla Bartók and Claude Debussy, and contemporaries of the American minimalist Philip Glass (born 1937), have been accused of hiding it in their bar counts; the Parthenon has been forced into golden rectangles by people who wanted it there. The honest claims are enough: the pentagon's diagonal to its side is φ, the dodecahedron is built from it, and the seeds in the canvas above are real. Try 137.3°, 137.6°, or 222.5° (which is 360° − 137.5°), and try 90°, 120°, or 144° to see what rational turns do.

II.3 · Pattern

eiπ + 1 = 0

Five constants from five corners of mathematics, meeting in one line. Turn the angle to π and see the point arrive at −1.

try · drag around the circle · press θ = π to land on −1 · press Spin

Multiplying by i is a quarter turn. Growing at rate i is therefore travel along a circle. After a half-turn of length π you stand at −1.

e is the number that makes growth honest: a quantity growing at 100 % per year, compounded continuously, multiplies by e = 2.71828… Euler's formula eiθ = cos θ + i sin θ says that exponential growth in an imaginary direction does not grow at all. It rotates. Set θ = π and the formula collapses to eiπ = −1, which the American physicist Richard Feynman called the most remarkable formula in mathematics. Every wave, every alternating current, every quantum state is written in this notation.

Go deeper
ex = 1 + x + x²⁄2! + x³⁄3! + …

Put x = iθ into the series and the even powers of i are real (+1, −1, +1…) while the odd powers are imaginary. The real terms assemble into the series for cos θ, the imaginary terms into sin θ. Nothing is assumed; the circle simply falls out of the algebra. The faint curve in the canvas is the vertical component traced over time: a sine wave, which is what a circle looks like seen edge-on by someone who can only watch one axis.

II.4 · Pattern

The atoms of number

Write the integers in a square spiral and mark the primes. Nobody told them to line up along diagonals. They do anyway.

try · hover any dot to read its number · press Start at 41 to see Euler’s line of primes

Stanisław Ulam drew this while bored in a 1963 lecture. The diagonal streaks are quadratic polynomials that happen to be unusually rich in primes.

A prime has no divisors except 1 and itself; every other whole number is a product of primes in exactly one way. There are infinitely many, and Euclid's proof is three lines long and 2,300 years old. They thin out slowly: around a large number N, roughly one in every ln N integers is prime. That is the Prime Number Theorem, guessed by a fifteen-year-old Gauss from tables and proved a century later. The fine structure of their distribution is the Riemann Hypothesis, unproved since 1859, with a million dollars waiting.

Go deeper
n² + n + 41 is prime for n = 0, 1, 2, … 39

Euler found that polynomial in 1772. Press "Start at 41" and the spiral's centre runs through its values, drawing a single unbroken diagonal of primes. The reason diagonals are visible at all is that each diagonal in the spiral is a quadratic in the step count, and some quadratics avoid small factors better than others: a quadratic that is never even is twice as likely to be prime as one that often is. Whether any polynomial produces infinitely many primes (other than linear ones, which the German mathematician Peter Gustav Lejeune Dirichlet settled in 1837) is still unknown.

Primes guard your bank account: RSA encryption rests on the fact that multiplying two 300-digit primes is instant and factoring the result is, so far, a thousand-year job.

II.5 · Pattern

Pascal, modulo

Each number is the sum of the two above it. Colour the ones not divisible by n. Every n hides a different carpet.

try · slide mod from 2 to 12 and watch a new pattern appear

Mod 2, Pascal's triangle is the Sierpiński triangle again, named for the Polish mathematician Wacław Sierpiński, who described it in 1915. The same shape from counting as from chance as from contraction. That is what it means for mathematics to be discovered rather than made.

The triangle is older than Pascal. It is in Pingala's Sanskrit prosody around 200 BC, in Chinese texts of the 11th century, and in the Persian poet and mathematician Omar Khayyam, around 1100. Its rows are the binomial coefficients: the number of ways to choose k things from n, the coefficients of (a + b)ⁿ, the counts of paths through a Galton board. Reduced modulo a prime p it is self-similar with p copies per level, which the French mathematician Édouard Lucas proved in 1878: a binomial coefficient is divisible by p exactly when, in base p, some digit of k exceeds the digit of n above it.

Go deeper

Mod 3 gives a carpet with three-fold copies; mod 4 or 6 overlays two patterns because the modulus is composite; mod 12 is a tangle. Tick "shade by residue" to see the actual remainder, not just whether it is zero. The structure persists in grey. The row sums are powers of 2; the shallow diagonals sum to Fibonacci numbers; the central column is the Catalan numbers divided by n + 1. One triangle, read six ways.

II.6 · Pattern

Constants

Numbers that were found, not chosen. Every digit below is computed in your browser the moment the page opens.

II.7 · Pattern

Where the constants live

Numbers that turn up in design, in nature and in engineering. Some really are everywhere. Some are mostly said to be.

The golden ratio, real and imagined

try · add squares and watch the ratio close in on φ

Cut a square off a golden rectangle and what is left is a smaller golden rectangle. It never stops, and the ratio it keeps is φ = 1.618…

Fibonacci numbers, 1, 1, 2, 3, 5, 8, 13 …, build the same spiral of squares, and the ratio of each to the one before closes in on φ. Add squares and watch the readout. Where it is real: the spirals of a sunflower or pine cone, Le Corbusier's Modulor, the design system he published in 1948 from human proportions and the Fibonacci numbers, and Dalí's The Sacrament of the Last Supper (1955), painted on a canvas close to those proportions with a dodecahedron floating over the table. Where it is mostly myth: the Parthenon, the pyramids, the Mona Lisa, and most company logos, which were fitted with circles after the fact. A credit card is 1.586 long to wide, not 1.618.

√2, and why paper works

try · fold again and again; the shape never changes

Fold an A4 sheet in half and you get an A5 sheet with exactly the same proportions. Only one shape can do that: its sides must be in the ratio √2.

Give a sheet sides 1 and r. Folding it across the long side gives a sheet with sides 1 and r ⁄ 2, and for that to be a copy of the original the ratio of its long to short side, 2 ⁄ r, must equal r. So r² = 2. The German physicist Georg Christoph Lichtenberg noticed this in 1786; Germany standardised it in 1922 and the ISO system followed. A0 is one square metre, 841 × 1189 mm, each fold halves the area, and so the A4 in front of you is a sixteenth of a square metre.

e, and money that never stops growing

try · compound more often and watch the total stop at e

Put one euro in a bank that pays 100% a year. Compound it once and you have 2. Twice, 2.25. Every instant, and you reach 2.71828…, and never more.

The Swiss mathematician Jacob Bernoulli found this limit in 1683 by asking exactly that question. The same e governs anything whose growth is proportional to its size, and anything whose decay is: populations, radioactive atoms, a cooling cup of coffee, the half-life of the medicine in the dose chapter.

Feigenbaum, where order breaks

try · slide r to the right and watch one answer split in two, then four, then chaos

Take one rule, x → r·x·(1 − x), and turn up r. The answer settles, then splits in two, then four, then eight, faster each time, until it never settles at all.

The splits arrive at r of about 3, 3.449, 3.544, 3.564, 3.569, and the gaps between them shrink by nearly the same factor every time: 4.6692… The American physicist Mitchell Feigenbaum found that number in 1975 with a pocket calculator, and then found it was the same for every system that breaks into chaos by doubling: dripping taps, electronic circuits, heart cells, animal populations. Different physics, one constant, which is why it earns a place beside π and e. It is the thread of the butterfly chapter, seen from the other end.

α, the number nobody can explain

About 1⁄137.036: the strength of the electromagnetic force, with no units to blame and no theory that predicts it.

α, the fine-structure constant, sets how strongly light and charged particles interact, and so why atoms have the size and colour they do. Richard Feynman called it a magic number that nobody understands. It is a fitting place to end a chapter on constants: the numbers we can derive, and the ones we can only measure.

II.8 · Pattern

Change, in the limit

How steep is a curve at a single point? How much area hides under it? Two questions that look unrelated, and one idea that answers both: get closer, and closer, and see where the numbers settle.

try · drag along the curve to move the point · shrink the gap and watch the cutting line turn into the tangent · add rectangles and watch their total close in on the true area

A speedometer shows how fast you are going right now, but speed is distance divided by time, and in a single instant you cover no distance in no time. Zero divided by zero. Calculus is the mathematics of making sense of that.

Pick two points on a curve and the line through them has a slope anyone can work out: rise over run. Now slide the second point toward the first. The gap h shrinks, the line swings, and its slope settles on one number, the slope of the curve at that point, its derivative. Never at h = 0, always as h heads there: the limit. The same trick works for area. Fill the space under a curve with rectangles; their total is easy to add up and always a little wrong. Use thinner rectangles and the error shrinks; in the limit it vanishes.

Isaac Newton in England and Gottfried Leibniz in Germany found this independently in the 1660s and 1670s and spent years arguing over who came first. Leibniz's notation, dy⁄dx and the long S of ∫, won. Then came the surprise that makes it one subject instead of two: the rate at which the area grows, as you push its right edge along, is exactly the height of the curve there. Slopes and areas undo each other. Every rocket in this journey, every half-life, every orbit was worked out with that sentence.

Go deeper
f′(x) = limh→0 (f(x + h) − f(x)) ⁄ h  ·  d⁄dx ∫0x f(t) dt = f(x)

The first line defines the derivative; the second is the fundamental theorem of calculus. The curve here is f(x) = 1 + 0.6 sin x + 0.15x, so its exact slope is 0.6 cos x + 0.15 and its exact area from 0 to x is x − 0.6 cos x + 0.075x² + 0.6. The readout compares the page's approximations with those exact answers: the secant's error shrinks in step with h, and because each rectangle is as tall as the curve at its middle, their error shrinks with the square of 1⁄n: ten times as many rectangles, a hundred times less wrong. For two thousand years the Greeks had the second idea, Archimedes squeezing the area of a circle between polygons, but not the theorem that ties it to the first. Making "in the limit" fully rigorous took until the 1800s, with the French mathematician Augustin-Louis Cauchy and the German Karl Weierstrass.

A mathematician, like a painter or a poet, is a maker of patterns.
G. H. Hardy, A Mathematician's Apology, 1940
III

Infinity

Follow a rule forever and see what it draws.

III.1 · Infinity

Infinite coastline

One rule (square it, add the starting point, repeat) and an object of unbounded detail. Click anywhere to go closer. There is no bottom.

try · click anywhere to zoom in · shift-click to zoom out · or press a preset

z → z² + c. For each point c of the plane, ask whether that iteration stays bounded. Black if it does. The boundary between yes and no is this.

Benoit Mandelbrot first saw a coarse printout of this set in 1980 at IBM, and assumed the specks around it were dust on the printer. They were baby copies of the whole, connected to the body by filaments too thin to print. The set is connected (Adrien Douady and John Hubbard, 1982), its boundary has fractal dimension exactly 2 (Mitsuhiro Shishikura, 1991), and its area is known only to a few decimal places. Every bulb hanging off the main cardioid corresponds to a rhythm: the biggest bulb is period 2, the next period 3, and the antenna of each bulb has as many spokes as its period.

Go deeper
z0 = 0,   zn+1 = zn² + c

The shading outside shows how many steps the point took to escape beyond radius 2. Once it is past 2 it never returns. The grey bands are therefore contour lines of escape time, smoothed by a logarithm so they don't step. Raise "Detail" when you are deep in, because near the boundary points take longer to make up their mind. Around 10¹³× magnification the arithmetic of a double-precision number runs out of digits; the set does not.

Mandelbrot's point was larger than this picture: coastlines, clouds, lungs, markets and Glass's phase-shifting rhythms are all rough at every scale, and the mathematics of smooth curves had nothing to say about them until he gave roughness a dimension.

III.2 · Infinity

The chaos game

Pick a corner at random. Move halfway there. Mark the spot. Repeat ten thousand times. Randomness, obeying one rule, draws a triangle with holes all the way down.

try · change the corners and the jump and watch a new shape draw itself

The Sierpiński triangle has zero area and infinite perimeter. Its dimension is log 3 ⁄ log 2 ≈ 1.585: more than a line, less than a plane.

No individual point knows where the triangle is. Each jump is random. But every jump is a contraction toward one of three corners, and the only shape left unchanged by all three contractions at once is this one, so the wandering point is herded onto it no matter where it starts. The British mathematician Michael Barnsley, in the 1980s, called this an iterated function system; ferns, clouds and coastlines can be stored as a handful of such rules and regrown on demand.

Go deeper

Five corners and a jump of 0.618 (that is 1⁄φ) give a pentagonal snowflake. Four corners with "no same corner twice" give a carpet. Six corners and 0.667 give a hexagonal lace. The jump fraction r sets the dimension: with k corners the fractal has dimension log k ⁄ log(1⁄r) as long as the copies don't overlap. Set the jump above 0.5 with three corners and the three copies begin to overlap and the holes fill in, and the shape thickens toward the solid triangle at r = 1.

III.3 · Infinity

Sizes of infinity

Some infinities are bigger than others. Georg Cantor proved it in 1891 with a table and a pencil.

try · tap any digit to flip it · press New list for a different one

Write a list of infinite strings of 0s and 1s. Now build a new string by flipping the diagonal. It differs from every string on the list, so the list was never complete.

The whole numbers can be listed one, two, three. Cantor showed that the real numbers cannot be listed at all, however cleverly you try, because the diagonal trick builds a number that every list misses. So the infinity of real numbers is strictly larger than the infinity of whole numbers. Many mathematicians of his day, Kronecker among them, thought this was madness, and Cantor suffered for it. Hilbert later said no one would drive us from the paradise Cantor had made. Whether any size lies between the two, the continuum hypothesis, was shown by Gödel in 1940 and the American mathematician Paul Cohen in 1963 to be undecidable from the usual axioms.

Go deeper
|ℕ| < |ℝ|

The trick is the same shape as Gödel's and Turing's arguments later: assume a complete list, build the one thing it must have missed, and contradict yourself. It is the most reused move in the mathematics of limits.

III.4 · Infinity

Filling space

A line that visits every point of a square. A plan that gives every point to its nearest neighbour. Architecture is the choice of which rule to let a space obey.

try · raise the order · switch to Voronoi and tap to place points

The German-American architect Ludwig Mies van der Rohe said less is more. Hilbert's curve, 1891, is the strictest version: one line, no crossing, every point reached in the limit.

Each order of the Hilbert curve replaces every segment with a smaller copy of the whole, rotated to connect. At order 1 it is a ∪; at order 8 it is 65,535 segments long and the eye reads it as a solid grey square. It is a continuous map from the line onto the plane, which Cantor had shown possible in 1878 and most mathematicians found monstrous: a one-dimensional thing that is also two-dimensional. Today it is how databases index maps: points near each other on the curve are near each other on the ground, so a single sorted list can answer "what is nearby?"

Go deeper

Switch to Voronoi and click to place seeds. Each region is the set of points closer to its seed than to any other; the walls between regions are perpendicular bisectors. The London doctor John Snow drew one by hand in 1854 to show that cholera deaths in Soho clustered around a single water pump. The same diagram appears in dragonfly wings, giraffe hide, drying mud, the structure of foam, and the placement of mobile-phone masts. The dual drawing, which connects every pair of seeds that share a wall, is the Delaunay triangulation, named for the Russian mathematician Boris Delaunay (1934), which is how a surveyor's scattered points become a terrain and how a 3-D scan becomes a mesh.

III.5 · Infinity

The shadow of a cube in four dimensions

A square is the shadow of a cube. A cube is the shadow of this. You cannot see the fourth direction, but you can watch what turning through it does.

try · drag to turn it · change the shape · slow or speed the fourth turn

A point has 1 vertex. Drag it: a line, 2. Drag that: a square, 4. A cube, 8. A tesseract, 16, with 32 edges, 24 square faces and 8 cubic cells.

Nothing in the construction stops at three. Each new dimension is the old shape swept sideways in a direction perpendicular to everything so far; the vertex count doubles and the edges are the old edges, twice, plus one per old vertex. What you see is a 4-D rotation projected to 3-D and then to the screen, the way a wire cube's shadow on a wall is a 2-D drawing of a 3-D thing. The inner cube that seems to grow and swallow the outer one is not changing size; it is swinging toward and away from you along an axis you do not have.

Go deeper

The Swiss mathematician Ludwig Schläfli classified the regular polytopes in 1852: five Platonic solids in 3-D, six in 4-D (including the 24-cell, which has no analogue anywhere else), and in every dimension above four only three: the simplex, the cube and its dual. Dimension four is the strangest: it is the only dimension where the smooth structure on ordinary space is not unique (Simon Donaldson and Michael Freedman, 1980s), and the one Einstein and Minkowski needed for spacetime. Salvador Dalí painted the crucifixion on an unfolded tesseract in 1954; Pablo Picasso's multiple viewpoints, from 1907 on, have been read as the same intuition. Try the 5-cube: 32 vertices, 80 edges, and the eye gives up.

Philosophy is written in this grand book, the universe, in the language of mathematics, and its characters are triangles, circles and other geometric figures.
Galileo Galilei, Il Saggiatore, 1623
IV

Waves and art

Everything that moves can be added up from circles.

IV.1 · Waves and art

Circles that draw

Any shape you can draw, any sound you can hear, is a sum of circles turning at different speeds. Add more and the wave grows corners.

try · add terms and watch the circles build the wave · switch to saw or triangle

Joseph Fourier proposed in 1807 that heat flow could be understood by splitting any function into sines. The Academy didn't believe him. He was right about more than heat.

A square wave is a sine, plus a third of a sine three times as fast, plus a fifth of one five times as fast, and so on through the odd harmonics. Each circle in the canvas is one term; the smaller, faster circles ride on the larger, slower ones, and their final point traces the sum. Your ear does this decomposition physically: the cochlea is a bank of resonators, which is why a clarinet and a violin playing the same A sound different: same fundamental, different recipe of circles.

Go deeper
square(θ) = 4⁄π ( sin θ + sin 3θ⁄3 + sin 5θ⁄5 + … )

Look at the overshoot at every corner as you add terms: it never goes away, settling at about 9 % of the jump. That is the Gibbs phenomenon, named for the American physicist Josiah Willard Gibbs (1899), and it is why sharp edges ring in compressed images and audio. JPEG, MP3, MRI scans, noise-cancelling headphones and the detection of gravitational waves are all Fourier's circles. The Fast Fourier Transform, rediscovered in 1965, does the decomposition in n log n steps instead of n², which is the difference between a phone call and a research project.

IV.2 · Waves and art

Why photos are small

A photograph is millions of numbers. JPEG rewrites each little square of it as a sum of waves, keeps the slow ones your eye cares about, and throws the rest away.

try · slide down the number of waves kept in each block: the rippling water breaks up first, the smiles last · point at any square to see the 64 waves it is made of

Earlier on this page, circles added up to draw any shape. JPEG does the same thing with a picture: every eight-by-eight square of pixels is exactly a mix of 64 patterns of stripes, from flat grey to the finest checkerboard.

Most of a photograph changes slowly: sky, skin, a wall in shadow. In those squares almost all the weight sits in the first few, smoothest patterns, and the fine ones carry next to nothing. Your eye is also far less sensitive to fine detail than to broad shading. So JPEG stores the smooth patterns carefully, rounds the fine ones hard, most of them all the way to zero, and packs the long runs of zeros into a few bits. A typical photo shrinks to about a tenth of its raw size before most people can tell.

Push it too far and the trick shows. Sharp edges, like a horizon or a line of text, need the fine patterns, and without them they ring and blur, and the eight-by-eight grid starts to appear. That blockiness on an over-compressed image is the mathematics showing through.

Go deeper
X(u,v) = ¼ C(u) C(v) Σx Σy p(x,y) cos((2x+1)uπ⁄16) cos((2y+1)vπ⁄16)

This is the discrete cosine transform, a cousin of Fourier's series that uses only cosines, proposed by Nasir Ahmed with T. Natarajan and K. R. Rao in 1974. Run on an 8 × 8 block it gives 64 numbers, one per pattern; run backwards it gives the pixels back exactly. Compression is choosing which of the 64 to keep: the patterns are ordered in a zig-zag from smooth to fine, and the fine ones, which the eye barely sees, go first. The real standard, published by the Joint Photographic Experts Group in 1992, also stores colour at lower resolution than brightness, because our eyes resolve brightness more finely, and divides each pattern by a step that grows with its fineness before rounding. The same transform sits inside MP3 audio and most video, which is why a stream that stutters breaks into blocks.

What you hear depends on how you focus your ear. We're not talking about inventing a new language, but rather inventing new perceptions of existing languages.
Philip Glass
IV.3 · Waves and art

Music, as numbers

Everything you have heard on this journey has been arithmetic: a cone pushing air, ratios the ear calls consonant, and a composer who built a language out of counting.

What your speakers are doing

try · start the music at the top of the page and watch the cone follow it

A speaker is a magnet, a coil of wire and a paper cone. Current flows one way and the cone pushes the air; it flows back and the cone pulls. Sound is that push, travelling.

What reaches your ear is a single number changing in time: air pressure, rising and falling a few hundred to a few thousand times a second. A piano, a voice and an orchestra are all one wiggling line. Fourier showed that any such line is a sum of pure sine waves (see Circles that draw), and your inner ear does that sum in reverse, a coiled strip of hair cells each tuned to one frequency. When music is playing, the cone above moves with it; the dots are air molecules, crowding and spreading as the wave passes.

Go deeper
fsample > 2 fmax

To store that line as numbers you measure it many times a second. The engineers Harry Nyquist (1928) and Claude Shannon (1949) proved that if you sample at more than twice the highest frequency present, you lose nothing: the original curve can be rebuilt exactly. People hear up to about 20,000 Hz, so a CD measures 44,100 times a second, each measurement a 16-bit number: 65,536 possible heights. Three minutes of stereo is about 32 million numbers. MP3 and every streaming format then throw away the frequencies your ear would not have noticed, using a model of hearing called psychoacoustics, and keep about a tenth.

Ratios

try · move a and b to change the interval · press the button to hear it · slide δ to turn the figure

Pythagoras heard that a string stopped at ⅔ of its length sounds a fifth above the open string. Consonance is small whole numbers.

The figure plots one vibration against another: x = sin(a·t), y = sin(b·t + δ). At 1:1 it is a circle; 2:1, the octave, is a figure of eight; 3:2 the fifth; 4:3 the fourth; 5:4 the major third. Rational ratios close into a figure; irrational ones never do, and fill the square. Press the button to hear the two pitches the figure is drawing; the music behind you steps aside while it plays.

Go deeper
(3⁄2)¹² ≈ 129.7 ≠ 2⁷ = 128

Twelve perfect fifths should return you to the starting note seven octaves up. They miss, by the Pythagorean comma of about a quarter of a semitone. No tuning can make every fifth pure and every octave pure at once, because a power of 3 is never a power of 2. Equal temperament spreads the error evenly: every semitone is the twelfth root of 2, and every fifth is 27⁄12 ≈ 1.4983, a hair flat. Johann Sebastian Bach's Well-Tempered Clavier (1722) was the argument; the piano is the verdict.

Erik Satie, who repeated himself on purpose

try · press play · move the sliders to change how long each melody loops, and hear the two drift apart and meet again · tap or drag across the grid to hear any repetition

In the 1890s a Paris composer wrote one page of piano music and told the pianist to play it 840 times in a row. The first complete performance we know of, in 1963, took about eighteen hours.

The piece is Vexations, by Erik Satie (1866–1925). He left no explanation, only a direction to prepare in silence and serious stillness. Mathematically it is a single idea, a loop: take a short pattern and apply it again, and again. That is iteration, the same act that builds the Mandelbrot set from one rule. His better-known Gymnopédies are a gentler case: beneath the slow waltz, the accompaniment mostly swaps between two chords, a cycle of period two.

What repetition changes is not the music but the listener. By Shannon's measure a message you can predict carries almost no information, and after its first minute Vexations is almost perfectly predictable. Yet people who have sat through long performances describe hearing something new, which is the point Glass makes about focusing the ear. A pattern repeated enough stops being a sequence and becomes a place.

Press play. Over the soft two-chord figure, a low melody loops every so many repetitions and a high melody every so many others; the sliders set the two lengths. The grid marks each loop's first note, the low line in the bottom half of a square and the high line in the top, and outlines the squares where both begin together, with a bell. Pick 3 and 4 and you hear them slide apart and lock back into step every 12, the gears of minimalism.

Go deeper
lcm(1, 2, …, 8) = 840

840 is the smallest number that every whole number from 1 to 8 divides evenly. There is no evidence Satie knew or intended it, so call it a coincidence, but it is exactly the arithmetic of cycles: patterns of 3 and 4 beats realign every 12, and patterns of every length from 1 to 8 realign only every 840. That is the machinery behind the interlocking cycles in Glass's music, and part of why the American composer John Cage, and the minimalists after him, heard Satie as a forerunner.

In 1917 Satie coined furniture music: sound meant to be part of the room, heard without being listened to. A soundtrack that plays behind a journey, as this one does, is his idea. Some scholars have found golden-ratio proportions in his early scores and others dispute it; we leave that open.

Philip Glass, by the numbers

try · press play and watch the triangle grow · change how many notes the phrase grows to

1. 1 2. 1 2 3. 1 2 3 4. 1 2 3 4 5. Then back down. Glass called it additive process, and built some of the most recognisable music of the century from it.

In Two Pages (1968) a five-note figure is played, then repeated with one note added, then another, then subtracted, for twenty minutes; the ear stops hearing notes and starts hearing structure. Music in Twelve Parts (1971–74) layers several such processes at once. In Einstein on the Beach (1976) the chorus simply sings the numbers, one two three four, the counting made audible. And in the Opening of Glassworks (1982) the right hand plays in threes against the left in twos: the 3:2 ratio from the figure above, as rhythm instead of pitch. The canvas plays an additive process on any number of notes; watch the shape it makes, a triangle, the same shape as the sum 1 + 2 + … + n.

Go deeper
1 + 2 + … + n = n(n + 1) ⁄ 2

A full additive cycle on n notes, up and back, plays n² notes: a growing triangle of n(n + 1)⁄2 and a shrinking one of n(n − 1)⁄2. Glass's other device, cyclic process, runs patterns of different lengths at once, a figure of 3 beats against one of 4, so they line up again only every 12 beats: the least common multiple, which is why such music seems to turn slowly like gears. Minimalism has been called the most mathematical music since the Baroque; Glass himself always resisted the label and said he was only interested in how music unfolds in time. Both can be true.

Jazz, which only looks random

try · tap any key to hear its chord · pick a shape · press Trace it to hear equal strides across the circle

Improvisation looks like chance. Underneath it is a map of twelve keys, and the best players learned its geometry.

Arrange the twelve keys in a circle of fifths and every way of cutting the octave into equal steps becomes a regular shape. Jump a major third, four semitones, and three jumps bring you home: a triangle. A minor third gives a square, a whole tone a hexagon, a tritone a straight line through the middle. Those are the divisors of 12, and they are the only ways to slice an octave evenly. In 1959 the saxophonist John Coltrane recorded "Giant Steps" with its key centres on the triangle, at B, G and E♭, and later drew his own diagram of the circle to explain how he thought about it. Tap a key, choose a shape, and press Trace to hear what moving across the circle in equal strides sounds like.

Even the looseness has a number in it. When jazz players swing, the long note of a pair is not exactly twice the short one: the ratio drifts with the tempo, nearer three to one when slow and nearer even when fast. Improvisation is itself a balance of the predictable and the surprising, the trade Shannon measured, and researchers fit probability models to recorded solos. It is not random. It is chance with rules, which is also how a coin flipped many times builds a bell curve.

Go deeper
position on the circle = 7 × pitch class (mod 12)

A fifth is 7 semitones and 7 × 7 = 49, which is 1 more than a multiple of 12, so a step of s semitones moves you 7s places around the circle of fifths. A major third, 4 semitones, is 28 mod 12 = 4 places, and three of those make a triangle. Diminished seventh chords, 3 semitones apart, make a square, and any one of their four notes can be treated as the leading tone to a different key, which is why jazz musicians use them as a hinge to leave a key. Mathematicians call the whole structure the cyclic group Z₁₂, and the shapes are its subgroups. The twelve keys are also why 12 = 2² × 3 matters: its divisors 1, 2, 3, 4, 6 and 12 are the equal divisions of the octave.

IV.4 · Waves and art

Where it met the arts

Mathematics has never stayed in mathematics. A second timeline: the moments it crossed into music, painting, building and play.

The Analytical Engine weaves algebraical patterns just as the Jacquard loom weaves flowers and leaves.
Ada Lovelace, 1843
V

Chance and life

Dice, weather, cells, epidemics, the body and the kitchen.

V.1 · Chance and life

The bell

Drop a ball through a field of pegs. Each peg is a coin toss. Drop a thousand and a curve appears that no one placed there.

try · press Drop · change the number of rows

The Central Limit Theorem: add up enough independent small chances, of almost any kind, and their sum is bell-shaped. It is why the normal distribution is normal.

Francis Galton built this board in 1873 to make the point physically. A ball that bounces left or right twelve times lands in a bin given by the number of rights; the count of paths to each bin is a row of Pascal's triangle, and Pascal's triangle, scaled, converges to e−x²⁄2. Heights, measurement errors, the noise in a photograph, the daily moves of a stock, exam marks: anything that is the sum of many small independent pushes fall under the same curve. Galton called it the supreme law of unreason.

Go deeper
p(x) = (1⁄√2π) e−x²⁄2

π appears here, far from any circle, because ∫ e−x² dx = √π, a fact the French mathematician Pierre-Simon Laplace established in the 1770s; the neatest proof, usually credited to his countryman Siméon Denis Poisson, squares the integral and switches to polar coordinates, where the circle reappears. The thin curve drawn over the bins is this formula. Watch it fail: with four rows the histogram is lumpy and the curve is a poor fit; with sixteen they agree. The theorem is a limit; the board shows the approach.

V.2 · Chance and life

The butterfly

Three trajectories, starting one part in a million apart, agree for a while and then go their separate ways forever. The weather does the same.

try · drag to turn it · slide ρ below 24.7 and the chaos disappears

Edward Lorenz, 1961: a weather model restarted from printed numbers rounded to three decimals diverged completely from the original run. Determinism without predictability.

These three equations are a cartoon of convection: warm fluid rising, cooling, falling. They have no randomness in them. Yet the trajectory never repeats and never settles, orbiting two lobes and switching between them at moments no formula can forecast far ahead. The shape it fills, the strange attractor, has fractal dimension about 2.06. Lorenz's title for the 1972 talk gave the idea its name: "Does the flap of a butterfly's wings in Brazil set off a tornado in Texas?"

Go deeper
ẋ = σ(y − x),   ẏ = x(ρ − z) − y,   ż = xy − βz

With σ = 10 and β = 8⁄3, chaos begins around ρ ≈ 24.74. Drag the slider below that and the trajectories spiral into a fixed point: steady convection. Above it the butterfly appears. At ρ = 28 the three lines in the canvas separate after roughly 25 time units; doubling the precision of the starting point buys only a few more units, because errors grow exponentially: the Lyapunov exponent, named for the Russian mathematician Aleksandr Lyapunov, is about 0.9 per unit time. This is why ten-day forecasts exist and thirty-day forecasts do not.

V.3 · Chance and life

Life

A cell lives if it has two or three neighbours, is born if it has exactly three, and dies otherwise. From these three sentences: gliders, guns, and a computer.

try · tap cells to draw · press Glider gun or R-pentomino · or Random

John Conway designed the rules in 1970 to be as simple as possible while remaining unpredictable. It is Turing-complete: Life can compute anything that can be computed, including Life.

The glider gun (the programmer Bill Gosper, 1970) fires a glider every thirty generations, settling the question of whether a pattern could grow without bound. The R-pentomino, five cells, runs for 1,103 generations before stabilising, throwing off six gliders. People have built in Life a digital clock, a Turing machine, and a pattern that prints the decimal digits of π. Conway, who died in 2020, came to resent that the game eclipsed his deeper work on groups and surreal numbers. It is still the clearest demonstration that complexity needs no complexity to come from.

Go deeper

Life is a cellular automaton, a family Stanisław Ulam and John von Neumann invented in the 1940s to ask whether a machine could build a copy of itself. Von Neumann's answer needed 29 states per cell; Conway's needs two. In the 1980s the physicist Stephen Wolfram catalogued the one-dimensional versions and found Rule 110, which is also universal: a line of cells, each looking at two neighbours, can run any program. The question of what the smallest universal system is remains open, and it is the same question as what the simplest possible physics is.

V.4 · Chance and life

One more, or one less

An outbreak hangs on a single number: how many people each sick person infects. Above one, it explodes. Below one, it dies out.

try · slide R and watch the outbreak replay · bring it down from 3 to 1.5 and see the peak flatten under the dashed line · go below 1 and it never starts

If every sick person infects two more, one case becomes a thousand in ten rounds. If every sick person infects fewer than one, the chain breaks on its own.

In 1927 William Kermack and Anderson McKendrick, a chemist and a doctor in Edinburgh, wrote an outbreak as three numbers: the people who can still catch it, the people who have it, and the people who have recovered. Each day some of the first group catch it from the second, and some of the second move into the third. From those two rules comes the curve that rises, peaks and falls, and the single number that governs it, R, the average number of people each case infects. R is not fixed by the germ alone. Distance, ventilation, masks, handwashing and staying home all lower it, which is why, in 2020, the whole world spent months trying to push one number below one.

Two things fall out of the mathematics. The first is the threshold: once a fraction 1 − 1⁄R of people are immune, each case meets too few people it can infect and the outbreak shrinks by itself. For measles, with an R near 15, that is about 93 percent, which is why vaccination rates matter so much for it. The second is the shape. Lowering R does not just delay the outbreak, it squashes the whole curve, so fewer people are sick at once and fewer catch it at all. That is what flattening the curve meant: keeping the peak under the line of how many people the hospitals can care for at once.

The same arithmetic shapes the germs themselves. A germ that harms its host more, adding a death rate α, ends each infection sooner, and R becomes β ⁄ (γ + μ + α), where μ is the ordinary death rate. Harm usually buys some extra spread, so β grows with α, but more slowly. The ratio is then largest in the middle: a germ that kills too quickly runs out of hosts before it can pass itself on. Roy Anderson and Robert May set this out in 1982, and it is why many long-lasting infections settle toward mildness rather than toward the most harm they could do.

Go deeper
dS⁄dt = −β S I   dI⁄dt = β S I − γ I   R = β ⁄ γ

S, I and the recovered share add up to one town. β is how fast contact spreads it and γ is how fast people recover; here each person is infectious for a week, so γ = 1⁄7 per day. An outbreak grows only while β S > γ, that is while R × S > 1, which is where the threshold 1 − 1⁄R comes from, and the peak comes exactly when the susceptible share falls to 1⁄R. The total share z who ever catch it solves z = 1 − e−R z: about 89 percent for R = 2.5, 58 percent for R = 1.5, and none at all for R below 1. Notice that the outbreak overshoots the threshold: it keeps infecting people after the peak, so far more than 1 − 1⁄R end up infected. The same equations, with new names, describe rumours spreading, chain reactions in a reactor and the growth of a viral video.

V.5 · Chance and life

A dose, in numbers

Every medicine, every hormone, every molecule in the blood is a curve. Learn the curve and you can read what it does, and why it lasts.

Half-life

try · press a hormone or a medicine to load its half-life · slide the gap between doses and watch the level build

A medicine is a number that falls. Every so often it halves, and from that one fact you can predict how long a drug lasts, how often to take it, and how it builds up.

The rule is exponential decay: what is left after time t is C₀ · e−kt, where k = ln 2 ⁄ half-life. It is the same e as in the growth chapter, run backwards. The hormone GLP-1, released by the gut after a meal to tell the body it has eaten, lasts only a minute or two in the blood, because an enzyme cuts it almost as fast as it is made. Semaglutide, the molecule behind drugs such as Ozempic, is built so that enzyme cannot cut it, and so that it clings to a protein that carries it around: its half-life is about a week. Press the buttons. A two-minute half-life is gone before the next dose; a one-week half-life, dosed weekly, stacks up.

Go deeper
steady peak = 1 ⁄ (1 − e−kτ)

Each dose adds a fresh decaying curve on top of what is left. The total is a geometric series, and it levels off at 1⁄(1 − e−kτ) times one dose, where τ is the gap between doses. After about five half-lives you are within 3% of that plateau, which is why a drug with a week-long half-life takes a month or so to settle. Hormones obey the same arithmetic from the other side: the body makes them at some rate P and clears them at rate k, so dC⁄dt = P − kC and the level settles at P⁄k. Slowing the clearance, as semaglutide does, raises the level without making any more.

The S-curve

try · drag the dose along the curve · make it steeper and watch the safe window shrink

Give a little and nothing happens. Give a lot and nothing more happens. In between, the effect climbs along an S.

That S is the Hill equation, from the British physiologist Archibald Hill in 1910: effect = Cⁿ ⁄ (EC50ⁿ + Cⁿ), the share of receptors a drug has switched on. Plot it against the logarithm of the dose and it is exactly the logistic curve 1 ⁄ (1 + e−x), the same bend the neuron used in the learning chapter, with n setting how steep it is. Steepness is a safety number. At n = 1 the effect needs an 81-fold change in dose to travel from 10% to 90%; at n = 4 it needs only 3-fold, so a small error in dose swings a result from almost nothing to almost everything. Drag the dose and the steepness and watch the window narrow.

Go deeper
C₉₀ ⁄ C₁₀ = 811⁄n

The curve comes from counting. Molecules bind and let go at random, and when the traffic balances, the fraction of sites occupied is C ⁄ (C + K). Cooperative binding, where one bound molecule makes the next easier, steepens it: haemoglobin picking up oxygen has an n of about 2.8, which is why it loads in the lungs and unloads in the tissues over a narrow range of oxygen.

Seeing a molecule

try · add views, then tick Sharpen

You cannot photograph a molecule in three dimensions. You photograph its shadow from many sides and let arithmetic rebuild the rest.

On the left is a made-up molecule. On the right is what a computer rebuilds from nothing but its one-dimensional shadows, taken from evenly spaced angles. With a few views you get a blur with streaks; add views and the shape sharpens; tick the filter, a ramp that boosts fine detail, and it snaps into focus. The Austrian mathematician Johann Radon proved in 1917 that this is possible. The same idea powers the CT scanner, which won Godfrey Hounsfield and Allan Cormack the 1979 Nobel Prize in Medicine. Cryo-electron microscopy does it for molecules: it freezes thousands of copies in ice, images each from an unknown direction, works out the directions, and builds a 3-D map. It won the 2017 Chemistry Nobel for Jacques Dubochet, Joachim Frank and Richard Henderson, and it is how many drug targets are now seen.

Go deeper
the Fourier transform of a shadow = a slice of the object's Fourier transform

That is the Fourier slice theorem, and it is why the filter works. Each view supplies one slice through the middle of the object's Fourier transform, the circles of the Fourier chapter in two or three dimensions. Stack enough slices and the transform fills in; transform back and the object returns. The ramp filter is there because slices crowd together near the centre and thin out toward the edge, so the edges need boosting to be counted fairly. Here the angles are known. In cryo-EM they are not, and the images are extremely noisy, so much of the real work is averaging millions of them, which is where the machine learning of the earlier chapter comes in.

V.6 · Chance and life

Maths in the kitchen

Kneading is chaos theory. A folded slice of pizza is a theorem of Gauss. A pyramid of oranges took four hundred years to prove. Supper is full of mathematics.

try · press knead, or tap the dough · watch the two specks, which start a hair apart, end up on opposite sides · after a dozen kneads the two colours are one

Stretch the dough to twice its length, fold it in half, repeat. Two specks of flour that start side by side are twice as far apart after every fold.

Mathematicians call this the baker's map, and it is one of the simplest pictures of chaos there is. The rule is completely fixed: double, fold, nothing random anywhere. Yet a gap of a thousandth of an inch becomes an inch after ten kneads, because 210 is 1,024. Any uncertainty in where a speck began, however small, is doubled every time, so after enough kneads nobody can say where it will be. This is the same sensitivity as the butterfly in the weather, made with flour and your hands. It is also exactly why kneading works: stretching and folding is the fastest way there is to mix, and a baker needs no spoon to spread the yeast evenly through the whole loaf.

Go deeper
(x, y) → (2x, y⁄2)  or  (2 − 2x, 1 − y⁄2)

A speck on the left half is stretched to twice its distance from the edge and squashed to half its height; a speck on the right half is stretched the same way and then folded over the top. Distances across the dough double and distances along it halve, so the area of every patch is kept: no dough is made or lost. The rate at which nearby points fly apart is called the Lyapunov exponent, and for the baker's map it is ln 2 per knead, about 0.69. Any system with a positive Lyapunov exponent is chaotic, and the number tells you how long your predictions last: start with a gap of one part in a million and it reaches the size of the dough in about twenty kneads, because 220 is about a million.

The pizza fold

Bend a floppy slice into a U along its length and the tip stops drooping. That is a theorem.

In 1827 Carl Friedrich Gauss proved what he called his Theorema Egregium, his remarkable theorem: a surface keeps its curvature, the product of how much it bends in two directions, unless you stretch or tear it. A flat slice has zero curvature, and without tearing the crust it must stay zero. So once you curve it across, it cannot also curve along: the droop is forbidden. The same mathematics stiffens corrugated roofing, a tape measure that stands out straight, the fluted edge of a leaf, and a sheet of paper you can hold out flat by giving it one gentle curl.

A pyramid of oranges

Every greengrocer stacks oranges the same way, and it took mathematics almost four hundred years to prove they are right.

In 1611 Johannes Kepler claimed that no way of packing equal spheres fills more space than the grocer's pyramid, each layer sitting in the hollows of the one below, which fills π ⁄ √18, about 74 percent. Gauss proved it for regular, repeating stacks in 1831, but an irregular arrangement might still have done better. In 1998 the American mathematician Thomas Hales announced a proof that reduced the question to thousands of cases and checked them by computer; it was published in 2005, but the referees said they were only 99 percent sure. So Hales led a project called Flyspeck to have a computer check every logical step, finished in 2014 and published in 2017. In 2016 Maryna Viazovska proved the same kind of result in eight and twenty-four dimensions, and won a Fields Medal for it.

The turkey

A turkey twice as heavy does not take twice as long. It takes about one and a half times as long.

Heat comes in through the skin and has to travel to the centre. Make the bird twice as heavy and every length grows by the cube root of 2, about 1.26, and the time heat takes to soak through grows with the square of that length. So the cooking time grows with weight to the power two thirds. If a 12 lb turkey takes 3 hours at 325 °F, a 24 lb turkey takes about 3 × 22⁄3, nearer 4 hours 45 minutes than 6. The same square–cube law is why a big pot of soup stays hot longer than a small cup, why an elephant needs big ears to cool down, and why a shrew must eat close to its own weight in food every day to keep warm.

VI

Machines

Machines that feel a touch, land, see, stop, learn, talk and build worlds, and what it takes to make one work.

Technology alone is not enough. It's technology married with liberal arts, married with the humanities, that yields us the result that makes our heart sing.
Steve Jobs, 2011
VI.1 · Machines

How a touchscreen knows

Under the glass is a grid of invisible wires a quarter of an inch apart. Your fingertip is wider than the gaps, yet the phone knows where you touched to a small fraction of one. The trick is an average.

try · drag your finger across the grid · the ring is where you really are, the cross is where the screen works out you are · add noise and see how well the average holds up

The screen never sees your finger. It sees a few crossings of wires where the electricity behaves slightly differently, and it does arithmetic.

One layer of wires runs across, another runs down, and where they cross they form tiny capacitors that hold a little electric charge. The controller pulses each row in turn and listens on every column, more than a hundred times a second. Your body conducts, so a fingertip near a crossing steals some of the field between the wires, and the signal there drops. Near the centre of your touch it drops a lot, at the edges a little.

No single crossing can say where you are; they are too far apart. But weigh each crossing's position by how much its signal changed and take the average, and the answer lands between the wires, almost exactly where your finger is. It is the same centre-of-mass sum that balances a seesaw. Because every touch shows up as its own bump in the grid, the screen can follow many fingers at once, which is what made pinching to zoom possible when the iPhone arrived in 2007.

Go deeper
x̂ = Σ xᵢ sᵢ ⁄ Σ sᵢ  ·  ŷ = Σ yᵢ sᵢ ⁄ Σ sᵢ

Each crossing i sits at (xᵢ, yᵢ) and reports a change sᵢ. The weighted average, or centroid, uses only the crossings around the strongest one, because far-away crossings carry nothing but noise. With wires about 5 millimetres apart and a fingertip about 8 to 10 millimetres wide, several crossings feel every touch, and the centroid locates it to well under a millimetre. A fingertip too small for the spacing breaks it: if only one crossing feels you, the average snaps to that wire, which is why a stylus for a phone has a fat rubber tip. This kind of screen is called projected capacitive, and the same averaging recovers sharp positions from coarse sensors everywhere, from the pixels of a telescope camera to the antennas of a radar.

VI.2 · Machines

Falling, on purpose

A rocket booster, nearly empty, falling at 270 mph (430 km/h). Its engine cannot throttle low enough to hover. Light it too early and it stops too high and runs out of fuel; too late and it hits the ground. Try.

try · W or space fires the engine (or hold the picture) · A and D fire small jets near the top to turn the ship · Q and E swivel the engine · gusts will try to tip it: land slow and nearly upright

To leave Earth you need about 7 miles a second (11.2 km/s). To stay in orbit, about 4.8 (7.8 km/s), sideways, fast enough that you fall around the planet instead of into it. To come home and land on your tail, you need the exact moment.

The rocket equation, written by the Russian schoolteacher Konstantin Tsiolkovsky in 1903, is the reason rockets are mostly fuel: Δv = Isp g0 ln(m0 ⁄ mf). The speed you can gain grows only with the logarithm of how much heavier you are full than empty, so each extra mile a second (1.6 km/s) costs exponentially more fuel. That is why rockets drop stages, and why bringing a booster back, which means keeping fuel in reserve just to land, was long thought not worth it. The gauge on the right is that logarithm, draining.

A nearly empty Falcon 9 booster weighs about 56,000 pounds (25,600 kg); one Merlin engine at its lowest setting pushes harder than that. So the booster cannot hover. It must light its engine at precisely the altitude where constant deceleration brings it to zero speed at zero height: h = v² ⁄ 2a. Pilots call it a suicide burn; engineers call it a hoverslam. The dashed line in the canvas is that altitude, recalculated every frame.

Go deeper
vescape = √(2GM ⁄ r),   Δv = Isp g0 ln(m0 ⁄ mf)

A real landing is three-dimensional, with wind, a moving drone ship and an engine that can only be relit a few times. The guidance computer must find, many times a second, a path that lands softly, never dips below the ground, never asks the engine for less thrust than it can give, and burns the least fuel. That last condition, a minimum thrust, makes the problem non-convex, which in general means no fast algorithm can be trusted to find the best answer. The engineers Behçet Açıkmeşe and Lars Blackmore showed around 2010 that this particular problem can be rewritten, with no loss, as a convex one, "lossless convexification," which an onboard computer solves exactly in milliseconds. JPL flew it as G-FOLD in 2012; Blackmore went on to lead landing guidance at SpaceX, the company Elon Musk founded in 2002 with the goal of making rockets reusable. Musk drove that goal when most of the industry called it uneconomic; after failed attempts at sea, the first Falcon 9 booster came back and landed upright in December 2015, and boosters now fly again and again, which has made reaching orbit far cheaper. Tick the box above to watch the computer fly the profile: it waits, then burns exactly once.

τengine = L · T · sin γ,   side force ∝ ½ ρ v² · tilt

Landing is a balance of many pushes at once, and each one acts at a different point, so each one both moves the ship and turns it. Gravity pulls straight down through the centre of mass. A gust pushes sideways, and because the wind acts above the centre of mass it also tips the nose downwind. The main engine pushes along its own axis, and swivelling it a few degrees, the gimbal angle γ, gives a torque of L · T · sin γ about the centre of mass, where L is the engine's distance from it. Small cold-gas jets near the top push the nose back with no flame at all. While the ship still falls fast, the air over its tilted body adds a sideways force that grows with the dynamic pressure ½ρv²; Falcon 9 boosters steer through that phase with grid fins, lattices of thin plates near the top, and Starship with four large flaps. The flight computer has to blend every one of these many times a second, and to land, the ship must arrive slow and within a few degrees of upright. Fly it yourself and you feel why: lean to move sideways, and the lean has to be caught again before touchdown.

How a car could fly

try · W and S climb and sink, A and D slide, Q and E flip it · stabiliser on: it holds your height and rolls back level · off: let go of W and gravity takes over

An engine that pushes straight through a vehicle's centre of mass only moves it. Move the push off centre and it also turns it. Flying is the art of never letting the turning win.

The turning effect is torque, τ = r × F: the force times how far off centre it acts, measured at right angles. A single landing booster has one engine at the bottom, so any sideways push would tip it over; that is why its engine swivels a few degrees to steer while the rocket balances on its own exhaust. A car hovering on thrusters has a harder job. It must hold up its whole weight, F = m g, every second it is in the air: a 3,000 lb car needs 3,000 pounds of thrust (13,300 newtons) just to stay where it is. Split that between a jet at the front and one at the back and the slightest mismatch tips the nose up or down, so the thrust has to be rebalanced many times a second. A drone does the same with its four rotors, speeding one up and another down to hold itself level.

In 2018 Elon Musk said that a SpaceX option package for the next Tesla Roadster, the sports car from the electric-car maker he leads, would add about ten small cold-gas thrusters, jets of compressed air with no flame; he has since said it might even fly. The arithmetic of hovering explains why that is hard. Cold gas is a weak propellant, and the rocket equation sets how long it lasts.

Go deeper
τ = rx Fy − ry Fx,   thover = Isp · ln(m0 ⁄ mf)

Each thruster's force F, acting at an offset r from the centre of mass, adds to the total force, which sets the acceleration through F = m a, and to the total torque, which sets the spin through τ = I α, where I is the moment of inertia, how hard the body is to turn. A stabiliser does what every drone and landing rocket does: it measures the tilt θ and the rate of turn ω many times a second and asks for a correcting torque of −kpθ − kdω, then splits it between the front and rear jets. Hovering burns propellant at the rate needed to make thrust equal weight, so the time in the air comes from the rocket equation with Δv replaced by g t: t = Isp ln(m0 ⁄ mf). Compressed nitrogen gives a specific impulse of about 70 seconds. A 3,000 lb car carrying 300 lb of it hovers for 70 × ln(3,000 ⁄ 2,700) ≈ 7 seconds.

VI.3 · Machines

How a machine sees

To a car, the road is a grid of numbers. Slide a small grid of weights across it, multiply and add, and the numbers become edges. Stack enough of these and the edges become a pedestrian.

try · switch filters · type your own numbers into the grid · press Use my camera

A convolution: a 3 × 3 grid of numbers, laid over every pixel in turn, each neighbour multiplied by its weight and summed. Change the nine numbers above and you change what the machine can see.

A convolutional neural network does not have its kernels written by hand. It starts with random numbers and learns them from millions of labelled pictures. The first layer always ends up finding edges, much like the ones above, and much like the cells David Hubel and Torsten Wiesel found in a cat's visual cortex in 1959, which earned them a Nobel prize. Deeper layers combine edges into corners and curves, then wheels and faces, then "cyclist, moving left." A car's cameras run networks like this many times a second, on every camera at once. If you use your camera, the processing happens entirely in this page; no image leaves your device.

Go deeper
distance = baseline × focal length ⁄ disparity

Seeing is not enough; a car must know how far. Two cameras a known distance apart see the same object at slightly different positions; the shift, the disparity, gives the distance by similar triangles, the geometry Eratosthenes used to measure the Earth. A single moving camera does the same across time. Then a Kalman filter (Rudolf Kálmán, 1960) blends each noisy measurement with a prediction from the last, weighting each by how much it can be trusted; it guided Apollo to the Moon and now tracks every car and cyclist around a self-driving car. Finally the car plans: a search through possible paths, scored for safety and comfort: an optimisation problem, like the rocket's, solved again and again.

Teaching a machine what a car is

try · drag a box around any car and see how closely it matches the human label · point anywhere to see the three numbers behind that pixel · switch frames

Before a machine can say "car", people have to show it, millions of times: here is a car, and here is exactly where it ends.

To a computer a photograph is a block of numbers. Every pixel is three of them, how much red, green and blue, each from 0 to 255, so one of these frames, 356 pixels tall and 720 wide, is a tensor of shape 356 × 720 × 3: 768,960 numbers. Nothing in those numbers says car.

A recognition network reads the block through layers of small filters, the same kind of sliding 3 × 3 weights as the edge detectors above, each layer turning one tensor into another: edges first, then corners and wheels, then whole shapes. At the end it gives boxes and, for each box, a score for every class it knows, turned into probabilities by the softmax function so that car, truck and person add up to 1. None of those filters is written by hand. They are learned, by the gradient descent of the section on learning, from examples that people have drawn.

That is the labour behind machine vision. In 2009 the computer scientist Fei-Fei Li and her team, at Princeton and then Stanford, released ImageNet: about 14 million photographs, each labelled by hand, much of it by paid online workers. In 2012 a convolutional network built by Alex Krizhevsky and Ilya Sutskever with their adviser, the British-Canadian computer scientist Geoffrey Hinton, cut the error on the ImageNet challenge so sharply that the whole field changed course. Microsoft's COCO dataset, in 2014, added about 1.5 million outlined objects in everyday scenes. Cars on the road now record far more video than people could ever label, so larger networks propose the boxes and people check them.

Drawing a box is itself a measurement, and two people never draw exactly the same one. The standard score for how well two boxes agree is the intersection over union: the area they share divided by the area they cover together, 1 for identical and 0 for no overlap. By the convention of the PASCAL Visual Object Classes challenge, which ran from 2005 to 2012, a guess counts as a correct find at 0.5 or more.

Go deeper
y[i, j] = Σc Σu Σv w[u, v, c] · x[i + u, j + v, c] + b   IoU = |A ∩ B| ⁄ |A ∪ B|

A convolution layer slides a small stack of weights w across the image: at every position it multiplies the 3 × 3 × 3 patch of numbers beneath it by the weights and adds them up. With k different filters it turns an H × W × 3 tensor into an H × W × k one, and stacking dozens of layers, each a sum of products, is all a vision network is. Training compares its output with the labels: one part of the loss is the cross-entropy, −log p, where p is the probability it gave the true class, and another pushes its boxes toward the drawn ones, often by minimising 1 − IoU. Gradient descent then nudges every weight to make both smaller, across millions of labelled boxes.

Depth, from two eyes

try · slide the object farther away and watch the blur in its distance grow · switch between your eyes, two car cameras and lidar

A camera divides depth away. Every photograph is the world flattened: x on the picture is f·X ⁄ Z, so a near small thing and a far large thing can land on exactly the same pixels.

Nature's answer is a second eye. Yours sit about 6.5 centimetres apart, so each sees a nearby object at a slightly different angle, and your brain turns that difference, the disparity, into distance by similar triangles: Z = f·B ⁄ d. It is why predators, from owls to cats to us, have eyes in front, giving up the wide view of prey animals with eyes on the sides of the head. But the triangle gets thin fast. Because Z is divided by the disparity, the error in Z grows with the square of the distance: twice as far is four times as blurred. Past a few dozen metres your two eyes see almost the same picture, and you judge distance from other clues instead: how big things ought to be, which object hides which, how things slide past as you move.

Machines face the same arithmetic. Lidar escapes it by measuring directly: a laser pulse goes out and back at the speed of light, and distance = c·t ⁄ 2, accurate to centimetres whether the object is near or far. Tesla, the carmaker Elon Musk has led since 2008, took the other path, the one nature took, at Musk's insistence: cameras only, and neural networks trained to infer depth from the same clues a person uses. The mathematics says what each bet costs. Triangulation is cheap and gets blurry with distance; timing light is exact and costs a spinning laser; inference is learned, and is only as good as its examples.

Go deeper
δZ ≈ Z² · δθ ⁄ B

If the smallest angle you can tell apart is δθ and the eyes or cameras are B apart, the uncertainty in distance is about Z² · δθ ⁄ B. Good human stereo vision resolves about 20 seconds of arc, roughly 0.0001 radians, which puts the blur at about 15 centimetres at 10 metres and about 15 metres at 100. Moving the cameras farther apart, or making the angle finer, shrinks it, which is why surveyors and astronomers use long baselines: the first distance to a star, measured in 1838, used the whole width of the Earth's orbit.

VI.4 · Machines

Stopping

How far does a car travel before it stops? More than the speedometer suggests, and the mathematics is unforgiving.

try · slide the speed and the pedestrian · switch the road to wet or ice

Double your speed and the braking distance quadruples. Look away for one second at 30 mph (48 km/h) and you travel 44 feet (13 m) blind.

Stopping has two parts. First the reaction: the car keeps moving while a person, or a computer, notices and decides, a distance of speed × reaction time. Then the braking: friction removes the car's kinetic energy, which takes v² ⁄ (2μg) feet. Because the second term is squared, speed matters more than anything else, which is the physics behind school-zone speed limits. It is also why engineers keep shaving the reaction time: a system that notices a pedestrian 0.2 seconds sooner than a driver buys about 9 feet (2.8 m) at 30 mph (48 km/h). Slide the pedestrian toward the car and watch the impact speed.

Go deeper
distance = v·t + v² ⁄ (2μg)

The energy in a crash grows with v², and studies of pedestrian crashes find the chance of dying rises steeply between 20 and 40 mph (32 and 64 km/h), which is why the same few feet can decide the outcome. The vision system in the earlier chapter and this arithmetic are two halves of one safety problem: seeing sooner, and stopping shorter.

Units are part of the maths

try · type a number and see it in every unit · try 1 lbf·s, the conversion that lost the orbiter

try · switch the units the thruster software reported in · slide the months of cruise to watch the error build up

A number without a unit is not a number. In 1999 a $125 million spacecraft was lost because two teams disagreed about one.

NASA's Mars Climate Orbiter came in far too low and was lost as it reached Mars. One team's software had reported the push of its small thruster firings in pound-force seconds, while the navigation software expected newton-seconds, a factor of 4.45 apart. Every correction over nine months was off by that factor, and the errors added up. In 1983 an Air Canada Boeing 767 ran out of fuel at 41,000 feet (12,500 m) because the ground crew worked in pounds when the calculation needed kilograms; it carried less than half the fuel it needed and glided to a safe landing at a disused airfield in Gimli, Manitoba. Nothing was wrong with the arithmetic in either case. The units, the grammar of numbers, were wrong.

Go deeper
1 lbf = 4.448 N,   1 lb = 0.4536 kg

Physicists check every equation by its units before they check anything else. In the stopping formula, v·t is feet per second times seconds, which is feet, and v² ⁄ (2μg) is (feet per second)² over feet per second squared, which is also feet. Both terms are lengths, so they can be added. An equation whose two sides have different units is wrong before a single number goes in. Used cleverly this becomes a method of its own, dimensional analysis: in 1950 the British physicist G. I. Taylor estimated the energy of the first atomic blast from a published photograph of its fireball, the time stamp on the frame, and the density of air.

VI.5 · Machines

How a machine learns

Place some white points and some black ones. A tiny network, 97 numbers, will try to draw the line between them. Watch it learn. Nobody tells it how; it only rolls downhill.

try · tap to place dots (shift-tap for the other colour) · or press Circle, XOR or Spiral and watch it learn

A neuron is a weighted sum and a bend: f(w₁x₁ + w₂x₂ + b). Learning is calculus: measure the error, ask which way each weight should move to make it smaller, take a small step, repeat.

The network above has two inputs (where you clicked), two hidden layers of eight neurons, and one output (white or black), 97 weights in all. Each frame it looks at your points, computes how wrong it is, and uses the chain rule to send that error backwards through every layer: backpropagation, popularised in 1986 by David Rumelhart, Geoffrey Hinton and Ronald Williams. Each weight moves a little in the direction that reduces the error. That is gradient descent, and it is the whole of the trick. The large language models that write and talk use the same step, on a few hundred billion weights instead of 97, with text instead of dots.

Go deeper
w ← w − η ∂L ⁄ ∂w

A language model turns every word into a vector: a point in a space of thousands of dimensions, placed so that related words sit near each other; famously, king − man + woman lands near queen. Its core operation, attention (2017), lets each word decide how much to weigh every other word using dot products and a softmax, a way of turning scores into probabilities. Then it predicts the next word as a probability distribution, and is scored by how surprised it was by the real one: cross-entropy, which is Shannon's measure of information from the end of this journey. Nobody fully understands why gradient descent on such enormous networks finds solutions that generalise instead of memorising. That is one of the open problems of this century, and a mathematical one.

Memory is a landscape

try · tap a memory to load it damaged · paint your own pattern on the big grid · press Recall to watch it settle · press Dream to start from pure noise

A memory is a valley. Give the network a damaged picture and it rolls downhill into the nearest thing it knows.

Each of the 100 squares is a neuron, on or off, and every pair is joined by a connection that grows stronger when the two usually agree. Store three shapes that way and the network has three valleys, one for each. Start it anywhere, say a shape with a quarter of its squares flipped, and let one neuron at a time switch to whatever its neighbours vote for. The total disagreement, the energy, can only go down, so the picture settles at the bottom of the nearest valley. That is the American physicist John Hopfield's 1982 model of memory, and it shared the 2024 Physics Nobel Prize with Geoffrey Hinton.

Press Dream and the network starts from pure noise. It rolls downhill all the same and lands wherever the noise happens to fall: on one of the three shapes, or just as often on the photographic negative of one, since a flipped picture is a valley too, or on a blend it was never taught. In the 1980s Francis Crick, co-discoverer of the structure of DNA, and Graeme Mitchison suggested that this is what dreams are for. Waking learning digs the valleys, and dreaming visits the false ones so they can be filled in. Hopfield and colleagues showed the idea can work in the mathematics. Nobody has shown it is why we dream.

Go deeper
E = −½ Σ wij si sj

The weights come from the Canadian psychologist Donald Hebb's 1949 rule, neurons that fire together wire together: wij is the average, over the stored patterns, of how often neurons i and j agree. Every update can only lower E, so the dynamics always stops. A network of N neurons can reliably hold only about 0.14 N random memories, and past that the valleys merge into blends. Modern AI revived the idea: the attention step in the transformers of the learning chapter has been shown to behave like a Hopfield network with an enormous number of valleys.

Learning without a map

try · move your pointer or finger to place the food, and watch the worm find it by smell alone: straight while the scent grows, turning when it fades

A worm a millimetre long finds its dinner with a rule a computer would recognise: if things are getting better, keep going; if they are getting worse, turn.

Caenorhabditis elegans, a soil roundworm with exactly 302 neurons and the first animal whose complete wiring diagram was mapped, in 1986, cannot see, and its head is too small to smell in stereo. It compares the scent now with the scent a moment ago, the rate of change dC⁄dt. While it rises, the worm swims straight; when it falls, the worm turns more often, in a new random direction. That bias is enough. A random walk that turns less when things improve drifts up the gradient, and bacteria find food the same way, a strategy called run and tumble.

It is the training of a neural network, run uphill. Neither the worm nor the network can see where the best place is. Each only measures whether the last step helped, and leans the next one that way.

Go deeper
dC⁄dt = ∇C · v

A network steps down the slope of its error, w ← w − η ∇E. The worm cannot measure a slope in space, so it measures one in time: as it moves with velocity v through a scent field C, the change it feels is the gradient dotted with its own velocity, positive exactly when it is heading uphill. Turning more often when that number is negative makes the average motion follow ∇C, though no single step knows the way. Real worms add a second trick, weathervaning: as the head sweeps from side to side, the worm leans slightly toward the side where the scent is stronger, a finite-difference estimate of the gradient taken a few hundredths of a millimetre apart.

VI.6 · Machines

How GPT was made

One question, asked hundreds of billions of times: what word comes next? Answer it well enough and a machine starts to write.

try · type a sentence and watch the guesses for the next word · tap a guess to add it and keep writing · tap any word to see which earlier words it pays attention to

A language model is a machine for guessing the next word. Everything else it does, answering, translating, writing code, comes from guessing very, very well.

In 1948 Claude Shannon counted which letters and words follow which in English, and showed that those counts alone produce text that looks eerily like language. The probability of the next word is just a fraction: how often it followed these words, divided by how often these words appeared. In Lewis Carroll's Alice's Adventures in Wonderland (1865), "very" is followed by "tired" and "sleepy", so after "very" those are the likeliest guesses. Attention turns the same idea into geometry: every word becomes a list of numbers, a point in many dimensions, and how much one word attends to another is the angle between them, measured by a dot product and turned into weights that add up to 1.

GPT does the same thing at a scale that changes what it is. In 2017 a team at Google led by Ashish Vaswani published "Attention Is All You Need", the transformer: every word looks at every earlier word and decides how much each one matters to it, so "it" can find the noun it refers to, ten words back. OpenAI, founded in 2015 by Sam Altman, Elon Musk, Ilya Sutskever, Greg Brockman and others, with Musk among its first and largest funders, built GPT on the transformer; its GPT-3, in 2020, had 175 billion numbers, its parameters, and learned them from about 300 billion words of text. Training is the calculus from the section on learning: guess the next word, measure how wrong the guess was, and nudge every one of the 175 billion numbers a tiny step in the direction that makes it less wrong. Repeat a few hundred billion times. ChatGPT added one more step in 2022: people ranked its answers, and it was tuned toward the ones they preferred.

Go deeper
Attention(Q, K, V) = softmax(Q·Kᵀ ⁄ √d) · V

Each word becomes a list of numbers, a vector. Three learned matrices turn it into a query (what am I looking for?), a key (what do I offer?) and a value (what do I pass on?). The dot product of one word's query with another's key says how relevant they are; softmax turns those scores into weights that add up to 1, the thickness of the lines above; the word's new vector is the weighted sum of the values. Dividing by √d, the square root of the vector length, keeps the scores from growing so large that softmax picks only one word. GPT-3 stacks 96 of these layers, each with 96 attention heads looking for different things, on vectors 12,288 numbers long. Words can only look backwards, never at the future they are trying to predict. The probability of a whole sentence is the product of the probabilities of each next word, and training lowers the average of −log P(next word): the same surprise that Shannon used to define information.

VI.7 · Machines

Worlds

A video game is a world written as numbers and a rule that updates them sixty times a second. Walk in. Every wall you see is a triangle of trigonometry, solved again for every column of the screen.

try · walk with the arrow keys or W A S D · on a touch screen, drag the view · press Show the map

Read the input. Update the world. Draw it. Repeat, sixty times a second. Every game, from Pong to the largest open world, is that loop.

The view above is drawn the way Wolfenstein 3D drew it in 1992: for each column of pixels, cast one ray from your eye across a flat map until it hits a wall, measure the distance, and draw a vertical line whose height is inversely proportional to it. Near walls are tall; far walls are short. Multiply the distance by the cosine of the ray's angle and the fish-eye bulge disappears. Turn on the map to see the rays fan out from you. Modern games do the same thing with millions of triangles: every point in the world is multiplied by a matrix that moves it into the camera's view, then divided by its depth, the same perspective divide Brunelleschi found with a mirror in 1413.

Go deeper
xt+Δt = xt + vt Δt,   vt+Δt = vt + at Δt

Game physics is calculus taken in small steps: position changes by velocity times the time step, velocity by acceleration. Take steps that are too large and objects tunnel through walls or gain energy from nowhere, which is why physics engines use cleverer integrators. Landscapes are often not stored at all but grown from a formula, Ken Perlin's 1983 noise function, which won him an Academy Award; Minecraft builds a world eight times the surface of the Earth from a single seed number.

Which raises the question the philosopher Nick Bostrom posed in 2003: if a civilisation can run detailed simulations, and runs many, then most minds that exist are simulated, and we should expect to be one. Physics has a suspicious resemblance to a game engine: a maximum speed, a smallest meaningful length, a state that updates by local rules, exactly like Conway's Life. Nobody knows how to test the idea, and many physicists think it is not science. But it is a mathematical argument, and it is hard to fault the arithmetic.

Cutting space in two

try · slide the depth to cut the plan one level at a time · drag the dot to move the player and watch the drawing order change

Pick a wall. Everything is either in front of it or behind it. Do the same on each side, and again, and you have a tree that answers the hardest question in drawing a world: what is in front of what.

That is binary space partitioning. Its first use was in flight simulators: Robert Schumacker and colleagues at General Electric split scenes this way for pilot trainers in 1969. Henry Fuchs, Zvi Kedem and Bruce Naylor gave it its modern form in 1980, a tree built once, in advance, from the walls of a scene. The programmer John Carmack, at id Software, built Doom (1993) on it, which is how a home computer could draw rooms of any shape at speed, and Quake (1996) took it into full three dimensions, cutting space with planes instead of lines. It is the next step after the raycaster above: instead of searching for walls one ray at a time, the world is sorted once, in advance. Before each frame the engine walks the tree from wherever you stand: the side of each wall you are on first, then the other side. Out come the walls in order from nearest to farthest, with no sorting. Move the dot and the numbers on the walls re-order themselves.

Go deeper
side = sign( (b − a) × (p − a) )

Which side of a wall a point is on is one cross product: the sign says left or right. A wall that crosses the splitting line is cut in two, one piece for each side. The tree is built once, when the level is made, and costs nothing to keep; walking it is fast because at every node only one comparison decides which way to go first. A good tree is shallow and cuts few walls, and choosing the splits well is a problem with no perfect fast solution. Variants of the idea still sort scenes for ray tracing, find collisions in physics engines and answer nearest-neighbour queries in databases.

VI.8 · Machines

An idea, and the doing of it

An idea is one step. A working machine is thousands of steps that all have to go right, and the arithmetic of that is merciless.

try · add parts and watch the chance that all of them work fall · add nines to each part's reliability to win it back · launch twenty and count

If a machine has a thousand parts and each one works 999 times in 1,000, the whole machine works only about 37 times in 100. Make each part ten times more reliable and it works 90 times in 100. Almost all of the work is in the last nines.

Chances of independent events multiply, so a system of n steps that each succeed with probability p succeeds with probability pⁿ. That one line explains why ideas are cheap and building is hard. In 1837 the English mathematician Charles Babbage designed the Analytical Engine, a mechanical computer with a memory, a processor and punched-card programs; in 1843 Ada Lovelace published the first program for it. The idea was complete. The engine needed tens of thousands of parts machined to tolerances that strained the workshops of the time; the money ran out, and it was never finished. General-purpose computers were built a century later, once electronics made each part dependable enough.

In 1637 Pierre de Fermat wrote in a book's margin that he had a proof too large to fit there. The statement took 357 years to prove: Andrew Wiles finished it in 1994, after seven years of work, the last of them spent with Richard Taylor closing a gap found in his first proof. Many people had the idea of powered flight; in 1903 Orville and Wilbur Wright flew because they had built their own wind tunnel, measured about two hundred wing shapes and corrected the published tables everyone else relied on. The mathematics for landing a rocket upright was flown in tests by 2012. Turning it into a booster that came home took a run of crashes and tipped-over landings at sea before the first one landed upright, on land, in December 2015.

Go deeper
P(all work) = pⁿ ≈ e−n(1−p)

When each part rarely fails, pⁿ is very nearly e to the power −n(1 − p): what matters is the expected number of failures, n(1 − p). A thousand parts at 99.9% expect one failure, so the machine works e⁻¹ ≈ 37% of the time; at 99.99% they expect a tenth of a failure, and it works e⁻⁰·¹ ≈ 90% of the time. Engineers fight this with redundancy, two parts where one would do, because a pair fails only if both fail: 1 − (1 − p)². The same multiplication runs the other way for effort. Improve by 1% a day and after a year you are 1.01³⁶⁵ ≈ 37.8 times better; slip by 1% a day and you are left with 0.99³⁶⁵ ≈ 0.026, less than three hundredths of where you began.

VII

You

Where the mathematics meets you, and where it runs out.

VII.1 · You

You

Every message you send crosses the open internet, and arrives private and intact. That is mathematics: one-way functions, prime numbers, codes that repair themselves, and the machines that once kept secrets in war.

try · type anything and watch it become a hash

try · pick two primes and watch your words lock and unlock

A hash is a one-way street: easy to compute, impossible to reverse. Change one letter and every bit changes. That is how a password is checked without ever being stored.

RSA is the other half. Pick two primes, p and q. Their product n is public; p and q are not. Anyone can lock a message with n; only someone who knows p and q can unlock it, because unlocking needs φ(n) = (p − 1)(q − 1), and finding that from n alone means factoring it. With the primes above, your phone factors n instantly. With 300-digit primes, every computer on Earth would need longer than the universe has existed. Every padlock in your browser bar is this arithmetic.

Go deeper

RSA rests on Euler's theorem from 1763: for any a coprime to n, aφ(n) ≡ 1 (mod n). Rivest, Shamir and Adleman noticed in 1977 that this gives a trapdoor: raise to e, then raise to d where e·d ≡ 1 (mod φ(n)), and you get your message back. The British mathematician Clifford Cocks at GCHQ had found it in 1973 and was not allowed to say. Shor's algorithm (1994) would break it on a large enough quantum computer, which is why the lattice-based schemes standardised in 2024 are quietly replacing it. The hash above is SHA-256, computed by your browser's own cryptography engine, the same one that signs this connection.

The internet

When you typed the address, your request was cut into packets, each one given a number, and sent by whatever route was free. They arrived out of order and were reassembled. Nothing on the way knew what they said.

The internet is a graph: about 75,000 networks, joined by cables and agreements, with no centre. Every router runs a shortest-path algorithm (the Dutch computer scientist Edsger Dijkstra's, 1956, written in twenty minutes at a café in Amsterdam) to decide where to send your packet next. The page you are reading came through roughly a dozen of them. Along the way, bits flip: cosmic rays, bad solder, a noisy radio. Richard Hamming, tired of his weekend computer runs failing at Bell Labs in 1950, designed codes that add a few check bits so that an error can be not only detected but located and reversed. Every QR code, every CD, every message from a Mars rover carries its own repair instructions. Claude Shannon had proved two years earlier that this was possible up to a hard limit, and told nobody how; Hamming showed how.

try · press Flip a random bit and watch the receiver repair it

Go deeper

Hamming(7,4) sends four data bits as seven. Three parity bits each watch a different overlapping set of positions; when one bit flips, the pattern of which parities fail spells out, in binary, the position of the error. The web uses stronger cousins: Reed–Solomon codes (Irving Reed and Gustave Solomon, 1960) correct bursts, and the LDPC codes in 5G and Wi-Fi get within a hair of Shannon's limit. Google's original idea, PageRank, is also the internet as mathematics: the importance of a page is the eigenvector of the link graph: the steady state of a reader who clicks forever at random. The internet does not know what anything means. It knows where things are and how to repair them.

Privacy

Two strangers, shouting across a crowded room, can agree on a secret that nobody in the room can learn. That sentence sounded impossible until 1976. It is the reason you can buy anything online.

Whitfield Diffie and Martin Hellman's idea: pick a public number g and a public prime p. You choose a secret a and shout ga mod p. I choose b and shout gb mod p. You raise what I shouted to your a; I raise what you shouted to my b; we both hold gab mod p. Everyone heard everything, and nobody can get ab back from ga and gb, because undoing a modular power, the discrete logarithm, is as hard as factoring. This handshake happens, with 256-bit numbers on an elliptic curve, every time a padlock appears in your address bar; it happened when you opened this page.

Privacy also has a mathematics of its own. In 2000 Latanya Sweeney showed that 87 % of Americans are uniquely identified by three "anonymous" facts: ZIP code, birth date, sex, and re-identified the governor of Massachusetts in a released hospital dataset. Cynthia Dwork's answer, differential privacy (2006), adds precisely calibrated noise so that a dataset says the same thing whether or not you are in it. Apple and the US Census use it now. Privacy is not secrecy; it is a bound on how much any one person moves the answer.

try · move both secrets: the shared key always matches

Go deeper

With p = 23 the eavesdropper can simply try all 22 possibilities. With a 2048-bit p the number of possibilities exceeds the atoms in the universe by hundreds of orders of magnitude, and no shortcut is known on ordinary computers. Shor's quantum algorithm would find one, which is why, since 2024, browsers have begun pairing this handshake with lattice-based schemes whose hardness survives quantum machines. Nobody has proved any of these problems are truly hard. The whole edifice is a bet that P ≠ NP, the open problem in “What is not known”.

Enigma

try · type a message: each letter you type goes in on the top row, runs through the machine, and comes out as the letter below it · copy the scrambled row, start again from the same positions, type it in, and it comes back plain

Press a key and an electric current runs through three wired wheels, bounces off a fourth, and comes back through all three as a different letter. Then the first wheel turns, and the same key gives a different letter next time.

The German forces' Enigma machine turned every message into a new scramble, letter by letter. Each rotor is a fixed shuffle of the alphabet, a permutation; stacking three and turning them after every key makes a new permutation for every letter of a message. The settings changed every day: which three of five rotors, in what order, where each started, and ten cables on a plugboard swapping pairs of letters. That is 158,962,555,217,826,360,000 possible starting settings, and the operators believed no one could search them.

But the reflector that sends the current back through the rotors has a price: a letter can never encrypt to itself. That single impossibility let codebreakers rule out most guesses at once. In 1932 the Polish mathematician Marian Rejewski worked out the rotor wiring using the theory of permutation groups, with Jerzy Różycki and Henryk Zygalski. At Bletchley Park, Alan Turing and Gordon Welchman built the bombe, an electromechanical machine that tested thousands of settings an hour against a guessed word in the message. Historians estimate the breaking of Enigma shortened the Second World War by about two years.

Go deeper
60 × 26³ × 150,738,274,937,250 ≈ 1.59 × 10²⁰

Sixty rotor orders (5 × 4 × 3), 17,576 starting positions (26³), and 150,738,274,937,250 ways to place ten cables on the plugboard, which is 26! ⁄ (6! · 10! · 2¹⁰). Because the machine is its own inverse, the same settings that encrypt also decrypt: the operator at the other end typed the scramble and read the message. Each rotor is a permutation, and the whole machine for one key press is the product P⁻¹ R₁⁻¹ R₂⁻¹ R₃⁻¹ U R₃ R₂ R₁ P, a conjugate of the reflector U. A conjugate of a swap of pairs is again a swap of pairs, which is why the machine is its own inverse and why no letter can ever become itself. Turing's bombe is a direct ancestor of the computers in the rest of this journey, and the idea that a cipher's security must rest on a key and not on a secret machine is now a first principle of cryptography, the one RSA and Diffie–Hellman above are built on.

Identity

There are about eight billion people. To pick out one of them takes thirty-three yes-or-no questions, because 233 ≈ 8.6 billion. Every small fact about a device is worth some fraction of a question. A screen size is worth about four, a time zone three; fonts, graphics card and settings add the rest.

This is Shannon's entropy, the same measure that sets how far a file can be compressed. In 2010 the Electronic Frontier Foundation measured the browsers of half a million volunteers and found that 84 % were unique: no cookie, no login, just the sum of small choices. Combined, those small facts behave like a hash: change one and the whole fingerprint changes, keep them and it stays the same from site to site.

Mathematics has a more hopeful answer, too. In 1985 Shafi Goldwasser, Silvio Micali and Charles Rackoff described proofs of knowledge that reveal nothing but the fact that you know: that you are over eighteen without saying your birthday, that you have the password without sending it, that a sum is correct without showing the numbers. Zero-knowledge proofs are no longer a curiosity; they settle transactions and verify identities today. The oldest question about identity (are you the same person you were, with all your parts replaced?) turns out to have an engineering form: what is the smallest thing you must reveal to be believed?

Go deeper

The numbers at left are rough entropy estimates from the EFF's study and later ones, for a typical browser; real measurements use hundreds of signals. Thirty-three bits is the whole of humanity; a page that reaches it knows which person you are, without ever learning who you are. The gap between those two is where privacy lives, and it is a gap that mathematics both opened and, in the hands of the right people, can close again.

Your face, as dots

try · switch between the wall and the face and watch the dots move · drag to turn the head

To recognise you, a phone throws a pattern of invisible dots at your face and measures how far each one moves.

Face ID's projector casts more than 30,000 infrared dots in a fixed, random-looking pattern. A camera set a short distance to one side photographs them. On a flat wall every dot lands where the phone expects it; on a face, each dot is pushed sideways by an amount that depends on how near that patch of skin is, the same triangulation the self-driving car uses with two cameras, and the same geometry Eratosthenes used to measure the Earth. From those shifts the phone builds a depth map of your face, turns it into a list of numbers, and compares the list with the one it stored. Apple puts the chance that a random stranger's face would unlock your phone at about one in a million.

Three kinds of fingerprint run through this journey: the small facts a device gives away, a face as a cloud of dots, and, at the end, the rhythm of hands typing a message. Each is identity written as numbers, and each is protected by the same mathematics.

Go deeper
depth = baseline × focal length ⁄ shift

This is structured light. The pattern is random-looking on purpose: in a regular grid, every dot looks like its neighbours and the camera could not tell which dot it is seeing. In a random pattern, every small patch of dots is unique, so each can be found again and its shift measured. A dot that moves twice as far is half as distant. The same method scans buildings, inspects factory parts and captured the motion of actors in early video games. What Face ID keeps is not a photograph but a mathematical summary, held in a separate chip on the phone.

VII.2 · You

Where you are, by relativity

Your phone finds you by timing radio signals from satellites 12,550 miles up. To get it right it has to use both of Einstein's theories of relativity.

try · drag yourself along the Earth · turn off the relativity correction and slide the days forward, and watch where the phone thinks you are walk away from where you are

Each satellite broadcasts the time. Your phone notes when the signal arrives, multiplies the delay by the speed of light, and knows how far away that satellite is. Light covers about a foot in a billionth of a second, so a clock that is off by one millionth of a second puts you nearly a thousand feet out.

One distance puts you somewhere on a sphere. Three spheres meet at a point, and a fourth satellite lets the phone correct its own cheap clock, which is why it needs four. The satellites carry atomic clocks, and here relativity comes in twice. They move at 8,700 mph, and Einstein's special relativity says a moving clock runs slow: about 7 microseconds a day. They sit 12,550 miles up, where gravity is weaker, and general relativity says a clock higher in a gravity well runs fast: about 46 microseconds a day. Together the clocks gain about 38 microseconds a day.

That sounds like nothing. At the speed of light it is about 7 miles of range error a day, growing every day. So the satellite clocks are built to tick slightly slow before launch, 10.22999999543 million times a second instead of 10.23 million, so that in orbit they keep time with clocks on the ground. Every map on every phone is a daily test of relativity, and relativity passes.

Go deeper
Δt ⁄ t ≈ −v² ⁄ 2c² + ΔΦ ⁄ c²

The first term is special relativity: at the orbit's speed v of 3.87 km/s, v² ⁄ 2c² is 8.3 parts in a hundred billion, 7.2 microseconds a day slow. The second is general relativity: the difference in gravitational potential between the ground and the orbit, GM(1⁄R_Earth − 1⁄r_orbit) ⁄ c², with r = 26,560 km (16,500 miles from the Earth's centre), is 5.3 parts in ten billion, 45.7 microseconds a day fast. The net 38.5 microseconds, times c, is 11.5 km, about 7.2 miles, a day. The receiver solves for four unknowns, three for position and one for its own clock error, from four ranges, by repeatedly correcting a guess. A clock error shared by every satellite would vanish into the receiver's own clock error; what moves you is that each satellite's clock has drifted a different amount since it was last set.

VII.3 · You

Rank, by random walk

A page matters if pages that matter link to it. That sounds circular. It is, and the circle has exactly one answer.

try · tap one page, then another, to add or remove a link between them · watch the wandering dot's share of time settle onto the computed rank

Imagine someone clicking links at random, forever. Most of the time they follow a link from the page they are on; now and then they get bored and jump to any page at all. The share of time they spend on each page is its rank.

In 1998 two Stanford students, Sergey Brin and Larry Page, used that imaginary surfer to rank the web. Search engines of the time mostly counted how often a page used your words, which anyone could fake. Brin and Page counted links instead, and weighted each link by the rank of the page it came from, so a single link from an important page outweighs a hundred from pages nobody links to. They called it PageRank, and founded Google on it that year.

The mathematics is older than the web. The surfer is a Markov chain, named for Andrey Markov, who in 1906 studied processes where the next step depends only on where you are now. Here the boredom matters: the surfer jumps to a random page 15% of the time, so they can never get stuck in a corner of the web, and the long-run shares are guaranteed to exist and to be unique.

Go deeper
PR(p) = (1 − d) ⁄ N + d · Σ PR(q) ⁄ L(q)

Each page's rank is a small share for everyone, (1 − d) ⁄ N, plus d times the rank of every page q that links to it, divided by the number of links L(q) leaving q. With the damping d = 0.85 used in the original paper, the surfer follows a link 85% of the time. Written for all pages at once, the ranks are a vector r with r = d·M·r + (1 − d) ⁄ N, so r is an eigenvector: the one direction the link matrix leaves unchanged. The Perron–Frobenius theorem guarantees it exists and is unique, and the simplest way to find it is to start anywhere and apply the rule again and again, power iteration, which is what the large numbers here do. A page with no links out sends its surfer to a random page. The small numbers are the dot's actual share of time, and by the law of large numbers they creep toward the large ones.

VII.4 · You

Torn, and still readable

Add a few extra numbers, chosen cleverly, and a message survives losing part of itself.

try · drag across the blocks to scratch them out · up to six damaged bytes, anywhere, and the message comes back whole · scratch a seventh and it cannot

A QR code still scans with a coffee stain on it. A scratched CD still plays. The same idea brought back the Voyager pictures of Uranus and Neptune across nearly three billion miles (4.5 billion kilometres) of noise.

In 1960 Irving Reed and Gustave Solomon, at MIT's Lincoln Laboratory, turned a message into a polynomial. Its bytes are the coefficients; send not just the message but extra values of the polynomial, and the receiver has more points than it needs to pin the curve down. With twelve spare bytes, as here, it can find and fix any six that were damaged, without being told which ones. Reed–Solomon codes went on to compact discs, DVDs, Blu-ray, deep-space probes, hard drives and barcodes.

When Masahiro Hara at Denso Wave designed the QR code in 1994 to track car parts in a factory, he built Reed–Solomon in from the start. A QR code's error-correction level is chosen when it is made: L, M, Q or H restores about 7, 15, 25 or 30% of the code. Some companies use level H to print their logo over the middle of the code; the maths quietly repairs the hole.

Go deeper
2 · errors + erasures ≤ n − k

A message of k bytes with n − k repair bytes can correct up to (n − k) ⁄ 2 errors at unknown places, or twice as many erasures, damage whose position is known. The arithmetic happens in a field of 256 elements, GF(256), named for Évariste Galois: every byte is a number, adding is exclusive-or, and every non-zero byte has an inverse, so the decoder can divide. It computes syndromes, the polynomial's values at the points where an undamaged codeword would be zero; the Berlekamp–Massey algorithm turns them into a polynomial whose roots mark the damaged positions; Forney's formula then gives the size of each error. The whole method rests on one fact of algebra: a polynomial of degree k − 1 is fixed by any k of its values, so extra values are spare copies of the same information.

VII.5 · You

Why cooperate

Two players, two choices, and a temptation to betray. Played once, betrayal wins. Played again and again, something else does.

try · pick an opponent, then cooperate or defect, round after round, and watch the score · then run Axelrod's tournament and see which rule wins, and which rule takes over the population

If you both cooperate, you each get 3. If you both defect, you each get 1. If one defects while the other cooperates, the defector gets 5 and the trusting one gets nothing.

Whatever the other player does, you score more by defecting, so two perfectly logical players both defect and each walk away with 1 when they could have had 3. Merrill Flood and Melvin Dresher found the game at the RAND Corporation in 1950, Albert Tucker gave it its story of two prisoners, and it showed that John Nash's equilibrium, the point where neither player gains by changing alone, can be the worst result for both. RAND was studying the arms race at the time, and the same logic, two sides each made safer alone by building more weapons and both made poorer together, ran through Cold War strategy from John von Neumann to the economist Thomas Schelling.

But people rarely meet only once. In 1980 the political scientist Robert Axelrod invited game theorists to send computer programs to play the game against each other for 200 rounds. The winner was the shortest program entered, four lines from the psychologist Anatol Rapoport: Tit for Tat. Cooperate first, then do whatever the other player did last. He ran the tournament again with more entrants who knew the result, and it won again. Axelrod summed up why: it is nice, never the first to defect; retaliatory, so it cannot be exploited; forgiving, returning to cooperation the moment the other side does; and clear, so the other side soon learns what it will do. Tit for Tat never beats the player in front of it. It wins by doing well with everyone.

Go deeper
T > R > P > S  and  2R > T + S

Any payoffs with the temptation (5) above the reward for cooperating (3), above the punishment for mutual defection (1), above the sucker's payoff (0), make a prisoner's dilemma; the second condition stops two players from doing better by taking turns to betray each other. In a single round, defecting is always better whatever the other player does, so two rational players both defect and each scores 1 when they could have had 3: the Nash equilibrium is worse for both than cooperation. Repetition changes the arithmetic. If the game continues with probability w each round, a cooperative partner is worth 3 ⁄ (1 − w) over the future, and once w is large enough, 5 now is no longer worth losing that. The rules in the tournament: Tit for Tat, Always Defect, Always Cooperate, Random, Grudger (cooperates until betrayed once, then never again), Joss (Tit for Tat that sneaks in a betrayal one time in ten) and Tester (defects first to probe, apologises if punished, and exploits anyone who never punishes). The second chart is Axelrod's ecological tournament: each generation, every rule's share of the population grows in proportion to its score against the population as it stands. The exploiters feed on the trusting until the trusting are gone, then starve, and the population fills with rules that cooperate but hit back.

We must know. We will know.
David Hilbert, 1930
VII.6 · You

What is not known

Every room above is settled. These are not. Some have been open for centuries; some could be settled by a child with the right idea tomorrow.

VII.7 · You

How far we have come

One number, measured for four thousand years. The digits of π that humanity knew, by date. The axis is logarithmic; the curve is not slowing down.

try · move across the chart to see who held each record

For three thousand years the record was held by a person with a pen. For the last seventy it has doubled roughly every two years, held by a machine.

The Babylonians had 3⅛. Archimedes squeezed π between polygons and found two decimals. Zu Chongzhi in fifth-century China found seven, a record that stood for nine hundred years. The Dutch mathematician Ludolph van Ceulen, around 1600, spent most of his life on 35 digits and had them carved on his gravestone. The English amateur William Shanks spent twenty years computing 707 digits by hand in 1873; the last 180 were wrong, and nobody noticed until 1944. ENIAC found 2,037 digits in seventy hours in 1949. We now have over a hundred trillion. No one needs more than forty to measure the observable universe to the width of an atom. We compute them anyway, for the same reason we climb.

Go deeper

The curve is a proxy for something harder to measure: how much mathematics exists. Euclid's Elements held about 465 propositions. Today roughly 100,000 new theorems are published a year, more than any person could read, let alone check. Lean's mathlib, a computer-verified library, passed 200,000 theorems in 2025, and a growing share of new results are being formalised so that a machine, not a referee, confirms them. The question underneath the chart is whether understanding grows as fast as knowledge, or whether we are becoming a civilisation that knows things it does not understand.

VII.8 · You

Where next

For the first time, the maker of patterns might not be a person.

In 1976 a computer checked the Four Colour Theorem and mathematicians asked whether a proof no one could read was a proof. In 2025, machines reached gold-medal level at the International Mathematical Olympiad, and the question changed: whether a proof no one thought of is a discovery.

Kepler's sphere-packing conjecture, open since 1611, was proved in 1998 and took a decade and a computer to verify. AlphaProof solved Olympiad problems in 2024. Within a year, systems from several labs were producing proofs for Erdős problems that had sat unsolved for decades, not all of them correct, some rediscoveries, a few genuinely new. The pace is the point. The limiting step is becoming what to ask, not how to answer.

What does not change: a proof is still a proof only when it can be followed. Gödel showed in 1931 that no system, human or machine, can prove all the truths it can state, and Turing showed in 1936 that no machine can settle every question. The unknown is not a shrinking territory we will someday finish mapping. It is a property of the map.

And the meaning of it

Mathematics does not answer what life is for. It is honest about that; it is the one subject that states its assumptions out loud. What it offers instead is the only kind of truth that does not depend on who you are, where you were born, or when. The ratio in the first room is the same for the Babylonians, for the teacher who loved it, and for whatever reads this after us. Galileo said the universe is written in this language. Perhaps it is simpler: this is the part of the universe that can be read.

VIII

Coming home

Less is more.

VIII.1 · Coming home

The sky, simplified

For fourteen centuries the planets needed circles on circles. Then one change of viewpoint, and one law, explained them all.

try · move the centre from the Earth to the Sun and watch Mars's loops unwind into an ellipse · turn on Ptolemy's circles to see how the old model drew them

Seen from the Earth, Mars drifts east for most of two years, stops, runs backwards for about ten weeks, stops again and carries on. Seen from the Sun, it just goes round.

Around 150 AD Ptolemy put the Earth at the centre and explained the backward loops by putting each planet on a small circle, an epicycle, whose centre rode on a large one. It worked well enough to predict the sky for fourteen hundred years, but every planet needed its own circles, adjusted and readjusted as the predictions drifted. In 1543 the Polish astronomer Nicolaus Copernicus moved the centre to the Sun, and the loops became an illusion: just the Earth overtaking a slower planet on the inside lane, the way a car you pass seems to slide backwards. In 1609 Kepler, working from the Danish astronomer Tycho Brahe's measurements of Mars, replaced the circles with ellipses, and in 1687 Newton showed that ellipses follow from a single rule that also makes an apple fall and keeps the Moon in its orbit.

The planets did not change. The point of view did, and with it a page of circles turned into one line. That is what the mathematics in this journey keeps doing: the complicated thing is real, but underneath it is something simple, waiting for the right place to stand.

Go deeper
F = G · m₁ · m₂ ⁄ r²

Every mass pulls every other mass, in proportion to both masses and in inverse proportion to the square of the distance between them. From that one line follow all three of Kepler's laws: orbits are ellipses with the Sun at one focus, a planet sweeps out equal areas in equal times, and the square of its year is proportional to the cube of its distance. Mars is 1.524 times as far from the Sun as we are, so its year is 1.524^1.5 ≈ 1.88 of ours. Ptolemy's construction is not wrong, only roundabout: the Earth-centred position of Mars is exactly its Sun-centred orbit plus the Earth's orbit run backwards, a circle riding on a circle. The large circle is called the deferent and the small one the epicycle. Where a planet is on its ellipse at a given time comes from Kepler's equation, M = E − e sin E, which has no solution in closed form; it is solved by successive guesses, each closer than the last.

∇·E = ρ⁄ε₀∇·B = 0∇×E = −∂B⁄∂t∇×B = μ₀J + μ₀ε₀ ∂E⁄∂t
James Clerk Maxwell, 1865 · electricity, magnetism and light, in four equations
A C G T
DNA · all of life, in four letters
eiπ + 1 = 0
Euler · five constants from different corners of mathematics, in one line
0 1
Binary · every machine in this journey, in two digits, the row it started with
For someone who was never meant for this world, I must confess I'm suddenly having a hard time leaving it. Of course, they say every atom in our bodies was once a part of a star. Maybe I'm not leaving. Maybe I'm going home.
Vincent Freeman, Gattaca, 1997

try · drag across the picture to roll the circle · let go and it keeps rolling

the first thing you saw

Claude Shannon defined information as surprise: a message carries exactly as much as it could not have been predicted. By that measure, nothing on this page holds any information at all. All of it was certain before you arrived. The only thing here that cannot be computed is what you would say.

mathphile

-phile, from the Greek: one who loves.

with a few hundred keys, timing like this tells one typist from almost any other. it stays in your browser.

What is this?

As you type, each key becomes a point: its angle comes from the letter, its distance from the centre from how long you paused before it. The shape that grows is your rhythm, and rhythm is personal. In the Second World War, radio operators could recognise who was sending Morse code by the timing alone, which they called the sender's fist. Today it is called keystroke dynamics, and a few hundred keys are enough to tell most people apart: a fingerprint you make with your hands without touching anything.

It is the third fingerprint of this journey, after the trail your browser leaves and the dots a phone throws at your face. Latanya Sweeney showed in 2000 that a ZIP code, a birth date and a sex single out 87% of Americans, and thirty-three yes-or-no facts are enough to single out one person among eight billion. Your typing rhythm is another such fact. This page draws it and then forgets it: the rhythm never leaves your device. Only the words you choose to send are sent.

Which is the point of the message itself. By Shannon's measure, everything else on this page was predictable before you arrived. What you write is the one thing here that was not.

Thanks to the people who build and give away
the tools this page was made with

Ryan Dahl · Node.js
Guido van Rossum · Python
Torbjörn Granlund · GMP
Case Van Horsen · gmpy2
Fabrice Bellard · FFmpeg
Laurent Aimar · x264
Linus Torvalds and Junio Hamano · Git
The Chromium authors · Chromium
Steve Coast · OpenStreetMap

and the thousands of contributors who carried their work forward
For Eliana and Sebastian
with love, Grandma
© 2004–2026 Jennie Choe

Index