Complement Representation
CREATED: 2026 / 05 / 07 Thu
UPDATED: 2026 / 05 / 07 Thu
What Is a Complement?
I honestly struggle to put a precise abstract definition into words, but as far as I understand it, a complement is a tool for achieving two things:
- Representing negative numbers within a fixed data width
- Treating subtraction as addition
I’m not sure about the historical order, but it feels like the subtraction-as-addition benefit was more of a happy discovery after the fact. My guess is that someone devised complements to represent negative numbers and then realized it conveniently made subtraction work as addition too. Though it could well have been the other way around.
In binary there are two kinds of complement representation — one’s complement and two’s complement — and I’ll cover both here. (Note that this article only covers binary complements; decimal has its own 10’s complement and 9’s complement.)
One’s Complement
One’s complement is obtained by inverting every bit.
Example: Find the one’s complement of 0101(2) in a 4-bit space.
0101 → invert all bits → 1010
So 0101(2) represents 5(10), and 1010(2) represents -5(10).
In complement representation, the most significant bit (MSB) acts as the sign bit: 0 means positive, 1 means negative.
The representable range of one’s complement in 4 bits:
| Binary | Decimal |
|---|---|
| 0111 | +7 |
| 0001 | +1 |
| 0000 | +0 |
| 1111 | -0 |
| 1110 | -1 |
| 1000 | -7 |
As you can see, complement representation isn’t about expressing all possible numbers — it’s a technique for expressing both positive and negative values within a limited space (in this case, 4 bits). This is especially useful in systems with finite memory, where it expands the range of expressible values. It also has the bonus of making subtraction work as addition.
However, one’s complement has a problem: 0000 means +0 and 1111 means -0, so the value “zero” has two representations.
For this reason, one’s complement is rarely used in modern computers — two’s complement is used instead.
Two’s Complement
Two’s complement is obtained by adding 1 to the one’s complement.
two's complement = one's complement + 1
Example: Find the two’s complement of 0101(2) in a 4-bit space.
0101(2)
↓ invert all bits (one's complement)
1010(2)
↓ add 1
1011(2)
So 0101(2) represents 5(10), and 1011(2) represents -5(10).
The representable range of two’s complement in 4 bits:
| Binary | Decimal |
|---|---|
| 0111 | +7 |
| 0001 | +1 |
| 0000 | 0 |
| 1111 | -1 |
| 1110 | -2 |
| 1000 | -8 |
The +0 / -0 duplicate is eliminated — 0 has exactly one representation: 0000.
The representable range for n bits is -2^(n-1) to 2^(n-1) - 1.
For 4 bits, that is -8 to +7.
Benefits of Complements
To recap, the benefits of complement representation are:
- Representing negative numbers within a fixed data width
- Treating subtraction as addition
The first point should be clear from the examples above. Here I’ll focus on the second.
Treating Subtraction as Addition
Normally A - B is computed directly, but with two’s complement it can be rewritten as:
A - B = A + (-B)
-B is simply the two’s complement of B.
For example, compute 5 - 3 using 4-bit binary:
5 = 0101(2)
3 = 0011(2) → two's complement → 1101(2)
0 1 0 1 (= 5)
+ 1 1 0 1 (= -3)
---------
0 0 1 0 (= 2, carry out from MSB is discarded in 4-bit arithmetic)
Verification in decimal: 5 - 3 = 2.
Closing
I’m planning to add a math tag soon. I’d like to write up trigonometry for 3DCG at some point.