Chapter 7

Multiplication

Multiplication tables are the worst part of learning arithmetic — 144 facts to memorize, from 1×1 up to 12×12. Binary has a secret: its multiplication table only has two facts in it.

The entire binary times-table

×01
000
101

Anything times 0 is 0. Anything times 1 is itself. That's the whole table — and you've already met the circuit that computes it. Look familiar? It's identical to the AND gate truth table from Chapter 3. Multiplying two single switches together is an AND gate.

Scaling it up

To multiply a whole number A by a whole number B, do what you did in grade school: multiply A by each digit of B separately, shift each result over according to that digit's place value, then add everything up. The only difference in binary is that each of those "digit multiplications" is either copy A exactly (if that bit of B is 1) or write all zeros (if that bit of B is 0) — decided by a single AND gate per bit, no memorization required.

Worked example
A = 5 = 0101
B = 3 = 0011
0101 — B's place-1 bit is 1, so copy A
1010 — B's place-2 bit is 1, so copy A shifted over one
0000 — B's place-4 bit is 0, so all zeros
0000 — B's place-8 bit is 0, so all zeros
1111 = 15

Every row is either A itself or nothing — decided one bit of B at a time — then added up into the final product.

Interactive — Multiply Two Numbers
Number A
= 0
Number B
= 0
Input A Input B Product (output)
Now add all the rows together ↓
 
 

Under the hood: those four rows get added together using the exact same ripple-carry adder from Chapter 5 (just chained a few times back to back). Binary multiplication really is just "AND gates decide what to add, then add it" — no times-tables anywhere.