| | | | | linguist.page@gmail.com

How does a machine store -5? It has no minus key. No sign. Only 0 and 1.

The answer isn’t to add a symbol — it’s to redefine what a bit pattern means. That redefinition is two’s complement.


The Sign Bit

In an 8-bit number, the leftmost bit is reserved for sign:

So 00000101 is +5. But what is -5?


How to Negate

Two steps only:

1. Flip every bit (one’s complement):

00000101  →  11111010

2. Add 1:

11111010
+       1
---------
11111011

11111011 is -5. That’s it.


Why It Works

Add +5 and -5 — the result should be zero:

  00000101   (+5)
+ 11111011   (-5)
----------
 100000000

The carry spills beyond 8 bits and is discarded. What remains: 00000000

The hardware needs no special subtraction circuit. A - B is just A + (two's complement of B). One operation, not two.


The Range

For an 8-bit number:

Asymmetric by one — because zero takes a slot on the positive side.


The Pattern

Flip all bits. Add 1. Done.

Two’s complement doesn’t represent negative numbers — it encodes them as a pattern the hardware can add without modification. Subtraction becomes addition. Elegance through constraint.