We can represent negative numbers using the binary system in a number of ways. In this note I’ll focus on 2’s complement, where the most-significant bit (MSB) denotes the sign of the number, because it’s the most pratical way to represent when dealing with digital circuits.
To find the 2’s complement of a binary number we take the following action while examining the bits from right to left:
- Copy all bits that are 0 and the first that is 1;
- Complement (invert) the rest of the bits.
For example, 10110100 in 2’s complement is written as 01001100. In the following table we have the representation of all four-bit numbers in different representations.