Two’s Complement of
To find the two’s complement of a binary number, the standard procedure is: [bitwise inversion]{def="Flipping each bit (0↔1)} then add 1; the result represents the negation under a fixed bit-width. This course section demonstrates the computation for (a 7-bit value).
Note: Two’s complement is defined with respect to an -bit width. Here, we treat as exactly 7 bits, since no other width is specified.
Two's Complement (Inverting Bits and Adding 1)
Key concepts used here:
- two’s complement
- bit-width
- bitwise inversion
- LSB
Because the bit-width controls the interpretation and overflow behavior, we compute the two’s complement using the same 7 bits as the given number.
Compute the two’s complement of $1011011$
- 1Step 1
Use 7 bits because the input has 7 digits: .
- 2Step 2
Change and : .
- 3Step 3
Compute .
- 4Step 4
Therefore, the two’s complement of is .
We can also verify the negation property in 7 bits: The sum equals , which becomes when only 7 bits are kept—consistent with two’s complement modulo arithmetic for .
Pro Tip: Don’t guess the bit-width
If a question gives a binary string with no width, use its length as . Changing changes the two’s complement result.
Overflow / carry matters
When you add the final , you may get a carry out of the MSB; with fixed bits, that carry is dropped (mod ).
Bit transformation from to its two’s complement
Shows each stage aligned per bit position (MSB → LSB).
Common checks and extensions
Two’s Complement Quick Deck
Knowledge Check
What is the two’s complement of (using 7 bits)?