Why this matters
A computer's processor really only knows how to add. Yet it has to subtract too, and it has no "minus" circuit. The trick is to turn subtraction into addition using complements. Seeing how binary arithmetic works shows you what is really happening inside the chip when it does math.
The idea
Binary addition works column by column, just like decimal, but you only have 0 and 1. The rules: 0+0 = 0, 0+1 = 1, and 1+1 = 10. That is, write 0 and carry 1 to the next column. 1+1+1 = 11 (write 1, carry 1).
Binary subtraction also goes column by column. When the top digit is too small you borrow 2 from the next-higher column: 0−0 = 0, 1−0 = 1, 1−1 = 0, and 10−1 = 1.
A complement is the smallest number you can add to a value to push it past its current number of digits (to carry over). In binary this is the two's complement, and it has a mechanical recipe: flip every bit (0 becomes 1, 1 becomes 0), then add 1.
Why bother? Because a computer can subtract by adding the complement. To compute A − B: find the two's complement of B, add it to A, then drop the extra leading digit. The leftover is the answer. That is how processors with only an adder still manage subtraction.
Picture it
flowchart TD Start["Want: A minus B"] --> C["Find two's complement of B: flip bits, add 1"] C --> Add["Add A plus complement"] Add --> Drop["Drop the extra leading digit"] Drop --> Ans["Result equals A minus B"]
Worked example
First a plain subtraction: 1010 − 0110 (that is 10 − 6). Column by column with borrowing gives 0100, which is 4. Correct.
Now do it the computer's way. The two's complement of 0111 (which is 7) is: flip 0111 → 1000, then add 1 → 1001. To compute 1000 − 0111 (8 − 7), add 1000 + 1001 = 10001. Drop the leading 1 and you are left with 0001 = 1. And indeed 8 − 7 = 1.
Your turn
Try the practice: pick the correct sum of two binary numbers, choose the two's complement of a value, and match each rule (carry, borrow, two's complement) to what it does.
Recap
- Binary addition: 1+1 = 10, so you carry 1; subtraction borrows 2 when needed.
- Two's complement = flip every bit, then add 1.
- A computer subtracts by adding the complement and dropping the leading digit.