Equations quit being word-problems about plots of land and become procedures you crank — the same steps, every time, no cleverness required. Then Descartes bolts a grid under geometry, and every curve you can draw turns into an equation you can solve.
Chapter 1 ended with a complaint: the Greeks proved beautiful things but never wrote an equation. They drew pictures and argued about lengths. This chapter is where someone finally writes the symbols down — and turns solving them into something a machine could do.
The scene is Baghdad, around 820 CE, in the House of Wisdom. A scholar named Muhammad ibn Musa al-Khwarizmi writes a book with a mouthful of a title: al-Kitab al-mukhtasar fi hisab al-jabr wa'l-muqabala — "The Compendious Book on Calculation by Restoring and Balancing." Two words in that title will outlive empires. al-jabr, "restoring," becomes our word algebra. And the Latinization of the author's own name — al-Khwarizmi → Algoritmi — becomes our word algorithm. One book, two of the load-bearing words in your entire profession.
What did the book actually do? It took equation-solving and stripped the cleverness out of it. Before al-Khwarizmi, solving a problem meant being smart in a way specific to that problem. His move was to sort every linear and quadratic equation into a handful of standard shapes, and give each shape a fixed recipe: do these steps, in this order, and the answer falls out. No flash of insight required. Same steps, any equation of that shape. That's not a trick — it's a procedure, and the modern reader knows exactly what to call a fixed list of steps that always terminates with the right answer.
Notice he had no symbols yet. The whole book is written in words — "the thing" for the unknown, sentences for operations. The genius is the algorithmic thinking, not the notation. The notation takes another seven centuries to catch up, and we'll watch it arrive piece by piece in this chapter.
Here's the mental model that makes al-Khwarizmi's "balancing" click. An equation is a scale. The = sign says the two pans weigh the same. 2x + 3 = 11 means: two mystery boxes plus three unit weights on the left pan, eleven unit weights on the right, and the scale sits level.
Now there's exactly one rule, and the whole of school algebra is just this rule applied over and over: whatever you do to one pan, you must do to the other. Take three weights off the left? Take three off the right too, or the scale tips and your equation stops being true. Halve the left pan? Halve the right. The legal moves are the operations that keep both pans equal — and they come in inverse pairs, because to undo "+3" you do "−3", to undo "×2" you do "÷2".
Solving for x is just picking inverse moves that peel away everything stuck to the box until a single box stands alone on one side and a number sits on the other. x = 4. That's the answer — and "restoring/balancing", al-jabr wa'l-muqabala, is literally the name for these two moves. The widget below only ever offers you legal moves. Pick them and watch the weights leave both pans in step.
al-Khwarizmi cracked the quadratic — equations with an x² in them. The next rung up, the cubic (an x³), held out for seven hundred more years and arrived wrapped in one of the great soap operas of mathematics.
Early-1500s Italy ran on math duels. Two scholars would trade lists of problems; whoever solved more in public kept his job and his reputation. So when someone found a method for solving cubics, they hid it — a secret weapon, not a publication. Niccolò Tartaglia worked out a method and guarded it. Gerolamo Cardano coaxed it out of him under a solemn oath of secrecy — then published it anyway, in his 1545 book Ars Magna, with a workaround for the oath (he'd found that someone else had it first). Tartaglia was, predictably, furious. The cubic formula reached the world as half a theft.
But the real scandal was hiding inside the formula. Run it on certain perfectly innocent cubics — ones with three honest, real, whole-number solutions — and the recipe forces you to compute the square root of a negative number halfway through. A thing that, by every rule anyone knew, did not exist. And yet: push the impossible quantities through the algebra anyway, let them cancel, and out the far end drops the correct, ordinary, real answer. The formula routed through a number that "couldn't be there" and landed dead on target. Nobody could say why it worked.
√(negative) as a stepping-stone to a real answer it gets exactly right. Mathematicians used these "imaginary" numbers for 300 years as a tool they didn't trust and couldn't justify. The full apology for i — making the complex numbers respectable — has to wait until Chapter 4. For now, just note the bug report stayed open for three centuries.So far the "unknown" has been a single mystery box — al-Khwarizmi's "thing," our x. But every problem still got solved one specific equation at a time. 2x + 3 = 11 and 5x + 1 = 16 were two separate jobs.
Around 1591, a French lawyer-mathematician named François Viète had the upgrade that changes everything: use letters for the known quantities too. Not just x for the unknown, but a, b, c for the numbers you happen to have. Suddenly you don't write one equation — you write ax² + bx + c = 0, and that single line is every quadratic at once. Solve it once, in letters, and you've solved all of them. The quadratic formula you memorized in school is exactly this: a solution written for the whole family, with slots you plug your actual numbers into.
To a programmer this is an old friend. The unknown x is the value you're solving for; Viète's a, b, c are parameters — the generics. solveQuadratic(a, b, c) beats writing a fresh function for every set of coefficients. Viète gave mathematics its type variables. From here on, symbols aren't shorthand for a particular sum; they're a language you compute in, with rules for rearranging that don't care what the letters stand for. Math became programmable.
2x+3=11 and solving ax+b=c is the difference between a script and a function. One does a job; the other does the whole family of jobs.Now the two halves of mathematics — the Greek pictures from Chapter 1 and the new symbol-pushing — get welded together. The year is 1637. René Descartes (and, independently and slightly earlier, Pierre de Fermat) does something that sounds obvious only because we grew up inside the result: he slides a grid underneath geometry.
Every point in the plane gets an address — a pair of numbers (x, y), its coordinates. We still call it the Cartesian plane, after Descartes. And once points have numeric addresses, a curve stops being a drawing and becomes something far more useful: the set of all points whose address satisfies an equation. The line y = 2x + 1 isn't a stroke of ink; it's the collection of every (x, y) that makes the equation true. The circle of radius 5 is every point where x² + y² = 25.
For an FP engineer this framing is the punchline: a curve is a predicate on coordinates. onCurve(x, y): Boolean. The shape is exactly the set of inputs that return true — a filter over the whole plane. That's it. Geometry, the discipline of compass and straightedge, just became a question about which (x, y) pass a test. Drag the lab below: change the equation, watch the predicate's "true set" redraw itself as a curve.
Once curves are equations, every geometric question becomes an algebra question — and that's the takeover. Watch a few classics fall:
(x₁,y₁) and (x₂,y₂) is √((x₂−x₁)² + (y₂−y₁)²). The hypotenuse you used to draw is now something you compute.x and y. One family of equations covers the lot. Change a coefficient and a circle stretches into an ellipse.true at once.Step back and look at what just happened. Two thousand years of compass-and-straightedge work — Chapter 1's entire toolkit — compiles down to algebra. The hard geometric proofs become routine symbol-pushing that, frankly, a machine could grind through. (Hold that thought too; a machine eventually will — see Chapter 13.) Descartes didn't just translate geometry into algebra. He made algebra the assembly language that geometry runs on top of.
Bolting a grid under geometry did more than make old proofs easy. It handed mathematics three new powers. First, the function and its plot: feed x through a rule, get y, and the input-output pairs trace a shape you can see. A function is no longer an abstraction; it's a curve. Second, graphical computing — you can answer a question by drawing it and reading the answer off the picture, the great-great-grandparent of every plot, chart, and dashboard you've ever shipped.
And third — the one that sets up the entire next act — Descartes left a question lying on the table. Once a curve is an equation, you can ask things about it that no drawing could answer cleanly. Like: how steep is it, right here, at this exact point? Not the average slope over a stretch, but the steepness now, at a single instant. That question has no compass answer. But it has an algebraic one, and in the very next century someone reaches out and grabs it.
In Chapter 3, two gamblers start writing letters about a dice game and accidentally found probability — and Newton, staring at a falling apple, asks exactly that question about steepness and invents the machinery to answer it. Chance and change, born in the same hundred years. Onward.