Arithmetic and NumbersDeeper

Kayavak / Arithmetic and Numbers / AN·04 Multiplying and Dividing / Deeper

Deeper · Arithmetic and Numbers

Multiplying and Dividing

The questions the chapter doesn't stop for: why this exists, the model to keep in your head, what changes when an assumption does, how sure we are of each claim, and what's still open. Read it after the chapter; back to the chapter.

Why does this exist?

The oldest written multiplication method, in the Egyptian Rhind papyrus (about 1550 BCE), doubled one number repeatedly and added the right doublings, the halving-and-doubling method in this chapter's exercises; it's binary multiplication four thousand years early. Babylonian scribes used tables of products and reciprocals, dividing by multiplying by a reciprocal. Place value made the shifted-rows method possible, and Indian and Arabic texts describe several layouts, including the lattice. Long division was the hardest to settle: European arithmetic books taught the "galley" or scratch method into the 1600s, and the layout schools use now took over after that.

The effort to make multiplication easier shaped mathematics: John Napier's rods ("Napier's bones", 1617) mechanised the lattice, and his logarithms (1614) turned multiplication into addition, which the slide rule exploited for three centuries. In 1960 Andrey Kolmogorov conjectured that multiplying n-digit numbers needs about n2 steps; Anatoly Karatsuba refuted it within a week. Faster methods followed (Toom–Cook, then Schönhage and Strassen's fast-Fourier-transform method in 1971), and in 2019 David Harvey and Joris van der Hoeven reached O(nlogn), conjectured to be the best possible.

The mental model

Try it yourself first: write your own model in the Mental Model Explorer, then compare.

Multiplication is splitting rectangles by place value and adding the pieces; division is taking away the biggest chunks first, one place at a time. For whole numbers, a=qb+r with 0≤r<b always has exactly one answer, and the story decides what the remainder means.

Question Answer
What is it? Methods for products, quotients and remainders of numerals, and the theorem behind division
Problem it solves Products and shares of any size from a small table of facts
Parts Times-table facts, shifted partial products, the division algorithm, quotient digits estimated and checked
How it works Distributivity over expanded form; each quotient digit is "how many times", with remainder below the divisor
Assumptions Whole numbers; divisor at least 1; enough digits (or bits) for the result
When they change Negative numbers need a remainder convention; fractions make division exact (ch06); fixed widths overflow
Where it fails Division by zero; skipped zeros in quotients; overflow of products in fixed-width types
Related ideas Place value (ch02), carries (ch03), divisibility and gcd (ch05), fractions (ch06), repeating decimals (ch07)

What if?

What if multiplication weren't commutative?

Reason it through, then open

The rectangle argument would have to fail, so "a rows of b" and "b rows of a" would be different things. For numbers that can't happen, but for other mathematical objects it does: rotating an object and then turning it over usually gives a different result from turning it over and then rotating it, and matrices (which describe such moves) don't commute. William Rowan Hamilton's quaternions (1843), used today for 3D rotations in graphics and spacecraft, were the first number-like system people deliberately built without commutative multiplication. Long multiplication would still work, but you'd have to keep every product in its original order.

What if remainders could be negative?

Reason it through, then open

Allow r anywhere from −b2 to b2 and you get the "least absolute remainder": 17=3×5+2 still, but 18=4×5−2. Every number still has exactly one such quotient and remainder (with a tie rule at exactly half), and some algorithms converge faster with it, because the remainder is never more than half the divisor; one version of Euclid's algorithm uses it. Programming languages already disagree about remainders for negative numbers (floored, truncated, Euclidean); this is one more convention, and the theorem's content is only that, once you fix the allowed range, the answer is unique.

What if computers had no division instruction?

Reason it through, then open

Many early and small processors didn't. Division is then a subroutine: binary long division, one quotient bit per step (shift, compare, subtract), which is chapter 4's method with the times table reduced to "0 or 1 times". It's slow, so programmers avoided it: dividing by a power of two became a shift, and dividing by a constant became multiplication by a precomputed reciprocal. Modern compilers still do exactly that, because even with a hardware divider, division takes several times longer than multiplication.

Where the boundary is

Aspect Division with remainder (17=3×5+2) Exact division (17÷5 =3.4 =175)
Works in Whole numbers Fractions (ch06) and decimals (ch07)
Answer Two whole numbers, quotient and remainder One number
Always exists Yes, for any divisor of at least 1 Yes, for any divisor except 0
Right when Things come in wholes: people, buses, eggs The quantity can be split: juice, money (to the paisa), length
In code divmod, // and % / (floating point) or a fraction type

Derive it

Why Karatsuba's method takes about n1.585 steps.

  1. To multiply two n-digit numbers, split each into halves of n/2 digits: a=a110m+a0, b=b110m+b0.
  2. The product is a1b1102m+(a1b0+a0b1)10m+a0b0. Done directly that needs four half-size products.
  3. Karatsuba computes the middle coefficient as (a1+a0)(b1+b0)−a1b1−a0b0, reusing the two outer products, so three half-size products are enough (plus additions, which cost only about n steps).
  4. Apply the same trick to each half-size product, and again, k=log2n times, until the pieces are single digits. At each level the number of products triples, so the bottom level has 3k single-digit products.
  5. 3log2n =nlog23≈n1.585, against 4log2n=n2 for the school method. The additions at each level don't change this growth rate. For 256 digits that's a few thousand products against 65,536, as the chapter's lab counted.

How sure are we?

Claim How it's known Where from
Quotient and remainder exist and are unique for b≥1 Theorem The chapter's proof; checked on 100,000 long divisions in the lab
An m-digit times n-digit product has m+n−1 or m+n digits Theorem Bounds 10m−1≤a<10m; checked over every pair up to three digits
Karatsuba needs about n1.585 digit products Theorem The derivation above; counted in the lab
O(nlogn) is the fastest possible multiplication Active research Harvey and van der Hoeven reached it in 2019; no matching lower bound is proved
Remainders of negative numbers are floored in Python, truncated in C and JavaScript Convention Each language's specification
The modern long-division layout replaced the galley method in the 1600s Historical Histories of European arithmetic textbooks

Still open

Whether integer multiplication can be done faster than nlogn is unknown: it's widely believed not, but no proof exists, and proving lower bounds for such problems is one of the hard open areas of complexity theory. Matrix multiplication, its cousin, is wide open: the best known exponent has crept down from 3 to about 2.37 over fifty years, and whether it can reach 2 is unknown.

What would change your mind? The chapter treats long multiplication as the right method for people and small numbers. A method that is reliably faster and less error-prone by hand, for numbers of the size people meet, and just as easy to learn, would make it worth replacing; the lattice and box methods are sometimes argued to be that, especially for learners.

Recall

Why does long multiplication shift each row left?

Each row is the first number times one digit's place value; tens shift one place, hundreds two.

What makes the remainder unique?

It must lie from 0 to b − 1; any two candidates would differ by a multiple of b in that range, which is 0.

How many digits can a 4-digit times 3-digit product have?

6 or 7.

What does "bring down" mean in long division?

Unbundling the leftover into the next place and adding that place's digit.

Why is Karatsuba faster than long multiplication for big numbers?

Three half-size products instead of four, compounding at every level: about n^1.585 instead of n².

Reflect

Be honest with yourself; this stays in your browser. Anything you can't tick yet is what to revisit.